Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Troy Mitchell <troy.mitchell@linux.dev>
To: Sudeep Holla <sudeep.holla@kernel.org>,
	 Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	 "Rafael J. Wysocki" <rafael@kernel.org>,
	Danilo Krummrich <dakr@kernel.org>,
	 Paul Walmsley <pjw@kernel.org>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	 Albert Ou <aou@eecs.berkeley.edu>,
	Alexandre Ghiti <alex@ghiti.fr>
Cc: Catalin Marinas <catalin.marinas@arm.com>,
	 Will Deacon <will@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	 Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	 Conor Dooley <conor+dt@kernel.org>,
	linux-kernel@vger.kernel.org,  driver-core@lists.linux.dev,
	linux-riscv@lists.infradead.org,
	 linux-arm-kernel@lists.infradead.org,
	devicetree@vger.kernel.org,
	 Troy Mitchell <troy.mitchell@linux.dev>
Subject: [PATCH RFC 0/3] riscv: Add explicit die-level CPU topology
Date: Sun, 20 Sep 2026 11:18:01 +0800	[thread overview]
Message-ID: <20260920-riscv-die-topology-rfc-v1-0-071c0bf61d5f@linux.dev> (raw)

The generic arch_topology model has no die level. Systems with multiple
dies in one package must flatten their clusters or report each die as a
separate package, losing the die or package boundary.

This RFC adds a die ID and sibling mask to arch_topology, parses optional
dieN nodes in DT cpu-map, and exposes die topology through sysfs on RISC-V.
Clusters can be numbered independently within each die.

The RISC-V sysfs behavior is:

  - An explicit dieN node supplies a non-negative die ID within its package
    and a die sibling mask. RISC-V exposes die_id, die_cpus, and
    die_cpus_list.
  - A DT without dieN keeps die_id at -1 and creates no die sysfs files.
    Package and cluster parsing is unchanged.
  - ACPI die discovery is not implemented. The ACPI and fallback paths
    also leave die_id at -1 and create no die sysfs files.

The DT parser is shared by arm64 and RISC-V, so both record dieN nodes
internally. Only RISC-V exposes the die sysfs files in this series. If you
think I should enable this for arm64 as well, please let me know.

The sysfs visibility hook defaults to visible on other architectures,
including powerpc configurations that report die_id as -1. Their existing
sysfs behavior is unchanged.

The dieN hierarchy is a proposed extension to the DT cpu-map binding.
This RFC does not include a schema update. I'd like feedback on the
topology model and sysfs interface before sending the binding update.

Does placing dieN between socket and cluster make sense? I'd also
appreciate feedback on keeping unspecified dies at -1 and on the sysfs
visibility hook.

Tested with W=1 builds of the affected objects for RISC-V, arm64, and ARM,
and with a complete RISC-V Image build. On a 32-CPU QEMU virt guest, a DT
describing one package with two dies, four clusters per die, and four
cores per cluster exposed the expected IDs and masks and updated them
across CPU offline/online. The same guest with a legacy DT exposed no die
sysfs files while retaining package and cluster topology.

Signed-off-by: Troy Mitchell <troy.mitchell@linux.dev>
---
Troy Mitchell (3):
      arch_topology: Add a die level to CPU topology
      arch_topology: Parse die nodes in /cpu-map
      riscv: topology: Expose explicit CPU die topology

 arch/riscv/include/asm/topology.h |  4 +++
 drivers/base/arch_topology.c      | 68 +++++++++++++++++++++++++++++++--------
 drivers/base/topology.c           | 28 +++++++++++++++-
 include/linux/arch_topology.h     |  2 ++
 include/linux/topology.h          |  3 ++
 5 files changed, 91 insertions(+), 14 deletions(-)
---
base-commit: cee9395acd8043be0644b25c34bfa86623f2b935
change-id: 20260904-riscv-die-topology-rfc-c009f6e4be92

Best regards,
--  
Troy Mitchell <troy.mitchell@linux.dev>



             reply	other threads:[~2026-09-20  3:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-20  3:18 Troy Mitchell [this message]
2026-09-20  3:18 ` [PATCH RFC 1/3] arch_topology: Add a die level to CPU topology Troy Mitchell
2026-09-20  3:18 ` [PATCH RFC 2/3] arch_topology: Parse die nodes in /cpu-map Troy Mitchell
2026-09-21 11:14   ` Sudeep Holla
2026-09-22  8:06     ` Troy Mitchell
2026-09-20  3:18 ` [PATCH RFC 3/3] riscv: topology: Expose explicit CPU die topology Troy Mitchell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260920-riscv-die-topology-rfc-v1-0-071c0bf61d5f@linux.dev \
    --to=troy.mitchell@linux.dev \
    --cc=alex@ghiti.fr \
    --cc=aou@eecs.berkeley.edu \
    --cc=catalin.marinas@arm.com \
    --cc=conor+dt@kernel.org \
    --cc=dakr@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=driver-core@lists.linux.dev \
    --cc=gregkh@linuxfoundation.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=mark.rutland@arm.com \
    --cc=palmer@dabbelt.com \
    --cc=pjw@kernel.org \
    --cc=rafael@kernel.org \
    --cc=robh@kernel.org \
    --cc=sudeep.holla@kernel.org \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox