linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Mike Rapoport <rppt@kernel.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Hou Wenlong <houwenlong.hwl@antgroup.com>,
	linux-kernel@vger.kernel.org,
	David Hildenbrand <david@kernel.org>,
	Lorenzo Stoakes <lorenzo.stoakes@oracle.com>,
	"Liam R. Howlett" <Liam.Howlett@oracle.com>,
	Vlastimil Babka <vbabka@suse.cz>,
	Suren Baghdasaryan <surenb@google.com>,
	Michal Hocko <mhocko@suse.com>,
	linux-mm@kvack.org
Subject: Re: [PATCH] mm/early_ioremap: Print the starting physical address in __early_ioremap()
Date: Sun, 11 Jan 2026 11:15:45 +0200	[thread overview]
Message-ID: <aWNqQd3CVx8Z_KFB@kernel.org> (raw)
In-Reply-To: <20260110155721.84af2e403badeeb29c7734e3@linux-foundation.org>

On Sat, Jan 10, 2026 at 03:57:21PM -0800, Andrew Morton wrote:
> On Fri,  9 Jan 2026 21:31:51 +0800 Hou Wenlong <houwenlong.hwl@antgroup.com> wrote:
> 
> > The debug WARN() printing occurs after the while loop, so the
> > 'phys_addr' reflects the last physical address rather than the actual
> > starting physical address, which is not useful for debugging. To
> > simplify, the WARN() statement could be moved up before the loop instead
> > of introducing a new variable to record the original 'phys_addr' value.
> > Additionally, swap the print order of 'slot_virt[slot]' and 'offset', as
> > this will enhance output readability.
> > 
> 
> yep, thanks.
> 
> > --- a/mm/early_ioremap.c
> > +++ b/mm/early_ioremap.c
> > @@ -139,6 +139,9 @@ __early_ioremap(resource_size_t phys_addr, unsigned long size, pgprot_t prot)
> >  	if (WARN_ON(nrpages > NR_FIX_BTMAPS))
> >  		return NULL;
> >  
> > +	WARN(early_ioremap_debug, "%s(%pa, %08lx) [%d] => %08lx + %08lx\n",
> > +	     __func__, &phys_addr, size, slot, slot_virt[slot], offset);
> > +
> >  	/*
> >  	 * Ok, go for it..
> >  	 */
> > @@ -152,8 +155,6 @@ __early_ioremap(resource_size_t phys_addr, unsigned long size, pgprot_t prot)
> >  		--idx;
> >  		--nrpages;
> >  	}
> > -	WARN(early_ioremap_debug, "%s(%pa, %08lx) [%d] => %08lx + %08lx\n",
> > -	     __func__, &phys_addr, size, slot, offset, slot_virt[slot]);
> 
> It's strange that this code uses WARN when nothing is wrong.  The rest
> of the function uses WARN appropriately.  But that's off-topic!

It seems an historic thing. A nice cleanup would be to replace
WARN(early_ioremap_debug) with pr_warn() + dump_stack().
 
> Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
> 

-- 
Sincerely yours,
Mike.


  reply	other threads:[~2026-01-11  9:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-09 13:31 Hou Wenlong
2026-01-10 23:57 ` Andrew Morton
2026-01-11  9:15   ` Mike Rapoport [this message]
2026-01-11  9:14 ` Mike Rapoport

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aWNqQd3CVx8Z_KFB@kernel.org \
    --to=rppt@kernel.org \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@kernel.org \
    --cc=houwenlong.hwl@antgroup.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=mhocko@suse.com \
    --cc=surenb@google.com \
    --cc=vbabka@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox