lmb: Add config for the number of memory and reserved regions
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v2 Latest8 patches 0 repliesNew
- v10 of 5 patches 0 repliesSuperseded
Changes in v2 from the cover letter
- add a max parameter extracted from v1 [3/5]
- new in v2: introduced MAX_LMB_REGIONS
- new in V2: reduce size impact by correct regions array size
- new in V2: add test for overflow protection in lmb libary
- rework v1 [4/5] to keep current optimization by default when CONFIG_LMB_USE_MAX_REGIONS=n
- Add CONFIG_LMB_USE_MAX_REGIONS=n and reduce LMB_MEMORY_REGIONS to reduce the used size in stack
Patches in v2 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/8 | lmb: move CONFIG_LMB in Kconfigarch/ arch/ arch/ +15 more | +8 | 1 reply | |
| 2/8 | lmb: remove lmb_region.sizeinclude/ lib/ | +0 | 1 reply | |
| 3/8 | lmb: add a max parameter in the struct lmb_regioninclude/ lib/ | +5 | 1 reply | |
| 4/8 | lmb: move MAX_LMB_REGIONS value in Kconfiginclude/ lib/ lib/ | +12 | 1 reply | |
| 5/8 | lmb: correct size of the regions arrayinclude/ | +1 | 1 reply | |
| 6/8 | test: lmb: add test for overflow protection in lmb_add_regiontest/ | +64 | 1 reply | |
| 7/8 | lmb: Add 2 config to define the max number of regionsinclude/ lib/ lib/ | +69 | 1 reply | |
| 8/8 | configs: stm32mp15: increase the number of reserved memory region in lmbconfigs/ configs/ | +6 | 1 reply |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.
Cover letter [PATCH v2 0/8] lmb: Add config for the number of memory and reserved regions
Hi,
It is the V2 of [1]
I propose a update of the lmb library to allow the configuration with Kconfig of the number of memory regions and of reserved regions in lmb library with:
- CONFIG_LMB_RESERVED_REGIONS
- CONFIG_LMB_MEMORY_REGIONS
This serie avoids issue on stm32mp15 platform,
as the kernel device tree defines many and non contiguous reserved regions.
It is based on latest memblock library in kernel (it was a preliminary step for dynamic allocation of regions array to avoid any static limitation).
PS: in patch 1, I manage CONFIG_LMB dependency in lib/Kconfig file, with
default y depends on ...
but it can do also in each arch by an imply or a select as it is done in [2].
I am not sure what is the best solution for this dependency.
In this V2 series, I keep the default value of 8 regions defined in struct lmb_region with:
- CONFIG_LMB_USE_MAX_REGIONS = n
- CONFIG_LMB_MAX_REGIONS = 8
When the array is located in struct lmb_region (with CONFIG_LMB_USE_MAX_REGIONS = n), the compiler do some optimization useful for size-constraint target, for example the nokia_rx51 target increases by 152 bytes.
arm: (for 3/3 boards) all +50.7 bss +2.7 text +48.0
nokia_rx51 : all +152 bss +8 text +144
u-boot: add: 2/0, grow: 5/-2 bytes: 192/-40 (152)
function old new delta
lmb_remove_region - 96 +96
lmb_init - 44 +44
lmb_add_region 416 440 +24
__lmb_alloc_base 224 236 +12
images 288 296 +8
lmb_overlaps_region 80 84 +4
lmb_alloc_addr 108 112 +4
lmb_init_and_reserve_range 56 36 -20
lmb_init_and_reserve 100 80 -20
But it is not the case for all platform (STM32MP15 for example).
To optimize this size impact, I reduce the the regions array size and add a test on overflow management in the lmb, but it is not enough.
So I try to optimized the lmb code to avoid the size impact when CONFIG_LMB_USE_MAX_REGIONS = y but it is not working and I prefer kept a code align with Linux kernel memblock library and kept the current behavior a this.
With v2 the CI/CD build is now OK [3]
[1] lmb: Add config for the number of memory and reserved regions
http://patchwork.ozlabs.org/project/uboot/list/?series=227570&state=*
[2] arch: Move NEEDS_MANUAL_RELOC symbol to Kconfig
http://patchwork.ozlabs.org/project/uboot/list/?series=212154&state=*
[3] https://source.denx.de/u-boot/custodians/u-boot-stm/-/pipelines/6616
Changes in v2:
- add a max parameter extracted from v1 [3/5]
- new in v2: introduced MAX_LMB_REGIONS
- new in V2: reduce size impact by correct regions array size
- new in V2: add test for overflow protection in lmb libary
- rework v1 [4/5] to keep current optimization by default when CONFIG_LMB_USE_MAX_REGIONS=n
- Add CONFIG_LMB_USE_MAX_REGIONS=n and reduce LMB_MEMORY_REGIONS to reduce the used size in stack
Patrick Delaunay (8):
lmb: move CONFIG_LMB in Kconfig
lmb: remove lmb_region.size
lmb: add a max parameter in the struct lmb_region
lmb: move MAX_LMB_REGIONS value in Kconfig
lmb: correct size of the regions array
test: lmb: add test for overflow protection in lmb_add_region
lmb: Add 2 config to define the max number of regions
configs: stm32mp15: increase the number of reserved memory region in
lmb
arch/arc/include/asm/config.h | 2 - arch/arm/include/asm/config.h | 1 - arch/m68k/include/asm/config.h | 1 - arch/microblaze/include/asm/config.h | 2 - arch/mips/include/asm/config.h | 1 - arch/nds32/include/asm/config.h | 1 - arch/powerpc/include/asm/config.h | 1 - arch/riscv/include/asm/config.h | 1 - arch/sh/include/asm/config.h | 2 - arch/x86/include/asm/config.h | 1 - arch/xtensa/include/asm/config.h | 2 - configs/stm32mp15_basic_defconfig | 3 ++ configs/stm32mp15_trusted_defconfig | 3 ++ include/configs/10m50_devboard.h | 5 --- include/configs/3c120_devboard.h | 5 --- include/configs/sandbox.h | 2 - include/configs/x86-common.h | 2 - include/image.h | 2 +- include/lmb.h | 40 +++++++++++++++-- lib/Kconfig | 44 ++++++++++++++++++- lib/lmb.c | 17 +++++--- scripts/config_whitelist.txt | 1 - test/lib/lmb.c | 64 ++++++++++++++++++++++++++++ 23 files changed, 160 insertions(+), 43 deletions(-)
Signature · 1 line
2.17.1