Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp702615imw; Fri, 15 Jul 2022 11:13:07 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uHAXP3ZKGRmegv5jc+OmGVGUbAFPddtPH07rJBwMhbO7Nhpiq8xj/MIf2tB1xiPoGNnCwL X-Received: by 2002:a17:902:da88:b0:16c:27f9:8762 with SMTP id j8-20020a170902da8800b0016c27f98762mr14834436plx.85.1657908787651; Fri, 15 Jul 2022 11:13:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657908787; cv=none; d=google.com; s=arc-20160816; b=ESNvCCKpiKDmoYnwKZ6/0VikfMO9//zWLvsGkG/UwcdxNCwJ/Gl6A1S/68Nkf6EFJy E3oBZ0qh4zGAf3AU0wJIr7h73V8uTrO4g3Jl4CyWkAbJQyFS1rR33jNicuKUiSUqO5YK 7hw0640pPkuJNoclGCrwXJcI/y1HUlUzwnR6OJNmgqHPlA8KRN6iVTbdWw3Qm5bFxLCm Dm1MrOwILJayfUW1YOCMLY9AGUfzg+pv/UuYeOvv6Z9nuxQ5xbibuiQ/kqsT+pKeawWE Ii/8apVgEYXu6PPOYwPwel6+kUgUpfHFiP/mqNTkJTmqyghTm+tmYe9PzKF9S2MzlfMa hOuA== 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:date:subject:cc:to:from:dkim-signature; bh=H7FdqtQskr0feGEMESNye0rnehyoWZm9I2IR2qQbWhw=; b=N9DLVycGY3D8b/EwzPdzhoQ7CZxFP5KVRjOVyFRwTM+aUrSJQwGXlt+JTVVvFwnXa8 ubtoV9tR+SdfN5gUlTI/jPHme6n8WJE3kXP12CAoBko5tCKv1YLPx/j/HuVaGeEko2PI Kp9VIVY054hQKhRxsgTO0GkA5C1fPAMLhaXapJZqj0/Wop58tdRzhA3eiVIzWHLWAxd9 j8hx6JNxScRtm2VP+FqIXKsnE10/T3tLu36pGpndHpcApdPX5keqfuCeXrML+mkqqdkW nv1/JlY9/4LKJ4BFeMkaguZbYaGioAb2laUJo9Y/+shrD4XS2Lsuu+HtE63cWJz2p+Qc eJBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@conchuod.ie header.s=google header.b=JXY9tG2W; 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=conchuod.ie Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y9-20020a170902864900b00153b640ed90si5515348plt.38.2022.07.15.11.12.51; Fri, 15 Jul 2022 11:13:07 -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=@conchuod.ie header.s=google header.b=JXY9tG2W; 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=conchuod.ie Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229448AbiGORxv (ORCPT + 99 others); Fri, 15 Jul 2022 13:53:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229630AbiGORxm (ORCPT ); Fri, 15 Jul 2022 13:53:42 -0400 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA494FF9 for ; Fri, 15 Jul 2022 10:53:39 -0700 (PDT) Received: by mail-wr1-x42d.google.com with SMTP id z12so7738352wrq.7 for ; Fri, 15 Jul 2022 10:53:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=conchuod.ie; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=H7FdqtQskr0feGEMESNye0rnehyoWZm9I2IR2qQbWhw=; b=JXY9tG2WRrIfIGRKFohwcnYsUQVcSdNBZ0QIGMlDIRqOWRYIzyrwhMfXSxiZolGhlz UWrxE1UeKpDBH5S9j/w3Oe0wOc0gaEMnZoj8v6PyId4PI0r0rxgKn5Tztce2L/BFxYIl MBrrLnvciZ/KnPWkPpgpubUUVfrvJA2VXNl1ur33S/pN3jhfrvHYwkLphcBcOzXm5UOB kbQeKNF63/K44eKvMFOwEhd1+uvrrkhzcGjfSf8Gk2QY7QPBm+WPHbyAAfSCMS+eCOiW swSCRO0Fu0G0IgVCoEP3escuvfEGpga6GeL3RBEFg1OGRftF39s4qfhdXMgBJ3AAxocU dLrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=H7FdqtQskr0feGEMESNye0rnehyoWZm9I2IR2qQbWhw=; b=FHObFp07w2mQVrjF3/KoazmRmYgfsQSkxI1N7qTFmOWNf5Kal+JX1hmxQf5jq6qcEc 65r5Eu+yP16OTRzD93GQDD7Ou4Hn14PKSiYCSsHrLI3PW+XnzeYn4Lab2pgmwDBZ/hth Kt60Rc/SAzMTYoJuUAa1djCnuO6r1AUBwCNHkaZwXcDca13dVdaAV0md9PHT5j6gaGRc RpXmxhuDmDSYE04RsEQ+E6oYZivsXAl+I2YEund7JlZntA+6K1WiMlmtSAuRKhBVHGTm DjrWwp8N1zzHc2BZ+jE3bkg/YjrvrPiiztB6ivPDVVCMVKX/gCdA5OW1G+SMAx5QZZSZ rTkA== X-Gm-Message-State: AJIora8IHmNhxhrzWJhnIdbew5OSUVHEtM6MMhtWYoWs/TYeSulr4du5 VQ8UCbqkv7YaMGMGwlLWQbXwjQ== X-Received: by 2002:a5d:6c63:0:b0:21d:bf45:f90f with SMTP id r3-20020a5d6c63000000b0021dbf45f90fmr11182223wrz.715.1657907618412; Fri, 15 Jul 2022 10:53:38 -0700 (PDT) Received: from henark71.. ([51.37.234.167]) by smtp.gmail.com with ESMTPSA id n9-20020a5d4c49000000b002167efdd549sm4364131wrt.38.2022.07.15.10.53.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Jul 2022 10:53:37 -0700 (PDT) From: Conor Dooley To: Paul Walmsley , Palmer Dabbelt , Palmer Dabbelt , Albert Ou , Sudeep Holla , Catalin Marinas , Will Deacon , Greg Kroah-Hartman , "Rafael J . Wysocki" Cc: Daire McNamara , Conor Dooley , Niklas Cassel , Damien Le Moal , Geert Uytterhoeven , Zong Li , Emil Renner Berthing , Jonas Hahnfeld , Guo Ren , Anup Patel , Atish Patra , Heiko Stuebner , Philipp Tomsich , Rob Herring , Marc Zyngier , Viresh Kumar , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Brice Goglin Subject: [PATCH v4 0/2] Fix RISC-V's arch-topology reporting Date: Fri, 15 Jul 2022 18:51:54 +0100 Message-Id: <20220715175155.3567243-1-mail@conchuod.ie> X-Mailer: git-send-email 2.37.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS 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 From: Conor Dooley Hey all, It's my first time messing around with arch/ code at all, let alone more than one arch, so forgive me if I have screwed up how to do a migration like this. The goal here is the fix the incorrectly reported arch topology on RISC-V which seems to have been broken since it was added. cpu, package and thread IDs are all currently reported as -1, so tools like lstopo think systems have multiple threads on the same core when this is not true: https://github.com/open-mpi/hwloc/issues/536 arm64's topology code basically applies to RISC-V too, so it has been made generic along with the removal of MPIDR related code, which appears to be redudant code since '3102bc0e6ac7 ("arm64: topology: Stop using MPIDR for topology information")' replaced the code that actually interacted with MPIDR with default values. I only built tested for arm{,64} , so hopefully it is not broken when used. Testing on both arm64 & !SMP RISC-V would really be appreciated! For V2, I dropped the idea of doing a RISC-V specific implementation followed by a move to the generic code & just went for the more straight forward method of moving to the shared version first. I also dropped the RFC. V3 moves store_cpu_topology()'s definition down inside the arch check alongside the init function so that boot on 32bit arm is not broken. V4 has moved the RISC-V boot hart's call to store_cpu_topology() later into the boot process it is now right before SMP is brought up (or not in the case of !SMP). This prevents calling detect_cache_attributes() while we cannot allocate memory. V4 is also rebased on next-20220715 to get Sudeep's most recent arch_topology patchset. Thanks, Conor Conor Dooley (2): arm64: topology: move store_cpu_topology() to shared code riscv: topology: fix default topology reporting arch/arm64/kernel/topology.c | 40 ------------------------------------ arch/riscv/Kconfig | 2 +- arch/riscv/kernel/smpboot.c | 3 ++- drivers/base/arch_topology.c | 19 +++++++++++++++++ 4 files changed, 22 insertions(+), 42 deletions(-) base-commit: 6014cfa5bf32cf8c5c58b3cfd5ee0e1542c8a825 -- 2.37.1