Subject: Re: linux-next: boot failure after merge of the memblock tree

From: Mike Rapoport <[email-masked]>
Date: Fri, 25 Oct 2024 11:42:14 +0300

On Fri, Oct 25, 2024 at 04:33:16PM +0800, Su Hua wrote:
> Su Hua <[email-masked]> 于2024年10月25日周五 16:19写道：
> >
> > Appreciate everyone.
> >
> > Mike Rapoport <[email-masked]> 于2024年10月25日周五 14:57写道：
> > >
> > > Hi Stephen,
> > >
> > > On Tue, Oct 22, 2024 at 05:39:21PM +1100, Stephen Rothwell wrote:
> > > > Hi all,
> > > >
> > > > After merging the memblock tree, today's linux-next build
> > > > (powerpc_pseries_le_defconfig) failed my qemu boot test like this:
> > > >
> > > > Kernel panic - not syncing: Attempted to kill the idle task!
> > > >
> > > > Caused by commit
> > > >
> > > >   ad48825232a9 ("memblock: uniformly initialize all reserved pages to MIGRATE_MOVABLE")
> > > >
> > > > I bisected the failure to this commit and have reverted it for today.
> > >
> > > Apparently set_pfnblock_flags_mask() is unhappy when called for
> > > uninitialized struct page. With the patch below
> > >
> > > qemu-system-ppc64el -M pseries -cpu power10 -smp 16 -m 32G -vga none -nographic -kernel $KERNEL
> > >
> > > boots up to mounting root filesystem.
> > >
> > > diff --git a/mm/mm_init.c b/mm/mm_init.c
> > > index 49dbd30e71ad..2395970314e7 100644
> > > --- a/mm/mm_init.c
> > > +++ b/mm/mm_init.c
> > > @@ -723,10 +723,10 @@ static void __meminit init_reserved_page(unsigned long pfn, int nid)
> > >                         break;
> > >         }
> > >
> > > +       __init_single_page(pfn_to_page(pfn), pfn, zid, nid);
> > > +
> > >         if (pageblock_aligned(pfn))
> > >                 set_pageblock_migratetype(pfn_to_page(pfn), MIGRATE_MOVABLE);
> > > -
> > > -       __init_single_page(pfn_to_page(pfn), pfn, zid, nid);
> >
> > Indeed, when #ifdef NODE_NOT_IN_PAGE_FLAGS is defined, there is no
> > problem, and this is why my
> > test environment did not reveal any issues. However, when
> > NODE_NOT_IN_PAGE_FLAGS is not defined,
> > page_to_nid needs to use page->flags to get the node ID, which depends
> > on __init_single_page for initialization.
> 
> Hi Mike
> Could you please advise whether the fix for this issue should be
> submitted by you or me
> as a new patch, or should I submit a patch that adjusts the code
> position, just like this:

I've folded the update into your original commit, it's now in for-next
branch of memblock tree
 
> diff --git a/mm/mm_init.c b/mm/mm_init.c
> index 4ba5607aaf19..5a8114fb02ae 100644
> --- a/mm/mm_init.c
> +++ b/mm/mm_init.c
> @@ -723,6 +723,9 @@ static void __meminit init_reserved_page(unsigned
> long pfn, int nid)
>                         break;
>         }
>         __init_single_page(pfn_to_page(pfn), pfn, zid, nid);
> +
> +       if (pageblock_aligned(pfn))
> +               set_pageblock_migratetype(pfn_to_page(pfn), MIGRATE_MOVABLE);
>  }
>  #else
> 
> Sincerely yours,
> Su

-- 
Sincerely yours,
Mike.