Skip to contentSkip to conversation

lmb: Bump CONFIG_LMB_MAX_REGIONS

PATCH In review Michal Suchanek 4 participants 11 messages Jan 27, 2023 – Feb 23, 2023 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lmb: Bump CONFIG_LMB_MAX_REGIONS

It is reported that in some configurations it is not possible to boot because u-boot runs out of lmbs.

commit 06d514d77c ("lmb: consider EFI memory map") increases lmb usage, hence is likely the cause of the lmb overflow.

Fixes 06d514d77c ("lmb: consider EFI memory map")
---
 lib/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/Kconfig +1 -1
index 549bd35778..06c873c2bd 100644
@@ -1038,7 +1038,7 @@ config LMB_USE_MAX_REGIONS
 config LMB_MAX_REGIONS
 	int "Number of memory and reserved regions in lmb lib"
 	depends on LMB && LMB_USE_MAX_REGIONS
-	default 8
+	default 16
 	help
 	  Define the number of supported regions, memory and reserved, in the
 	  library logical memory blocks.
Signature · 1 line
2.39.0
#1 lore raw
Quoted 9 lines · Michal Suchanek

It is reported that in some configurations it is not possible to boot because u-boot runs out of lmbs.

commit 06d514d77c ("lmb: consider EFI memory map") increases lmb usage, hence is likely the cause of the lmb overflow.

Fixes 06d514d77c ("lmb: consider EFI memory map")

I plan to pick up
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
as the alternative fix for this issue and would suggest that any distro hitting the problem on v2023.01 apply the above instead of increasing the limit.

Signature · 1 line
Tom
Reviewed-by
#2 lore raw

Hello,

Quoted 10 lines · Tom Rini
Quoted 9 lines · Michal Suchanek

It is reported that in some configurations it is not possible to boot because u-boot runs out of lmbs.

commit 06d514d77c ("lmb: consider EFI memory map") increases lmb usage, hence is likely the cause of the lmb overflow.

Fixes 06d514d77c ("lmb: consider EFI memory map")
Quoted 5 lines

I plan to pick up
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
as the alternative fix for this issue and would suggest that any distro hitting the problem on v2023.01 apply the above instead of increasing the limit.

Tom, my understanding is that you plan to merge this or an equivalent change, correct? Otherwise I would need to send some more patches to update a few board defconfig that are affected by this specific issue.

Thanks,
Francesco

#3 lore raw
Quoted 22 lines · Francesco Dolcini

Hello,

Quoted 10 lines · Tom Rini
Quoted 9 lines · Michal Suchanek

It is reported that in some configurations it is not possible to boot because u-boot runs out of lmbs.

commit 06d514d77c ("lmb: consider EFI memory map") increases lmb usage, hence is likely the cause of the lmb overflow.

Fixes 06d514d77c ("lmb: consider EFI memory map")
Quoted 5 lines

I plan to pick up
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
as the alternative fix for this issue and would suggest that any distro hitting the problem on v2023.01 apply the above instead of increasing the limit.

Quoted 3 lines

Tom, my understanding is that you plan to merge this or an equivalent change, correct? Otherwise I would need to send some more patches to update a few board defconfig that are affected by this specific issue.

Yes, I was hoping to push the equivalent of this patch a few hours ago, along with the revert. Then I noticed the test in test/lib/lmb.c doesn't scale past 8, and I just now figured out what that should look like instead, I believe.

Signature · 1 line
Tom
#4 lore raw

Hello,

Quoted 23 lines · Tom Rini
Quoted 22 lines · Francesco Dolcini

Hello,

Quoted 10 lines · Tom Rini
Quoted 9 lines · Michal Suchanek

It is reported that in some configurations it is not possible to boot because u-boot runs out of lmbs.

commit 06d514d77c ("lmb: consider EFI memory map") increases lmb usage, hence is likely the cause of the lmb overflow.

Fixes 06d514d77c ("lmb: consider EFI memory map")
Quoted 5 lines

I plan to pick up
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
as the alternative fix for this issue and would suggest that any distro hitting the problem on v2023.01 apply the above instead of increasing the limit.

Quoted 8 lines
Quoted 3 lines

Tom, my understanding is that you plan to merge this or an equivalent change, correct? Otherwise I would need to send some more patches to update a few board defconfig that are affected by this specific issue.

Yes, I was hoping to push the equivalent of this patch a few hours ago, along with the revert. Then I noticed the test in test/lib/lmb.c doesn't scale past 8, and I just now figured out what that should look like instead, I believe.

reportedly neither fixes the problem in all cases, and raising CONFIG_LMB_RESERVED_REGIONS is required.

Looks like the mechanism to add regions above the default number does not work as intended.

The test is to boot rPi 4 from USB directly with recent firmware.

Thanks

Michal

#5 lore raw
Quoted 35 lines · Michal Suchánek

Hello,

Quoted 23 lines · Tom Rini
Quoted 22 lines · Francesco Dolcini

Hello,

Quoted 10 lines · Tom Rini
Quoted 9 lines · Michal Suchanek

It is reported that in some configurations it is not possible to boot because u-boot runs out of lmbs.

commit 06d514d77c ("lmb: consider EFI memory map") increases lmb usage, hence is likely the cause of the lmb overflow.

Fixes 06d514d77c ("lmb: consider EFI memory map")
Quoted 5 lines

I plan to pick up
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
as the alternative fix for this issue and would suggest that any distro hitting the problem on v2023.01 apply the above instead of increasing the limit.

Quoted 8 lines
Quoted 3 lines

Tom, my understanding is that you plan to merge this or an equivalent change, correct? Otherwise I would need to send some more patches to update a few board defconfig that are affected by this specific issue.

Yes, I was hoping to push the equivalent of this patch a few hours ago, along with the revert. Then I noticed the test in test/lib/lmb.c doesn't scale past 8, and I just now figured out what that should look like instead, I believe.

Quoted 7 lines

reportedly neither fixes the problem in all cases, and raising CONFIG_LMB_RESERVED_REGIONS is required.

Looks like the mechanism to add regions above the default number does not work as intended.

The test is to boot rPi 4 from USB directly with recent firmware.

Well, given 0089affee275 ("configs: stm32mp15: increase the number of reserved memory region in lmb") I guess this has been run in to before, but not resolved more generically.

Signature · 1 line
Tom
#6 lore raw
Quoted 39 lines · Tom Rini
Quoted 38 lines · Michal Suchánek

Hello,

Quoted 23 lines · Tom Rini
Quoted 22 lines · Francesco Dolcini

Hello,

Quoted 10 lines · Tom Rini
Quoted 9 lines · Michal Suchanek

It is reported that in some configurations it is not possible to boot because u-boot runs out of lmbs.

commit 06d514d77c ("lmb: consider EFI memory map") increases lmb usage, hence is likely the cause of the lmb overflow.

Fixes 06d514d77c ("lmb: consider EFI memory map")
Quoted 5 lines

I plan to pick up
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
as the alternative fix for this issue and would suggest that any distro hitting the problem on v2023.01 apply the above instead of increasing the limit.

Quoted 8 lines
Quoted 3 lines

Tom, my understanding is that you plan to merge this or an equivalent change, correct? Otherwise I would need to send some more patches to update a few board defconfig that are affected by this specific issue.

Yes, I was hoping to push the equivalent of this patch a few hours ago, along with the revert. Then I noticed the test in test/lib/lmb.c doesn't scale past 8, and I just now figured out what that should look like instead, I believe.

reportedly neither fixes the problem in all cases, and raising CONFIG_LMB_RESERVED_REGIONS is required.

Quoted 8 lines
Quoted 4 lines

Looks like the mechanism to add regions above the default number does not work as intended.

The test is to boot rPi 4 from USB directly with recent firmware.

Well, given 0089affee275 ("configs: stm32mp15: increase the number of reserved memory region in lmb") I guess this has been run in to before, but not resolved more generically.

I wonder if
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
is what will finish dealing with these issues, even the ones that had perhaps shown up before and been addressed in the commit I mentioned above?

Signature · 1 line
Tom
#7 lore raw

Hello,

Quoted 49 lines · Tom Rini
Quoted 39 lines · Tom Rini
Quoted 38 lines · Michal Suchánek

Hello,

Quoted 23 lines · Tom Rini
Quoted 22 lines · Francesco Dolcini

Hello,

Quoted 10 lines · Tom Rini
Quoted 9 lines · Michal Suchanek

It is reported that in some configurations it is not possible to boot because u-boot runs out of lmbs.

commit 06d514d77c ("lmb: consider EFI memory map") increases lmb usage, hence is likely the cause of the lmb overflow.

Fixes 06d514d77c ("lmb: consider EFI memory map")
Quoted 5 lines

I plan to pick up
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
as the alternative fix for this issue and would suggest that any distro hitting the problem on v2023.01 apply the above instead of increasing the limit.

Quoted 8 lines
Quoted 3 lines

Tom, my understanding is that you plan to merge this or an equivalent change, correct? Otherwise I would need to send some more patches to update a few board defconfig that are affected by this specific issue.

Yes, I was hoping to push the equivalent of this patch a few hours ago, along with the revert. Then I noticed the test in test/lib/lmb.c doesn't scale past 8, and I just now figured out what that should look like instead, I believe.

reportedly neither fixes the problem in all cases, and raising CONFIG_LMB_RESERVED_REGIONS is required.

Quoted 8 lines
Quoted 4 lines

Looks like the mechanism to add regions above the default number does not work as intended.

The test is to boot rPi 4 from USB directly with recent firmware.

Well, given 0089affee275 ("configs: stm32mp15: increase the number of reserved memory region in lmb") I guess this has been run in to before, but not resolved more generically.

Quoted 5 lines

I wonder if
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
is what will finish dealing with these issues, even the ones that had perhaps shown up before and been addressed in the commit I mentioned above?

Looks like this together with raising the maximum number of regions works, that is v2023.04-rc2 should be fixed.

Thanks

Michal

#8 lore raw

Hi,

Quoted 51 lines · Michal Suchánek

Hello,

Quoted 40 lines · Tom Rini
Quoted 39 lines · Tom Rini
Quoted 38 lines · Michal Suchánek

Hello,

Quoted 21 lines · Tom Rini
Quoted 20 lines · Francesco Dolcini

Hello,

Quoted 10 lines · Tom Rini
Quoted 9 lines · Michal Suchanek

It is reported that in some configurations it is not possible to boot because u-boot runs out of lmbs.

commit 06d514d77c ("lmb: consider EFI memory map") increases lmb usage, hence is likely the cause of the lmb overflow.

Fixes 06d514d77c ("lmb: consider EFI memory map")
Quoted 5 lines

I plan to pick up
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
as the alternative fix for this issue and would suggest that any distro hitting the problem on v2023.01 apply the above instead of increasing the limit.

Quoted 7 lines
Quoted 3 lines

Tom, my understanding is that you plan to merge this or an equivalent change, correct? Otherwise I would need to send some more patches to update a few board defconfig that are affected by this specific issue.

Yes, I was hoping to push the equivalent of this patch a few hours ago, along with the revert. Then I noticed the test in test/lib/lmb.c doesn't scale past 8, and I just now figured out what that should look like instead, I believe.

reportedly neither fixes the problem in all cases, and raising CONFIG_LMB_RESERVED_REGIONS is required.

Looks like the mechanism to add regions above the default number does not work as intended.

The test is to boot rPi 4 from USB directly with recent firmware.

Quoted 8 lines
Quoted 3 lines

Well, given 0089affee275 ("configs: stm32mp15: increase the number of reserved memory region in lmb") I guess this has been run in to before, but not resolved more generically.

I wonder if
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
is what will finish dealing with these issues, even the ones that had perhaps shown up before and been addressed in the commit I mentioned above?

Quoted 6 lines

Looks like this together with raising the maximum number of regions works, that is v2023.04-rc2 should be fixed.

Thanks

Michal

For STM32MP15x platform with have the same issue when the number of reserved regions increased in Linux device tree.

I try to increase the region by default with CONFIG_LMB_MAX_REGIONS,

but my patch increase the used RAM size for some platform (with compilation issue).

For Tom ask me to propose a backward compatible configuration

https://lore.kernel.org/all/[email protected]/

=> CONFIG_USE_LMB_MAX_REGIONS

Moreover, if you increased CONFIG_LMB_MAX_REGIONS

the same number of region (N) is used for reserved regions (N) and for  memory region (N)

=> the total size used = 2 * N * size of each memory region descriptor.

But for most of case only the number reserved regions need to be increased to parse the device tree.

With my patch the number of regions are statically managed by  2 array independently

- reserved regions = CONFIG_LMB_RESERVED_REGIONS

- memory region = CONFIG_LMB_MEMORY_REGIONS

And the total number of region (size of struct in memory) =

CONFIG_LMB_RESERVED_REGIONS + CONFIG_LMB_MEMORY_REGIONS

I think a good solution to have by default, if you want managed more reserved memory by default in U-Boot for all platform:

=> LMB_USE_MAX_REGIONS=n  instead of 'y' today

=> LMB_MEMORY_REGIONS=8

=> LMB_RESERVED_REGIONS=16 or 32 instead of 8 today by default

And change the defconfig for the size constraint platforms

to use the previous behavior with LMB_USE_MAX_REGIONS=y.

NB: I define the default value with 8 to keep the previous limit and

       I just increase the number of region for the STM32MP platform:

configs/stm32mp15_defconfig:170:CONFIG_LMB_RESERVED_REGIONS=16 configs/stm32mp15_trusted_defconfig:170:CONFIG_LMB_RESERVED_REGIONS=16 configs/stm32mp13_defconfig:81:CONFIG_LMB_RESERVED_REGIONS=16 configs/stm32mp15_basic_defconfig:194:CONFIG_LMB_RESERVED_REGIONS=16

I use the default value for CONFIG_LMB_MEMORY_REGIONS =8

Reference = https://lore.kernel.org/all/[email protected]/

Patrick

#9 lore raw
Quoted 129 lines · Patrick DELAUNAY

Hi,

Quoted 51 lines · Michal Suchánek

Hello,

Quoted 40 lines · Tom Rini
Quoted 39 lines · Tom Rini
Quoted 38 lines · Michal Suchánek

Hello,

Quoted 21 lines · Tom Rini
Quoted 20 lines · Francesco Dolcini

Hello,

Quoted 10 lines · Tom Rini
Quoted 9 lines · Michal Suchanek

It is reported that in some configurations it is not possible to boot because u-boot runs out of lmbs.

commit 06d514d77c ("lmb: consider EFI memory map") increases lmb usage, hence is likely the cause of the lmb overflow.

Fixes 06d514d77c ("lmb: consider EFI memory map")
Quoted 5 lines

I plan to pick up
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
as the alternative fix for this issue and would suggest that any distro hitting the problem on v2023.01 apply the above instead of increasing the limit.

Quoted 7 lines
Quoted 3 lines

Tom, my understanding is that you plan to merge this or an equivalent change, correct? Otherwise I would need to send some more patches to update a few board defconfig that are affected by this specific issue.

Yes, I was hoping to push the equivalent of this patch a few hours ago, along with the revert. Then I noticed the test in test/lib/lmb.c doesn't scale past 8, and I just now figured out what that should look like instead, I believe.

reportedly neither fixes the problem in all cases, and raising CONFIG_LMB_RESERVED_REGIONS is required.

Looks like the mechanism to add regions above the default number does not work as intended.

The test is to boot rPi 4 from USB directly with recent firmware.

Quoted 8 lines
Quoted 3 lines

Well, given 0089affee275 ("configs: stm32mp15: increase the number of reserved memory region in lmb") I guess this has been run in to before, but not resolved more generically.

I wonder if
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
is what will finish dealing with these issues, even the ones that had perhaps shown up before and been addressed in the commit I mentioned above?

Quoted 6 lines

Looks like this together with raising the maximum number of regions works, that is v2023.04-rc2 should be fixed.

Thanks

Michal

For STM32MP15x platform with have the same issue when the number of reserved regions increased in Linux device tree.

I try to increase the region by default with CONFIG_LMB_MAX_REGIONS,

but my patch increase the used RAM size for some platform (with compilation issue).

For Tom ask me to propose a backward compatible configuration

https://lore.kernel.org/all/[email protected]/

=> CONFIG_USE_LMB_MAX_REGIONS

Moreover, if you increased CONFIG_LMB_MAX_REGIONS

the same number of region (N) is used for reserved regions (N) and for memory region (N)

=> the total size used = 2 * N * size of each memory region descriptor.

But for most of case only the number reserved regions need to be increased to parse the device tree.

With my patch the number of regions are statically managed by  2 array independently

- reserved regions = CONFIG_LMB_RESERVED_REGIONS

- memory region = CONFIG_LMB_MEMORY_REGIONS

And the total number of region (size of struct in memory) =

CONFIG_LMB_RESERVED_REGIONS + CONFIG_LMB_MEMORY_REGIONS

I think a good solution to have by default, if you want managed more reserved memory by default in U-Boot for all platform:

=> LMB_USE_MAX_REGIONS=n  instead of 'y' today

=> LMB_MEMORY_REGIONS=8

=> LMB_RESERVED_REGIONS=16 or 32 instead of 8 today by default

And change the defconfig for the size constraint platforms

to use the previous behavior with LMB_USE_MAX_REGIONS=y.

NB: I define the default value with 8 to keep the previous limit and

       I just increase the number of region for the STM32MP platform:

configs/stm32mp15_defconfig:170:CONFIG_LMB_RESERVED_REGIONS=16 configs/stm32mp15_trusted_defconfig:170:CONFIG_LMB_RESERVED_REGIONS=16 configs/stm32mp13_defconfig:81:CONFIG_LMB_RESERVED_REGIONS=16 configs/stm32mp15_basic_defconfig:194:CONFIG_LMB_RESERVED_REGIONS=16

Quoted 4 lines

I use the default value for CONFIG_LMB_MEMORY_REGIONS =8

Reference = https://lore.kernel.org/all/[email protected]/

Ah, OK, thanks for explaining.

Signature · 1 line
Tom
#10 lore raw
In reply to Michal Suchanek
Quoted 9 lines · Michal Suchanek

It is reported that in some configurations it is not possible to boot because u-boot runs out of lmbs.

commit 06d514d77c ("lmb: consider EFI memory map") increases lmb usage, hence is likely the cause of the lmb overflow.

Fixes 06d514d77c ("lmb: consider EFI memory map")

In the interest of completeness, I was wrong in what I was thinking was the wider fix and have taken
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
as it was posted first, but added the fixes/link to that commit as well.

Signature · 1 line
Tom