From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CE6B0CCA479 for ; Thu, 7 Jul 2022 09:51:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235106AbiGGJv4 (ORCPT ); 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> 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