[PATCH] powerpc: align memory_limit to 16MB in early_parse_mem

Joel Savitz jsavitz at redhat.com
Sun Mar 3 10:59:49 AEDT 2024


On Fri, Mar 1, 2024 at 6:23 PM Michael Ellerman <mpe at ellerman.id.au> wrote:
>
> Hi Joel,
>
> Joel Savitz <jsavitz at redhat.com> writes:
> > On 64-bit powerpc, usage of a non-16MB-aligned value for the mem= kernel
> > cmdline parameter results in a system hang at boot.
>
> Can you give us any more details on that? It might be a bug we can fix.

The console freezes after the following output:

  Booting a command list

OF stdout device is: /vdevice/vty at 30000000
Preparing to boot Linux version 6.8.0-rc6.memNOfix-00120-g87adedeba51a
(root at ibm-p9z-26-lp11.virt.pnr.lab.eng.rdu2.redhat.com) (gcc (GCC)
11.4.1 20231218 (Red Hat 11.4.1-3), GNU ld version 2.35.2-43.el9) #3
SMP Fri Mar  1 10:45:45 EST 2024
Detected machine type: 0000000000000101
command line: BOOT_IMAGE=(ieee1275//vdevice/v-scsi at 30000003/disk at 8100000000000000,msdos2)/vmlinuz-6.8.0-rc6.memNOfix-00120-g87adedeba51a
root=/dev/mapper/rhel_ibm--p9z--26--lp11-root ro
crashkernel=2G-4G:384M,4G-16G:512M,16G-64G:1G,64G-128G:2G,128G-:4G
rd.lvm.lv=rhel_ibm-p9z-26-lp11/root
rd.lvm.lv=rhel_ibm-p9z-26-lp11/swap mem=4198400K
Max number of cores passed to firmware: 256 (NR_CPUS = 2048)
Calling ibm,client-architecture-support... done
Ignoring mem=0000000101000000 >= ram_top.
memory layout at init:
  memory_limit : 0000000000000000 (16 MB aligned)
  alloc_bottom : 00000000114f0000
  alloc_top    : 0000000020000000
  alloc_top_hi : 0000000020000000
  rmo_top      : 0000000020000000
  ram_top      : 0000000020000000
instantiating rtas at 0x000000001ecb0000... done
prom_hold_cpus: skipped
copying OF device tree...
Building dt strings...
Building dt structure...
Device tree strings 0x0000000011500000 -> 0x00000000115017b7
Device tree struct  0x0000000011510000 -> 0x0000000011520000
Quiescing Open Firmware ...
Booting Linux via __start() @ 0x000000000a6e0000 ...

>
> > For example, using 'mem=4198400K' will always reproduce this issue.
> >
> > This patch fixes the problem by aligning any argument to mem= to 16MB
> > corresponding with the large page size on powerpc.
>
> The large page size depends on the MMU, with Radix it's 2MB or 1GB. So
> depending on what's happening 16MB may not be enough.
>
> What system are you testing on?

I'm running a virtual system in PowerVM on an IBM Z mainframe, 8375-42A model.

Best,
Joel Savitz

>
> cheers
>
> > Fixes: 2babf5c2ec2f ("[PATCH] powerpc: Unify mem= handling")
> > Co-developed-by: Gonzalo Siero <gsierohu at redhat.com>
> > Signed-off-by: Gonzalo Siero <gsierohu at redhat.com>
> > Signed-off-by: Joel Savitz <jsavitz at redhat.com>
> > ---
> >  arch/powerpc/kernel/prom.c | 6 +++++-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> >
> > diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
> > index 0b5878c3125b..8cd3e2445d8a 100644
> > --- a/arch/powerpc/kernel/prom.c
> > +++ b/arch/powerpc/kernel/prom.c
> > @@ -82,8 +82,12 @@ static int __init early_parse_mem(char *p)
> >  {
> >       if (!p)
> >               return 1;
> > -
> > +#ifdef CONFIG_PPC64
> > +     /* Align to 16 MB == size of ppc64 large page */
> > +     memory_limit = ALIGN(memparse(p, &p), 0x1000000);
> > +#else
> >       memory_limit = PAGE_ALIGN(memparse(p, &p));
> > +#endif
> >       DBG("memory limit = 0x%llx\n", memory_limit);
> >
> >       return 0;
> > --
> > 2.43.0
>



More information about the Linuxppc-dev mailing list