Re: [PATCH 2/3] x86/topology: Fix AMD core count
From: Borislav Petkov
Date: Mon Mar 21 2016 - 09:57:44 EST
On Mon, Mar 21, 2016 at 05:46:12PM +0800, Huang Rui wrote:
> OK, maybe, we would better add a comment to explain here. :-)
Here's a start:
From: Borislav Petkov <bp@xxxxxxx>
Date: Mon, 21 Mar 2016 14:53:05 +0100
Subject: [PATCH] x86/Documentation: Start documenting x86 topology
This should contain important aspects of how we represent the system
topology on x86. If people have questions about it and this file doesn't
answer it, then it must be updated.
Signed-off-by: Borislav Petkov <bp@xxxxxxx>
Documentation/x86/topology.txt | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
create mode 100644 Documentation/x86/topology.txt
diff --git a/Documentation/x86/topology.txt b/Documentation/x86/topology.txt
new file mode 100644
@@ -0,0 +1,34 @@
+This documents and clarifies the main aspects of x86 topology modelling
+and representation in the kernel. Update/change when doing changes to
+the respective code.
+Started by Borislav Petkov <bp@xxxxxxxxx>.
+The main aim of the topology facilities is to present adequate
+interfaces to code which needs to know/query/use the structure of the
+running system wrt threads, cores, nodes, etc.
+* cpuinfo_x86.x86_max_cores: the number of cores on a node, as reported
+by CPUID. Now, in order to accomodate both Intel and AMD, this variable
+means the following:
+- Intel: the number of cores in a processor. A core can have 1, 2 or
+more logical threads (hyperthreaded).
+- AMD: the number of cores in a processor. On a system where cores are
+clustered in groups of 2, 4 or more in compute units, this variable
+denotes the number of *compute units* on the node.
+In both cases, the number of scheduling threads is computed by doing:
+ x86_max_cores * smp_num_siblings
+* smp_num_siblings: the number of siblings in a core. On AMD with
+compute units, this number is the number of compute unit siblings,
+i.e., compute unit cores in a single compute unit, according to their
ECO tip #101: Trim your mails when you reply.