mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yanan Wang <wangyanan55@huawei.com>
To: <linux-kernel@vger.kernel.org>
Cc: Mark Brown <broonie@linaro.org>,
	Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Sudeep Holla <sudeep.holla@arm.com>, <wanghaibin.wang@huawei.com>
Subject: [Question] Make the DT cpu-map parser be aware of socket nodes
Date: Thu, 19 Aug 2021 16:13:03 +0800	[thread overview]
Message-ID: <20210819081303.188008-1-wangyanan55@huawei.com> (raw)

Hi,

It seems that there is some discrepancy between the kernel documentation
(Documentation/devicetree/bindings/cpu/cpu-topology.txt) and the actual
implementation of DT topology parser for ARM64 (function parse_dt_topology()
in drivers/base/arch_topology.c).

The Doc implies that we can define a cpu-map for the ARM64 multi-socket
system like:
(1) cpu-map
	socket0
		cluster0
			core0
			core1
		cluster1
			core0
			core1
	socket1
		cluster0
			core0
			core1
		cluster1
			core0
			core1

or a cpu-map for 32-bit system like:
(2) cpu-map
        cluster0
                cluster0
                        core0
                        core1
                cluster1
                        core0
                        core1
        cluster1
                cluster0
                        core0
                        core1
                cluster1
                        core0
                        core1

But current parser only assumes that there are nested clusters within
cpu-map and is unaware of socket, the parser also ignore any information
about the nesting of clusters and present the scheduler with a flat list
of them. So based on current parser, we will get "4 packages, 2 cores per
package, 1 threads per core" from (2), but can not generate a valid
topology from (1).

There are two questions that I'm not sure.

1) Why are we using leaf cluster nodes as packages ? To be more consistent with
the concept of package (or sockets), maybe we should use the top-level cluster
nodes as packages, or just make one single socket ?

2) Now it's documented that a cpu-map with socket nodes can be defined for ARM64,
then do we have any plan to make the parser be aware of sockets too ?
Like, we will make each socket nodes as a package instead of the leaf clusters
if there are socket nodes found in the DT. So we will get "2 packages, 4 cores
per package, 1 thread per core" from cpu-map (1).

In virtualization, I hope to describe the user-defined (from QEMU) topology
information (e.g. sockets=2,cores=8,threads=2) through DT, so that the guest
kernel can get the topology. But I'm not sure whether to build the DT in format
"cpu-map/socket%d/core%d/thread%d" or "cpu-map/cluster%d/core%d/thread%d".
Honestly, I think the first one is consistent with the Doc.


Looking forward to some reply, thanks!

Yanan
.

                 reply	other threads:[~2021-08-19  8:13 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20210819081303.188008-1-wangyanan55@huawei.com \
    --to=wangyanan55@huawei.com \
    --cc=broonie@linaro.org \
    --cc=catalin.marinas@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=sudeep.holla@arm.com \
    --cc=wanghaibin.wang@huawei.com \
    /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

all inboxes | Powered by JetHome®