ARM: avoid SMP DT initialisation on UP-only capable systems
PATCH 1/1 ARM: avoid SMP DT initialisation on UP-only capable systems
arm_dt_init_cpu_maps() initialises the CPU possible map even when the boot CPU indicates that it is not SMP capable. This can happen with SoCs where the SoC may have a single UP-only CPU, or may have a pair of SMP CPUs - and this is the only difference.
One solution is to increase the number of DT files by forcing peopl to properly describe the hardware: this means all the iMX6DL DT files need to be duplicated for iMX6S and a whole raft of updates to boot loaders and the like.
Another solution is to decide that it is inappropriate to initialise the cpu_possible map with anything but the boot CPU on non-SMP capable systems. This is implemented by this patch.
The situation currently may provoke a warning on earlier kernels, printed during SMP bringup where we attempt to bring CPU1 online inspite of CPU0 being a UP-only CPU, and this only failing due to the lack of SMP operations.
--- arch/arm/kernel/devtree.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-)
arch/arm/kernel/devtree.c +12 -9
@@ -170,15 +170,18 @@ void __init arm_dt_init_cpu_maps(void)return ; } -/* -* Since the boot CPU node contains proper data, and all nodes have -* a reg property, the DT CPU list can be considered valid and the -* logical map created in smp_setup_processor_id() can be overridden -*/ -for (i =0 ; i < cpuidx; i++) { -set_cpu_possible (i, true); -cpu_logical_map (i) = tmp_map[i]; -pr_debug ("cpu logical map 0x%x\n" ,cpu_logical_map (i)); +if (is_smp ()) { +/* +* Since the boot CPU node contains proper data, and all +* nodes have a reg property, the DT CPU list can be +* considered valid and the logical map created in +* smp_setup_processor_id() can be overridden +*/ +for (i =0 ; i < cpuidx; i++) { +set_cpu_possible (i, true); +cpu_logical_map (i) = tmp_map[i]; +pr_debug ("cpu logical map 0x%x\n" ,cpu_logical_map (i)); + } } }
Signature · 1 line
2.1.0
PATCH 1/1 ARM: avoid SMP DT initialisation on UP-only capable systems
Quoted 10 lines · Russell King
arm_dt_init_cpu_maps()initialises the CPU possible map even when the boot CPU indicates that it is not SMP capable. This can happen with SoCs where the SoC may have a single UP-only CPU, or may have a pair of SMP CPUs - and this is the only difference.One solution is to increase the number of DT files by forcing peopl to properly describe the hardware: this means all the iMX6DL DT files need to be duplicated for iMX6S and a whole raft of updates to boot loaders and the like.
Quoted 8 lines
Another solution is to decide that it is inappropriate to initialise the
cpu_possiblemap with anything but the boot CPU on non-SMP capable systems. This is implemented by this patch.The situation currently may provoke a warning on earlier kernels, printed during SMP bringup where we attempt to bring CPU1 online inspite of CPU0 being a UP-only CPU, and this only failing due to the lack of SMP operations.
I think that even if we work around this, we should have a warning regarding the erroneous DT.
There are plenty of other things people may get wrong in their DT that we may or may not be able to detect and/or workaround. We should generally discourage relying on fixups and encourage people to do the right thing.
Quoted 13 lines
Signed-off-by Russell King <[email protected]>--- arch/arm/kernel/devtree.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-)arch/arm/kernel/devtree.c +0
-0@@ -170,15 +170,18 @@ void __init arm_dt_init_cpu_maps(void)return ; }
arch/arm/kernel/devtree.c void __init arm_dt_init_cpu_maps(void) · line 173
Quoted 10 lines
arch/arm/kernel/devtree.c +1
-9-/* -* Since the boot CPU node contains proper data, and all nodes have -* a reg property, the DT CPU list can be considered valid and the -* logical map created in smp_setup_processor_id() can be overridden -*/ -for (i =0 ; i < cpuidx; i++) { -set_cpu_possible (i, true); -cpu_logical_map (i) = tmp_map[i]; -pr_debug ("cpu logical map 0x%x\n" ,cpu_logical_map (i)); +if (is_smp ()) {
Can we not change this to something like:
if (!is_smp() && cpuidx >1) {
pr_warn("Boot CPU is UP, but DT contains multiple CPUs. Skipping!\n");
} else {Other than that, this looks good to me.
If you're happy with the above:
Thanks,
Mark.
Quoted 23 lines
arch/arm/kernel/devtree.c +11
-0+/* +* Since the boot CPU node contains proper data, and all +* nodes have a reg property, the DT CPU list can be +* considered valid and the logical map created in +* smp_setup_processor_id() can be overridden +*/ +for (i =0 ; i < cpuidx; i++) { +set_cpu_possible (i, true); +cpu_logical_map (i) = tmp_map[i]; +pr_debug ("cpu logical map 0x%x\n" ,cpu_logical_map (i)); + } } }Signature · 7 lines
2.1.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel at lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 1/1 ARM: avoid SMP DT initialisation on UP-only capable systems
Quoted 20 lines · Mark Rutland
Quoted 10 lines · Russell King
arm_dt_init_cpu_maps()initialises the CPU possible map even when the boot CPU indicates that it is not SMP capable. This can happen with SoCs where the SoC may have a single UP-only CPU, or may have a pair of SMP CPUs - and this is the only difference.One solution is to increase the number of DT files by forcing peopl to properly describe the hardware: this means all the iMX6DL DT files need to be duplicated for iMX6S and a whole raft of updates to boot loaders and the like.
Quoted 8 lines
Another solution is to decide that it is inappropriate to initialise the
cpu_possiblemap with anything but the boot CPU on non-SMP capable systems. This is implemented by this patch.The situation currently may provoke a warning on earlier kernels, printed during SMP bringup where we attempt to bring CPU1 online inspite of CPU0 being a UP-only CPU, and this only failing due to the lack of SMP operations.
Quoted 7 lines
I think that even if we work around this, we should have a warning regarding the erroneous DT.
There are plenty of other things people may get wrong in their DT that we may or may not be able to detect and/or workaround. We should generally discourage relying on fixups and encourage people to do the right thing.
Well, this is the problem with a static description of the hardware - it very quickly becomes unmanagable when you have lots of different combinations. For the SR platforms, there are already the base vs pro Hummingboard, Cubox-i, Hummingboard edge, Hummingboard Edge, Hummingboard Gate, each the choice of iMX6S, DL, D, Q or more uSOMs. To cover these "properly" we're going to need 24 DT files rather than 12 if we're going to require the CPUs entries to correctly describe the hardware.
Given that CPUs are discoverable from the hardware, this is getting to be insane. Yes, there's cases where we need the CPUs described in hardware, but to require the description for all platforms even where CPUs are discoverable is IMHO insane.
I think we need a better solution for this, rather than telling people their DT files need to fully describe the hardware, and at the same time, be correct.
Signature · 2 lines
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up according to speedtest.net.
PATCH 1/1 ARM: avoid SMP DT initialisation on UP-only capable systems
Am Mittwoch, den 25.11.2015, 11:49 +0000 schrieb Russell King - ARM Linux:
Quoted 38 lines · Mark Rutland
Quoted 20 lines · Russell King
Quoted 10 lines
arm_dt_init_cpu_maps()initialises the CPU possible map even when the boot CPU indicates that it is not SMP capable. This can happen with SoCs where the SoC may have a single UP-only CPU, or may have a pair of SMP CPUs - and this is the only difference.One solution is to increase the number of DT files by forcing peopl to properly describe the hardware: this means all the iMX6DL DT files need to be duplicated for iMX6S and a whole raft of updates to boot loaders and the like.
Quoted 8 lines
Another solution is to decide that it is inappropriate to initialise the
cpu_possiblemap with anything but the boot CPU on non-SMP capable systems. This is implemented by this patch.The situation currently may provoke a warning on earlier kernels, printed during SMP bringup where we attempt to bring CPU1 online inspite of CPU0 being a UP-only CPU, and this only failing due to the lack of SMP operations.
Quoted 7 lines
I think that even if we work around this, we should have a warning regarding the erroneous DT.
There are plenty of other things people may get wrong in their DT that we may or may not be able to detect and/or workaround. We should generally discourage relying on fixups and encourage people to do the right thing.
Well, this is the problem with a static description of the hardware - it very quickly becomes unmanagable when you have lots of different combinations. For the SR platforms, there are already the base vs pro Hummingboard, Cubox-i, Hummingboard edge, Hummingboard Edge, Hummingboard Gate, each the choice of iMX6S, DL, D, Q or more uSOMs. To cover these "properly" we're going to need 24 DT files rather than 12 if we're going to require the CPUs entries to correctly describe the hardware.
Quoted 9 lines
Given that CPUs are discoverable from the hardware, this is getting to be insane. Yes, there's cases where we need the CPUs described in hardware, but to require the description for all platforms even where CPUs are discoverable is IMHO insane.
I think we need a better solution for this, rather than telling people their DT files need to fully describe the hardware, and at the same time, be correct.
What we do in barebox is to look into the SCU to find out how many CPU cores are actually present and fix up the DT passed to the kernel accordingly by deleting any superfluous CPU nodes. This satisfies both the need to keep the required DT source files to a minimum, while also providing correct information to the kernel.
Regards,
Lucas
Signature · 2 lines
Pengutronix e.K. | Lucas Stach | Industrial Linux Solutions | http://www.pengutronix.de/ |
PATCH 1/1 ARM: avoid SMP DT initialisation on UP-only capable systems
Quoted 5 lines · Lucas Stach
What we do in barebox is to look into the SCU to find out how many CPU cores are actually present and fix up the DT passed to the kernel accordingly by deleting any superfluous CPU nodes. This satisfies both the need to keep the required DT source files to a minimum, while also providing correct information to the kernel.
... which is a function of the boot loader, but not all boot loaders do this. So, if we're using u-boot, what option do we have?
I've never been able to successfully build and boot uboot myself (it always fails one way or another with my toolchains - if I get it to link, it silently fails on the hardware, but if someone else builds it for me from exactly the same source, it works fine) so count me out of fixing uboot in this regard.
Note that it's not that the kernel doesn't work, it's just that people are complaining that they see warnings from the kernel during their boot. So, unless we're going to start providing iMX6S and iMX6D specific DT blobs (which will double the number of .dtb files we end up with on iMX6), I think we're stuck with users complaining about this.
Signature · 2 lines
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up according to speedtest.net.
PATCH 1/1 ARM: avoid SMP DT initialisation on UP-only capable systems
Quoted 16 lines · Russell King - ARM Linux
Quoted 5 lines · Lucas Stach
What we do in barebox is to look into the SCU to find out how many CPU cores are actually present and fix up the DT passed to the kernel accordingly by deleting any superfluous CPU nodes. This satisfies both the need to keep the required DT source files to a minimum, while also providing correct information to the kernel.
... which is a function of the boot loader, but not all boot loaders do this. So, if we're using u-boot, what option do we have?
I've never been able to successfully build and boot uboot myself (it always fails one way or another with my toolchains - if I get it to link, it silently fails on the hardware, but if someone else builds it for me from exactly the same source, it works fine) so count me out of fixing uboot in this regard.
Quoted 6 lines
Note that it's not that the kernel doesn't work, it's just that people are complaining that they see warnings from the kernel during their boot. So, unless we're going to start providing iMX6S and iMX6D specific DT blobs (which will double the number of .dtb files we end up with on iMX6), I think we're stuck with users complaining about this.
I have been looking into doing some of this cleanup in u-boot recently. More and more this seems like a hack because the device-tree descriptions belong to the kernel. If the bootloader isn't generating them it seems counter intuitive that it should be responsible for altering them so the kernel doesn't complain about incorrect hardware configuration. It seems as though device-tree could benefit from some logic definitions that could load device-tree snippets or overlays depending on the hardware that is probed.
Or in the case of SR hardware we just generate 24 device tree files and push this probing back into each bootloader implementation to detect and load accordingly.
-Jon