Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp20680006rwd; Thu, 29 Jun 2023 05:49:31 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ46zrxDQq250O2USs08jKhxay379KjEaj/5URIXFOMm5k03lS/Iqwq7XU9yTnCbG6syr5es X-Received: by 2002:a17:902:ecc3:b0:1b3:c62d:71b7 with SMTP id a3-20020a170902ecc300b001b3c62d71b7mr6274271plh.18.1688042970940; Thu, 29 Jun 2023 05:49:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688042970; cv=none; d=google.com; s=arc-20160816; b=QFWI239zcpFk9ntZadPKkmHr8/Pd1g6vtt9zW5dKI2bbLn/b8LgbBKLC3FFyLtggyF vzgJXM0mlAKaqkL9tq2GwRm13DCvrKvJT7D6/3oQVSevlgdyu2jqzoJTk7RbM8hjw/Jd jNc4Dcg1TaTBUHEIOOmp6dQr+O4DFq6gkMR7h/x5yw0TO6zJoa7w/vFeVSJmBNkqgzWp IBDOFkCUViVEFzNJHv6pc8BRE9qA+s+0OYSszgxoaRz5k9pt/TuTwXzYMf1AsXAJrH4O c/GLlvBTf6WM4PTewWx7BJVQmThTyFUU0JMMcOH60GuX/rEO9+xF54m5zx59ZTrOun6m DMLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=+4OU2cPUl6QyhHKlp0tYjrFctG6U5uk0Wj9kZa54WF8=; fh=Ui1SruwZFnSRTI248QnIDRRMbHnzceimRyWiN2IHzX4=; b=CJAXDnIrOLHkIOtyHk/WsN4c+oCP9H8F/efPoUNZr8c+3eJpCV5j7UEewdffhy2Tmb DOS2TFOC0Ow8erL+2MTUmz/6L/qo701hZk21PcZDJPJdQAjk6Ilx167LxV8HZwR/d7BY LX+SrYZf2U0m/Xo2E1JekHuyQLVZIiclSAvYvsjvlkPHESJkTH0sxBom1xIiJwOwZSGS +eYj5f9X8lGksKICMwWp/3TohRgNlLlQuaq4hQBs+hZOSDEt1uQm7nR1lkEp1WLJgKhK tFd95mRWAwFXT3OkvmA5VcFVZWla3J5TkdQl87pe04+P8h1UbaeJqa4oUWxfVq9c2bJw kxaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=Cq3m0wKL; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t10-20020a17090340ca00b001b845157b69si2142805pld.414.2023.06.29.05.49.16; Thu, 29 Jun 2023 05:49:30 -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=@microchip.com header.s=mchp header.b=Cq3m0wKL; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229539AbjF2Meu (ORCPT + 99 others); Thu, 29 Jun 2023 08:34:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231593AbjF2MeW (ORCPT ); Thu, 29 Jun 2023 08:34:22 -0400 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 67A8A26B6 for ; Thu, 29 Jun 2023 05:34:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1688042060; x=1719578060; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=V3orB8X2pnGHKa4XQHvRaYEdUceUMOeLKtK+nBaNFd8=; b=Cq3m0wKL5ftIk7Q98ZHuGr1ZpIwXWpKzCfqqclo8wyGgSOPuUUigPROH 7h3+UgybnfzdGit2wNkeDTszUQXRu82qb/s9WEZ8DKkLNWYBObwCfW6OY RszA4AUqEAx0EoTN3PdN8z5vkcNnmZMtM0G/daXKiAlsFKIt6sbJftUYA 51bxyAsLjR6mS8oAepWutXQNSll3P7AQkqg7cGksb3VaTlDTy1FLa31tr 3seQF+UEvWE8jOH3Y6Cp3eritNkyecAf7XOgDFDQigiTN3Hmv19iGNRZ6 D1kdgHQpZhr6dDMNU/VIl/ijXPKqsijfMRaeytLNDbasrq7XMPpaCHwpT g==; X-IronPort-AV: E=Sophos;i="6.01,168,1684825200"; d="asc'?scan'208";a="220483366" X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa3.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 29 Jun 2023 05:34:19 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Thu, 29 Jun 2023 05:34:19 -0700 Received: from wendy (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21 via Frontend Transport; Thu, 29 Jun 2023 05:34:17 -0700 Date: Thu, 29 Jun 2023 13:33:48 +0100 From: Conor Dooley To: Song Shuai CC: , , , , , , , , , , , Subject: Re: [PATCH] riscv: BUG_ON() for no cpu nodes in setup_smp Message-ID: <20230629-maverick-kelp-17327f04482a@wendy> References: <20230629105839.1160895-1-suagrfillet@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="+Xe4Uyu39cOMQrN6" Content-Disposition: inline In-Reply-To: <20230629105839.1160895-1-suagrfillet@gmail.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 --+Xe4Uyu39cOMQrN6 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hey, On Thu, Jun 29, 2023 at 06:58:39PM +0800, Song Shuai wrote: > 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.. > 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. > if acpi_disabled. Why would of_parse_and_init_cpus() be called in any other case? There's only this one caller, right? > 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? > Signed-off-by: Song Shuai > --- > arch/riscv/kernel/smpboot.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) >=20 > diff --git a/arch/riscv/kernel/smpboot.c b/arch/riscv/kernel/smpboot.c > index 6ca2b5309aab..243a7b533ad7 100644 > --- a/arch/riscv/kernel/smpboot.c > +++ b/arch/riscv/kernel/smpboot.c > @@ -187,8 +187,13 @@ static void __init of_parse_and_init_cpus(void) > =20 > 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 :/ > + * 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. > } > --=20 > 2.20.1 >=20 --+Xe4Uyu39cOMQrN6 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRh246EGq/8RLhDjO14tDGHoIJi0gUCZJ16LAAKCRB4tDGHoIJi 0kjfAQDJJ0vTpSJCysk3tWFZuO7Zk8aSbHHO0s+tldla0nXdZAD5AYH55vxAQeSf VUtbo0CsM0uDGuFly0pPfOcvM0iKOgA= =JAVg -----END PGP SIGNATURE----- --+Xe4Uyu39cOMQrN6--