linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Huang Pei <huangpei@loongson.cn>
To: Mike Rapoport <rppt@kernel.org>
Cc: Yajun Deng <yajun.deng@linux.dev>,
	akpm@linux-foundation.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] memblock: fix crash when reserved memory is not added to memory
Date: Fri, 19 Jan 2024 10:26:41 +0800	[thread overview]
Message-ID: <20240119022641.xyw4n4dj2iw2deas@Board-3A3000> (raw)
In-Reply-To: <ZajIQGtqUNWgBWkk@kernel.org>

On Thu, Jan 18, 2024 at 08:42:08AM +0200, Mike Rapoport wrote:
> (adding Huang Pei to verify this fixes the crash on loongarch)
> 
It fixed 61167ad5fecd on MIPS/loongson64, tested on 3b1500 with only
this one;

My loongarch64 machine is not available now, I can not test it, sorry.
It is already applied a arch-specific workaround in v6.5+

> On Thu, Jan 18, 2024 at 02:18:53PM +0800, Yajun Deng wrote:
> > After commit 61167ad5fecd ("mm: pass nid to reserve_bootmem_region()"),
> > we set nid on all reserved pages based on memory region, but some reserved
> > memory may not be added to memory on certain architectures. The nid is
> > invalid.
> > 
> > Add the nid check, make sure the nid is valid by early_pfn_to_nid().
> > 
> > Fixes: 61167ad5fecd ("mm: pass nid to reserve_bootmem_region()")
> > Signed-off-by: Yajun Deng <yajun.deng@linux.dev>
> > ---
> >  mm/memblock.c | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/mm/memblock.c b/mm/memblock.c
> > index abd92869874d..4dcb2ee35eca 100644
> > --- a/mm/memblock.c
> > +++ b/mm/memblock.c
> > @@ -2176,6 +2176,9 @@ static void __init memmap_init_reserved_pages(void)
> >  			start = region->base;
> >  			end = start + region->size;
> >  
> > +			if (nid == NUMA_NO_NODE || nid >= MAX_NUMNODES)
> > +				nid = early_pfn_to_nid(PFN_DOWN(start));
> > +
> >  			reserve_bootmem_region(start, end, nid);
> >  		}
> >  	}
> > -- 
> > 2.25.1
> > 
> 
> -- 
> Sincerely yours,
> Mike.



      reply	other threads:[~2024-01-23  7:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-18  6:18 Yajun Deng
2024-01-18  6:42 ` Mike Rapoport
2024-01-19  2:26   ` Huang Pei [this message]

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=20240119022641.xyw4n4dj2iw2deas@Board-3A3000 \
    --to=huangpei@loongson.cn \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=rppt@kernel.org \
    --cc=yajun.deng@linux.dev \
    /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