riscv: BUG_ON() for no cpu nodes in setup_smp
PATCH 1/1 riscv: BUG_ON() for no cpu nodes in setup_smp
When booting with ACPI tables, the tiny devictree created by EFI Stub doesn't provide cpu nodes.
In setup_smp(), of_parse_and_init_cpus() will bug on !found_boot_cpu if acpi_disabled. That's unclear, so bug for no cpu nodes before of_parse_and_init_cpus().
--- arch/riscv/kernel/smpboot.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
arch/riscv/kernel/smpboot.c +6 -1
@@ -187,8 +187,13 @@ static void __init of_parse_and_init_cpus(void)void __init setup_smp (void ) { -if (acpi_disabled) +if (acpi_disabled) { +/* When booting with ACPI tables, the devictree created by EFI Stub +* doesn't provide cpu nodes. So BUG here for any acpi_disabled. +*/ +BUG_ON (!of_get_next_cpu_node (NULL ));of_parse_and_init_cpus (); + }else acpi_parse_and_init_cpus (); }
Signature · 1 line
2.20.1
Hey,
Quoted 2 lines · Song Shuai
When booting with ACPI tables, the tiny devictree created by EFI Stub doesn't provide cpu nodes.
What are the conditions that are required to reproduce this issue? When booting with ACPI, why is acpi_disabled true?
In my naivety, that seems like a bigger problem to address..
Quoted 1 line
In
setup_smp(),of_parse_and_init_cpus()will bug on !found_boot_cpu
Please, s/on !found_boot_cpu/if the boot cpu is not found in the devicetree/, or similar.
Quoted 1 line
if
acpi_disabled.
Why would of_parse_and_init_cpus() be called in any other case? There's only this one caller, right?
Quoted 2 lines
That's unclear, so bug for no cpu nodes before
of_parse_and_init_cpus().
What is unclear? That the reason for the BUG() was that there were no cpu nodes, since it could also be that there were CPU nodes but they were disabled etc?
Quoted 10 lines
Signed-off-by Song Shuai <[email protected]>--- arch/riscv/kernel/smpboot.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)arch/riscv/kernel/smpboot.c +0
-0
arch/riscv/kernel/smpboot.c static void __init of_parse_and_init_cpus(void) · line 191
Quoted 6 lines
arch/riscv/kernel/smpboot.c +2
-1@@ -187,8 +187,13 @@ static void __init of_parse_and_init_cpus(void)void __init setup_smp (void ) { -if (acpi_disabled) +if (acpi_disabled) { +/* When booting with ACPI tables, the devictree created by EFI Stub
This is not netdev, please use the correct comment style :/
arch/riscv/kernel/smpboot.c static void __init of_parse_and_init_cpus(void) · line 198
Quoted 7 lines
arch/riscv/kernel/smpboot.c +4
-0+* doesn't provide cpu nodes. So BUG here for any acpi_disabled. +*/ +BUG_ON (!of_get_next_cpu_node (NULL ));of_parse_and_init_cpus (); + }else acpi_parse_and_init_cpus ();
checkpatch should have told you that you now need to add braces on all arms of this statement.
Or, better yet, move the whole thing into of_parse_and_init_cpus() in the first place? You could drop most of the comment in the process, since I think the details of how you hit this problem would likely not be helpful to anyone that hit it under different conditions.
Cheers,
Conor.
Quoted 4 lines
arch/riscv/kernel/smpboot.c +0
-0}Signature · 1 line
2.20.1
_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
Quoted 6 lines · Conor Dooley
Hey,
Quoted 2 lines · Song Shuai
When booting with ACPI tables, the tiny devictree created by EFI Stub doesn't provide cpu nodes.
"When only the ACPI tables are passed to kernel, the tiny..." That seems more accurate. We can use "acpi=" kernel parameter to manually enable/disable ACPI.
Quoted 3 lines
What are the conditions that are required to reproduce this issue? When booting with ACPI, why is
acpi_disabledtrue?
In my naivety, that seems like a bigger problem to address. >
Actually, I appended the "acpi=off" to kernel cmdline for testing the "off" option. That would set acpi_disabled as true.
Quoted 5 lines
Quoted 1 line
In
setup_smp(),of_parse_and_init_cpus()will bug on !found_boot_cpuPlease, s/on !found_boot_cpu/if the boot cpu is not found in the devicetree/, or similar.
ok
Quoted 4 lines
Quoted 1 line
if
acpi_disabled.Why would
of_parse_and_init_cpus()be called in any other case? There's only this one caller, right?
yes
Quoted 7 lines
Quoted 3 lines
That's unclear, so bug for no cpu nodes before
of_parse_and_init_cpus().What is unclear? That the reason for the
BUG()was that there were no cpu nodes, since it could also be that there were CPU nodes but they were disabled etc?
The BUG() in of_parse_and_init_cpus() indicates there was no boot cpu found in the devicetree , not there were no cpu nodes in the devices. That's the "unclear" I mean.
Quoted 20 lines
Quoted 11 lines
Signed-off-by Song Shuai <[email protected]>--- arch/riscv/kernel/smpboot.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)arch/riscv/kernel/smpboot.c +0
-0arch/riscv/kernel/smpboot.c static void __init of_parse_and_init_cpus(void) · line 191
Quoted 6 lines
arch/riscv/kernel/smpboot.c +2
-1@@ -187,8 +187,13 @@ static void __init of_parse_and_init_cpus(void)void __init setup_smp (void ) { -if (acpi_disabled) +if (acpi_disabled) { +/* When booting with ACPI tables, the devictree created by EFI Stub This is not netdev, please use the correct comment style :/
Quoted 10 lines
arch/riscv/kernel/smpboot.c static void __init of_parse_and_init_cpus(void) · line 198
Quoted 7 lines
arch/riscv/kernel/smpboot.c +4
-0+* doesn't provide cpu nodes. So BUG here for any acpi_disabled. +*/ +BUG_ON (!of_get_next_cpu_node (NULL ));of_parse_and_init_cpus (); + }else acpi_parse_and_init_cpus ();checkpatch should have told you that you now need to add braces on all arms of this statement.
ok,
Quoted 6 lines
Or, better yet, move the whole thing into
of_parse_and_init_cpus()in the first place? You could drop most of the comment in the process, since I think the details of how you hit this problem would likely not be helpful to anyone that hit it under different conditions.
ok, I'll apply these comments if you're ok with my replies.
Quoted 7 lines
Cheers,
Conor.Quoted 4 lines
arch/riscv/kernel/smpboot.c +0
-0}Signature · 1 line
2.20.1
Signature · 2 lines
Thanks Song Shuai
Hey,
Quoted 10 lines · Song Shuai
Quoted 4 lines · Conor Dooley
Quoted 2 lines · Song Shuai
When booting with ACPI tables, the tiny devictree created by EFI Stub doesn't provide cpu nodes.
"When only the ACPI tables are passed to kernel, the tiny..." That seems more accurate. We can use "acpi=" kernel parameter to manually enable/disable ACPI.
Quoted 6 lines
Quoted 3 lines
What are the conditions that are required to reproduce this issue? When booting with ACPI, why is
acpi_disabledtrue?
In my naivety, that seems like a bigger problem to address. >Actually, I appended the "acpi=off" to kernel cmdline for testing the "off" option. That would set
acpi_disabledas true.
Yeah, I figured it was intentionally misconfiguration of your kernel, given that you've tested other niche conditions and reported bugs, just was not clear from your commit message whether this was a real bugTM that should be fixed, or some sort of "you booted a kernel that can't be used on this system".
Quoted 10 lines
Quoted 6 lines
Quoted 2 lines
That's unclear, so bug for no cpu nodes before
of_parse_and_init_cpus().What is unclear? That the reason for the
BUG()was that there were no cpu nodes, since it could also be that there were CPU nodes but they were disabled etc?The
BUG()inof_parse_and_init_cpus()indicates there was no boot cpu found in the devicetree , not there were no cpu nodes in the devices. That's the "unclear" I mean.
Yup, please put that in the commit message so that people don't have to figure out your intent ;)
Quoted 6 lines
Quoted 4 lines
Or, better yet, move the whole thing into
of_parse_and_init_cpus()in the first place? You could drop most of the comment in the process, since I think the details of how you hit this problem would likely not be helpful to anyone that hit it under different conditions.ok, I'll apply these comments if you're ok with my replies.
Yup, thanks!
_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv