Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp37571205rwd; Tue, 11 Jul 2023 16:40:33 -0700 (PDT) X-Google-Smtp-Source: APBJJlFX0Da0A2buEOVzgGxBbH2N2Kw+Ydyjsl4YqhrkHziE96czoX+MdS5QIzJtguAEcK6kp5nj X-Received: by 2002:ac2:5e65:0:b0:4fb:821e:2241 with SMTP id a5-20020ac25e65000000b004fb821e2241mr11803785lfr.23.1689118833071; Tue, 11 Jul 2023 16:40:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689118833; cv=none; d=google.com; s=arc-20160816; b=VJrFvJsGDd+7pqaaMC3nCfJ5YN9BAehvdnGPSirIrqtlGPyAnKqzmUVDOck90J4SOa Fg0Dp0Xnl6YJxmhNuWTxZcj7JWTxPMwi0L7yNbs52I5ho3y/+ioRYpZCcWzZYOaw5cSP eZVN99ZGMu7N2VabaGuZyzrqI42jU/3KcfMQzp+Kfv5mK3DPh1Fc0I3oF9wWux/ZhtET LlvusBWL/pxT3v8ci1LFxVNyVDqSrGqK0KutLQjf68abxA/pbCYpGwDaQdqs7vzkd6jJ TBPR2U/Qgl6cK67Y4AuHXOR9ljzutCz3YwIhGPnP62FsBoktyn41nWX+SzBP0WGxpBUw iPXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:to:from:cc:in-reply-to:subject:date:dkim-signature; bh=LeLvW6D54qYtLtvV95QMxdsxsHGn9g+mFHvvl4agGGw=; fh=Vm0/8o/XrsqBVm2UzGnOD74fYOrWYfeSy3ll9c7Xezg=; b=woHjFyvBvvjYFGjb6W4Z5YbkH10o5wyKtsW+5ewJO5hePqH6e/ZVos/7sKPXuRd6Wa scAXDnPcQI8fWzzPUEQ71IPXbYWGbsjCdLOf2f534ILoQJXXdNjMM1RmRrrqplNT6UUr R5ppDwcQ/IZ9SFrCoZ2YfTyLUJ7i/Su6dnY4GnbSsTykJlD6fRq689gCXO1DPC743Amo oFahBYDGhh+ArQpV8qsykZjqLuCxpE82UAxtXYC/Td1kFqwFEcgnV7jSWO01K8Io9JL3 SlL1rkYRPaFMLNiv79UMlN/DH9dsjKJfKCGCQY4l1jk1T2ifroN969tJNIRZPT9CXicP kgOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@dabbelt-com.20221208.gappssmtp.com header.s=20221208 header.b=zveT6mE3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id by11-20020a0564021b0b00b0051df537f3bfsi3105689edb.676.2023.07.11.16.40.09; Tue, 11 Jul 2023 16:40:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@dabbelt-com.20221208.gappssmtp.com header.s=20221208 header.b=zveT6mE3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231766AbjGKW62 (ORCPT + 99 others); Tue, 11 Jul 2023 18:58:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229538AbjGKW60 (ORCPT ); Tue, 11 Jul 2023 18:58:26 -0400 Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F62110CF for ; Tue, 11 Jul 2023 15:58:25 -0700 (PDT) Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-666edfc50deso91403b3a.0 for ; Tue, 11 Jul 2023 15:58:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dabbelt-com.20221208.gappssmtp.com; s=20221208; t=1689116304; x=1691708304; h=content-transfer-encoding:mime-version:message-id:to:from:cc :in-reply-to:subject:date:from:to:cc:subject:date:message-id :reply-to; bh=LeLvW6D54qYtLtvV95QMxdsxsHGn9g+mFHvvl4agGGw=; b=zveT6mE3hRwUkRV2JFTDkocB6GXTSrdEgogx+FhQ+HIkVEC1zMVussEvCpIzB2P3Jx 7Vzn/l649Laf9WvcAHiWt6r8huPY/x6wdX9lMbtF3W1kRtGOU/RI19r19YVumF4PIIO3 90QF9budYvTYIF3k1PiIzb5j8EzKyOmGaVXCfmFeNHMk9r5XC+vOwezgxvX1zCz6udXt 0uWU6TQHvKl2pt7tUFCRhQFKWppfopqopa2EXyVoMwl8krZxuuzXLqvTVqGcMtdZ+dvG hWokZ0zM2mlIYSdDD3W26xLVg50rq4lR/Gn6h3HGkJS1kPOGRgi1bNgqqQKEnRR1fYb6 0gYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689116304; x=1691708304; h=content-transfer-encoding:mime-version:message-id:to:from:cc :in-reply-to:subject:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=LeLvW6D54qYtLtvV95QMxdsxsHGn9g+mFHvvl4agGGw=; b=BmnpSE87AC1QUCEeHW3cc+tDgGXua4jPnqIUtvUmhKUkR2pSyGS6EdtLS8TLx4xW6F E18X5saUPJcArPTw+Qrdv5i1WWxaSLqjkJ3ojSp4qYGAozEcDKJ4PSk/sIEhjumhhZ2m 9mxffNxlcwhRYFTkSXPEpiyGQaHzKBLGnljrPc4KkE9hxSMGvuVr+M4Hj+kaKEsIrWbW U5rDNltrLQNHbH0O91n+L6/Loat08J3m5tsQupeWz05cVnTR9API8aEQDJWw4AkMzHuY JI6bZWMBMteWpMyeO51cRw/ri+W/5r4cui98v5sKGG49O47Gr+Z7EPLhkR+kQ2HKAP1D mnwQ== X-Gm-Message-State: ABy/qLZxXDcGDtU3AAb+8poDMb0NhT7FrM87vLQC8ODOgTLjjnV0scgH gPt46omVTIqbPEZsaSxBVNdB5Q== X-Received: by 2002:a05:6a00:3927:b0:673:6cb4:7b0c with SMTP id fh39-20020a056a00392700b006736cb47b0cmr322214pfb.2.1689116304551; Tue, 11 Jul 2023 15:58:24 -0700 (PDT) Received: from localhost ([50.38.6.230]) by smtp.gmail.com with ESMTPSA id j9-20020a62b609000000b00678afd4824asm2254698pff.175.2023.07.11.15.58.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jul 2023 15:58:23 -0700 (PDT) Date: Tue, 11 Jul 2023 15:58:23 -0700 (PDT) X-Google-Original-Date: Tue, 11 Jul 2023 15:57:37 PDT (-0700) Subject: Re: [PATCH V2] riscv: Add BUG_ON() for no cpu nodes in devicetree In-Reply-To: <20230630-blasphemy-tapestry-85755d24cbc3@spud> CC: suagrfillet@gmail.com, Paul Walmsley , aou@eecs.berkeley.edu, Conor Dooley , ajones@ventanamicro.com, sunilvl@ventanamicro.com, heiko.stuebner@vrull.eu, apatel@ventanamicro.com, Evan Green , greentime.hu@sifive.com, leyfoon.tan@starfivetech.com, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org From: Palmer Dabbelt To: Conor Dooley Message-ID: Mime-Version: 1.0 (MHng) Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 30 Jun 2023 11:39:24 PDT (-0700), Conor Dooley wrote: > 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 > > 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. IIUC this is just reduntant: if the BUG_ON triggers then there's no CPUs, so we'll end up with no iterations of the loop and thus no found CPU and thus a BUG_ON. The only difference is the SBI probing, but that's just poking SBI to turn off spinwait. So I think we already crash sufficiently on systems with an empty DT. Sorry if I'm missing something, though? > 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