Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp3508014imw; Thu, 7 Jul 2022 03:02:46 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uMtGR5phENaUGs7TihAuClwD5VyGQBFPBMYdZW6pUmfbQbcaBcSlzHZHoAOWkEXBWss8Cr X-Received: by 2002:a05:6a00:1892:b0:527:c203:7708 with SMTP id x18-20020a056a00189200b00527c2037708mr52007662pfh.26.1657188166522; Thu, 07 Jul 2022 03:02:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657188166; cv=none; d=google.com; s=arc-20160816; b=eUXAaQVuKhe2fZ8MMvfdk3fP9fC3iJjgO+9Ks8Jr9i17bilcNvo8ChjROschqZ4uCp dCfyySJAk4CqAoYrKAgiKA16YlyDLTzf/Bpm58WkotLcjp6AfdH0X6UTqgu0yNalPB2e nskCJqPOQB8gSCi/RDtOvAP2GokoaDavFpp1r6zExZAFtJIKtFxAQwSmuHHml/CxWYUF ciHjJghkVP0u2E5+Vx/FJMvVyuDmbk89R/D7PXbREABcSWV7QCXjiJ4aUsmJJqvqIjBH xMq0ce2IWHeaeaz7byB0qXV2/x4+okQAIVzpT7cLyJIA0Nr8GGyq08WiALjV1O1TM+BP 8UtQ== 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=sI9mCvZsNaSLFj74x+jM8eRe8GLzHF6xhrGhUIBRyA8=; b=vWZHh3dgPcjiq74WjP9S4vzAcLl1LedKqyGhz3q0D9ySBiDD5k+3QDaDAjMEBWyJym +EQLrw5ZhWp5pQIVE9YnfvJcHljlc0CBndFohCDT5pvh2v1r3FnJbSr6Wajt14L+wl8K 8/08MhPZBDibW8ff6rYK1wGh4o2u9WA6c8qE3RhIhGogUwqlOkQGLXQUD7/yr/fFxcZh kTOyPh0J/VA2swfSr+zSUDNkKHmPDi+s6Ow0TXe+uXnoR9g+6IyKI/joEyfpw5AaUBJ8 WfHOrgOiKwkA6kWcLmJTbhei/wdXnYdyOLz9r/d7Qb912ieGx6xCCiTGNF7XQXCmtpE9 pwjg== 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 z25-20020a056a001d9900b005281a589c11si3171064pfw.264.2022.07.07.03.02.33; Thu, 07 Jul 2022 03:02:46 -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; 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 S235057AbiGGJv4 (ORCPT + 99 others); Thu, 7 Jul 2022 05:51:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235026AbiGGJvy (ORCPT ); Thu, 7 Jul 2022 05:51:54 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9DC064D4F2 for ; Thu, 7 Jul 2022 02:51:52 -0700 (PDT) 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 A332A1063; Thu, 7 Jul 2022 02:51:52 -0700 (PDT) Received: from bogus (unknown [10.57.39.193]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 731493F792; Thu, 7 Jul 2022 02:51:48 -0700 (PDT) Date: Thu, 7 Jul 2022 10:50:37 +0100 From: Sudeep Holla To: Conor Dooley Cc: Paul Walmsley , Palmer Dabbelt , Palmer Dabbelt , Albert Ou , Daire McNamara , Sudeep Holla , Conor Dooley , Niklas Cassel , Damien Le Moal , Geert Uytterhoeven , Zong Li , Emil Renner Berthing , Jonas Hahnfeld , Guo Ren , Anup Patel , Atish Patra , Changbin Du , Heiko Stuebner , Philipp Tomsich , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Brice Goglin Subject: Re: [PATCH] riscv: arch-topology: fix default topology reporting Message-ID: <20220707095037.i2pjcc7zcf4pi3ht@bogus> References: <20220706184558.2557301-1-mail@conchuod.ie> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220706184558.2557301-1-mail@conchuod.ie> X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,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 On Wed, Jul 06, 2022 at 07:45:59PM +0100, Conor Dooley wrote: > From: Conor Dooley > > RISC-V has no sane defaults to fall back on where there is no cpu-map > in the devicetree. > Without sane defaults, the package, core and thread IDs are all set to > -1. This causes user-visible inaccuracies for tools like hwloc/lstopo > which rely on the sysfs cpu topology files to detect a system's > topology. > > Add sane defaults in ~the exact same way as ARM64. > > CC: stable@vger.kernel.org > Fixes: 03f11f03dbfe ("RISC-V: Parse cpu topology during boot.") > Reported-by: Brice Goglin > Link: https://github.com/open-mpi/hwloc/issues/536 > Signed-off-by: Conor Dooley > --- > > Sudeep suggested that this be backported rather than the changes to > the devicetrees adding cpu-map since that property is optional. > That patchset is still valid in it's own right. > > arch/riscv/include/asm/topology.h | 13 +++++++++++++ > arch/riscv/kernel/Makefile | 1 + > arch/riscv/kernel/smpboot.c | 4 ++++ > arch/riscv/kernel/topology.c | 32 +++++++++++++++++++++++++++++++ > 4 files changed, 50 insertions(+) > create mode 100644 arch/riscv/include/asm/topology.h > create mode 100644 arch/riscv/kernel/topology.c > [...] > diff --git a/arch/riscv/kernel/smpboot.c b/arch/riscv/kernel/smpboot.c > index f1e4948a4b52..d551c7f452d4 100644 > --- a/arch/riscv/kernel/smpboot.c > +++ b/arch/riscv/kernel/smpboot.c > @@ -32,6 +32,7 @@ > #include > #include > #include > +#include > > #include "head.h" > [...] > void __init smp_prepare_cpus(unsigned int max_cpus) > @@ -161,6 +164,7 @@ asmlinkage __visible void smp_callin(void) > mmgrab(mm); > current->active_mm = mm; > > + store_cpu_topology(curr_cpuid); > notify_cpu_starting(curr_cpuid); > numa_add_cpu(curr_cpuid); > update_siblings_masks(curr_cpuid); If the above store_cpu_topology calls update_siblings_masks if required, probably you can drop this explicit call here. -- Regards, Sudeep