[Skiboot] [PATCH] core/cpu: discover stack region size before initialising memory regions

Stewart Smith stewart at linux.vnet.ibm.com
Wed Mar 28 14:22:53 AEDT 2018


Nicholas Piggin <npiggin at gmail.com> writes:
> Stack allocation first allocates a memory region sized to hold stacks
> for all possible CPUs up to the maximum PIR of the architecture, zeros
> the region, then initialises all stacks. Max PIR is 32768 on POWER9,
> which is 512MB for stacks.
>
> The stack region is then shrunk after CPUs are discovered, but this is
> a bit of a hack, and it leaves a hole in the memory allocation regions
> as it's done after mem regions are initialised.
>
>   0x000000000000..00002fffffff : ibm,os-reserve - OS
>   0x000030000000..0000303fffff : ibm,firmware-code - OPAL
>   0x000030400000..000030ffffff : ibm,firmware-heap - OPAL
>   0x000031000000..000031bfffff : ibm,firmware-data - OPAL
>   0x000031c00000..000031c0ffff : ibm,firmware-stacks - OPAL
>   *** gap ***
>   0x000051c00000..000051d01fff : ibm,firmware-allocs-memory at 0 - OPAL
>   0x000051d02000..00007fffffff : ibm,firmware-allocs-memory at 0 - OS
>   0x000080000000..000080b3cdff : initramfs - OPAL
>   0x000080b3ce00..000080b7cdff : ibm,fake-nvram - OPAL
>   0x000080b7ce00..0000ffffffff : ibm,firmware-allocs-memory at 0 - OS
>
> This change moves zeroing into the per-cpu stack setup. The boot CPU
> stack is set up based on the current PIR. Then the size of the stack
> region is set, by discovering the maximum PIR of the system from the
> device tree, before mem regions are intialised.
>
> This results in all memory being accounted within memory regions,
> and less memory fragmentation of OPAL allocations.

Ahh neat, I'd been meaning to look into that at some point. I wonder why
I didn't go down that road ages ago...

Merged to master as of 90d53934c2dab214e8965e28070a67ed89f3e94c

-- 
Stewart Smith
OPAL Architect, IBM.



More information about the Skiboot mailing list