Linux-RISC-V Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Conor Dooley <conor@kernel.org>
To: Song Shuai <suagrfillet@gmail.com>
Cc: apatel@ventanamicro.com, aou@eecs.berkeley.edu,
	leyfoon.tan@starfivetech.com, linux-kernel@vger.kernel.org,
	conor.dooley@microchip.com, palmer@dabbelt.com,
	evan@rivosinc.com, paul.walmsley@sifive.com,
	greentime.hu@sifive.com, linux-riscv@lists.infradead.org,
	heiko.stuebner@vrull.eu, ajones@ventanamicro.com
Subject: Re: [PATCH V2] riscv: Add BUG_ON() for no cpu nodes in devicetree
Date: Fri, 30 Jun 2023 19:39:24 +0100	[thread overview]
Message-ID: <20230630-blasphemy-tapestry-85755d24cbc3@spud> (raw)
In-Reply-To: <20230630105938.1377262-1-suagrfillet@gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 2084 bytes --]

On Fri, Jun 30, 2023 at 06:59:38PM +0800, Song Shuai wrote:
> When only the ACPI tables are passed to kernel, the tiny devictree created
> by EFI Stub doesn't provide cpu nodes.
> 
> While if append the "acpi=off" to kernel cmdline to disable ACPI for kernel
> the BUG_ON() in of_parse_and_init_cpus() indicates there's no boot cpu
> found in the devicetree, not there're no cpu nodes in the devicetree.
> 
> Add BUG_ON() in the first place of of_parse_and_init_cpus() to make it clear.
> 
> Signed-off-by: Song Shuai <suagrfillet@gmail.com>

I'm still not really convinced that this is needed - not finding the
boot CPU is a strong a hint as any that your DT is completely broken.
Especially if you intentionally go out of your way to disable ACPI on a
system that requires it to boot.

I'll leave it up to Palmer or whoever to determine whether this is a
valuable change. Code change itself much improved though, thanks - I'd
give an R-b/A-b other than that I question whether there's any value in
adding another BUG_ON(). You could've kept the part of the comment that
explained what the error meant though, but that's not a big deal.

Thanks,
Conor.

> ---
> Changes since V1:
> https://lore.kernel.org/linux-riscv/20230629105839.1160895-1-suagrfillet@gmail.com/
> - revise the commit-msg and move the BUG_ON into of_parse_and_init_cpus() as Conor suggests
> 
> ---
>  arch/riscv/kernel/smpboot.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/arch/riscv/kernel/smpboot.c b/arch/riscv/kernel/smpboot.c
> index 6ca2b5309aab..04d33afbdf55 100644
> --- a/arch/riscv/kernel/smpboot.c
> +++ b/arch/riscv/kernel/smpboot.c
> @@ -147,6 +147,8 @@ static void __init of_parse_and_init_cpus(void)
>  	int cpuid = 1;
>  	int rc;
>  
> +	BUG_ON(!of_get_next_cpu_node(NULL));
> +
>  	cpu_set_ops(0);
>  
>  	for_each_of_cpu_node(dn) {
> -- 
> 2.20.1
> 
> 
> _______________________________________________
> linux-riscv mailing list
> linux-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

[-- Attachment #2: Type: text/plain, Size: 161 bytes --]

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

  reply	other threads:[~2023-06-30 18:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-30 10:59 [PATCH V2] riscv: Add BUG_ON() for no cpu nodes in devicetree Song Shuai
2023-06-30 18:39 ` Conor Dooley [this message]
2023-07-11 22:58   ` Palmer Dabbelt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230630-blasphemy-tapestry-85755d24cbc3@spud \
    --to=conor@kernel.org \
    --cc=ajones@ventanamicro.com \
    --cc=aou@eecs.berkeley.edu \
    --cc=apatel@ventanamicro.com \
    --cc=conor.dooley@microchip.com \
    --cc=evan@rivosinc.com \
    --cc=greentime.hu@sifive.com \
    --cc=heiko.stuebner@vrull.eu \
    --cc=leyfoon.tan@starfivetech.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=suagrfillet@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox