Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp13050741rwl; Wed, 4 Jan 2023 02:53:06 -0800 (PST) X-Google-Smtp-Source: AMrXdXvpMfeEK3vhoRP9aKRkV4/Rg8OMBCLsD0w1e6Qsns7O1D6ZgkCV8a2XIcDU0XLKBWIfzSjX X-Received: by 2002:a17:907:c717:b0:7c1:ad6:638a with SMTP id ty23-20020a170907c71700b007c10ad6638amr43651366ejc.17.1672829586635; Wed, 04 Jan 2023 02:53:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672829586; cv=none; d=google.com; s=arc-20160816; b=S4or20cGqXIDEp3KH2NGiAW/QMXfsKikixNMcvCwmDwCVoyKojmfN126deT+KF+mJE bk0GeyOqgI9g91ELN/oRpTZWp7nGJ7nCr9Gu7MtbEnW+rPJVsmhw54QNKbYgysQ6O6d8 xNJXssCBuMW9zWxY6r8pdOqelWDfNQrl4a5R/I/jc98X9dxPPCYZ23Lbrs2cK957N65l G5yVKD+3LDMKIKSVD3DsXXcBKOcei7NpMxrPz07NRyV4yyofqStAfP36nDQIHw+TUSy0 z3PeXeElOgBWMb/DcHS8zYjbg1XIOyTU3I7XqcYYs8FNsJ6kvhMwT/pTnAx3HdpVTT/C QwHA== 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; bh=357HMWRbNsKU+1vBPS4HtT9eOn2QNPIbj+7ap/+Q43g=; b=FadJ+CcvEdN7itFD839Mq2wogqN/lbg8/WwI+Wmh+OpOIwyewTGUjMopPckrnnyL+k 4gdbw5U4QH8x1dO9guXHYnnT7sybHHJkMOwcHqRqhGqLzDuJeaANbRE0tmLK6KjPsEWR wgW16MMo0I3NcvPKG72tTMvGSHej3L7Emz1gxIsRQ5TAfrxupZuTPtOtbhMVQoxBJHgX dRxYHX4qNHvLtmEWFkhf+GWXORFmgQdBNQm6HCloZKvPY4FzBgWqmsDoSitYmlGbnxUC EArgjtFMhiHiOdl+VbF7tasZVnZtha3AMFlkR11jW/xK5oHTOMA7L81H4aoe4ExalQjA Mv9g== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dp15-20020a170906c14f00b007c111fc30absi28302218ejc.865.2023.01.04.02.52.53; Wed, 04 Jan 2023 02:53:06 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233994AbjADKl0 (ORCPT + 57 others); Wed, 4 Jan 2023 05:41:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233387AbjADKlV (ORCPT ); Wed, 4 Jan 2023 05:41:21 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id BE459112F for ; Wed, 4 Jan 2023 02:41:20 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3C11A1063; Wed, 4 Jan 2023 02:42:02 -0800 (PST) Received: from bogus (unknown [10.163.75.27]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B0AC33F71A; Wed, 4 Jan 2023 02:41:16 -0800 (PST) Date: Wed, 4 Jan 2023 10:41:16 +0000 From: Sudeep Holla To: Conor Dooley Cc: Leyfoon Tan , Andrew Jones , Sudeep Holla , Palmer Dabbelt , Paul Walmsley , Albert Ou , "linux-riscv@lists.infradead.org" , "linux-kernel@vger.kernel.org" , Ley Foon Tan Subject: Re: [PATCH] riscv: Move call to init_cpu_topology() to later initialization stage Message-ID: <20230104104116.ob666fm6agkoildy@bogus> References: <20230103035316.3841303-1-leyfoon.tan@starfivetech.com> <20230103065411.2l7k6r57v4phrnos@orel> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE 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 Tue, Jan 03, 2023 at 05:07:39PM +0000, Conor Dooley wrote: > Hello! > > Couple comments for you. > > +CC Sudeep: I've got a question for you below. > > On Tue, Jan 03, 2023 at 07:53:38AM +0000, Leyfoon Tan wrote: > > > From: Andrew Jones > > > Subject: Re: [PATCH] riscv: Move call to init_cpu_topology() to later > > > initialization stage > > > On Tue, Jan 03, 2023 at 11:53:16AM +0800, Ley Foon Tan wrote: > > > > topology_parse_cpu_capacity() is failed to allocate memory with > > > > kcalloc() after read "capacity-dmips-mhz" DT parameter in CPU DT > > Uhh, so where did this "capacity-dmips-mhz" property actually come from? > I had a quick check of qemu with grep & I don't see anything there that > would add this property. From the DT properties. > This property should not be valid on anything other than arm AFAICT. > Not sure if we restrict that on arm/arm64 only, but yes it is mostly used on asymmetric CPU systems. [...] > > > > diff --git a/arch/riscv/kernel/smpboot.c b/arch/riscv/kernel/smpboot.c > > > > index 3373df413c88..ddb2afba6d25 100644 > > > > --- a/arch/riscv/kernel/smpboot.c > > > > +++ b/arch/riscv/kernel/smpboot.c > > > > @@ -39,7 +39,6 @@ static DECLARE_COMPLETION(cpu_running); > > > > > > > > void __init smp_prepare_boot_cpu(void) { > > > > - init_cpu_topology(); > > > > } > > > > > > > > void __init smp_prepare_cpus(unsigned int max_cpus) @@ -48,6 +47,8 > > > @@ > > > > void __init smp_prepare_cpus(unsigned int max_cpus) > > > > int ret; > > > > unsigned int curr_cpuid; > > > > > > > > + init_cpu_topology(); > > I know arm64 does this, but there is any real reason for us to do so? > @Sudeep, do you know why arm64 calls that each time? Not sure what you are referring as called each time. IIUC smp_prepare_cpus() must be called only once on the primary during the boot to prepare for the secondary boot. The difference is by this stage we know the max possible CPU and supply the same to the call. > Or if it is worth "saving" that call on riscv, since arm64 is clearly > happily calling it for many years & calling it later would likely head > off a good few allocation issues (like the one we saw with the topology > reworking a few months ago). > Yes the failure seems like similar issue we saw with cacheinfo and early allocation on RISC-V. However I can't recall why we have done this way on arm64 and not in smp_prepare_boot_cpu() like in RISC-V. Not sure if that was any helpful. -- Regards, Sudeep