Skip to contentSkip to conversation

Make the DT cpu-map parser be aware of socket nodes

Question Yanan Wang 1 participant 1 message Aug 19, 2021

lore
Share & tools
lore

Yanan Wang

author
#0 lore 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
.