public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andreas Herrmann <herrmann.der.user@googlemail.com>
To: "H. Peter Anvin" <hpa@zytor.com>, Ingo Molnar <mingo@elte.hu>,
	Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 5/6] x86, amd: Use compute unit information to determine thread siblings
Date: Thu, 30 Sep 2010 14:41:56 +0200	[thread overview]
Message-ID: <20100930124156.GF20545@loge.amd.com> (raw)
In-Reply-To: <20100930121839.GA20545@loge.amd.com>

From: Andreas Herrmann <andreas.herrmann3@amd.com>

This information is vital for different load balancing policies.

Signed-off-by: Andreas Herrmann <andreas.herrmann3@amd.com>
---
 arch/x86/kernel/smpboot.c |   28 ++++++++++++++++++++--------
 1 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index d3484f1..2ced73b 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -396,6 +396,19 @@ void __cpuinit smp_store_cpu_info(int id)
 		identify_secondary_cpu(c);
 }
 
+static void __cpuinit link_thread_siblings(int cpu1, int cpu2)
+{
+	struct cpuinfo_x86 *c1 = &cpu_data(cpu1);
+	struct cpuinfo_x86 *c2 = &cpu_data(cpu2);
+
+	cpumask_set_cpu(cpu1, cpu_sibling_mask(cpu2));
+	cpumask_set_cpu(cpu2, cpu_sibling_mask(cpu1));
+	cpumask_set_cpu(cpu1, cpu_core_mask(cpu2));
+	cpumask_set_cpu(cpu2, cpu_core_mask(cpu1));
+	cpumask_set_cpu(cpu1, c2->llc_shared_map);
+	cpumask_set_cpu(cpu2, c1->llc_shared_map);
+}
+
 
 void __cpuinit set_cpu_sibling_map(int cpu)
 {
@@ -408,14 +421,13 @@ void __cpuinit set_cpu_sibling_map(int cpu)
 		for_each_cpu(i, cpu_sibling_setup_mask) {
 			struct cpuinfo_x86 *o = &cpu_data(i);
 
-			if (c->phys_proc_id == o->phys_proc_id &&
-			    c->cpu_core_id == o->cpu_core_id) {
-				cpumask_set_cpu(i, cpu_sibling_mask(cpu));
-				cpumask_set_cpu(cpu, cpu_sibling_mask(i));
-				cpumask_set_cpu(i, cpu_core_mask(cpu));
-				cpumask_set_cpu(cpu, cpu_core_mask(i));
-				cpumask_set_cpu(i, c->llc_shared_map);
-				cpumask_set_cpu(cpu, o->llc_shared_map);
+			if (cpu_has(c, X86_FEATURE_TOPOEXT)) {
+				if (c->phys_proc_id == o->phys_proc_id &&
+				    c->compute_unit_id == o->compute_unit_id)
+					link_thread_siblings(cpu, i);
+			} else if (c->phys_proc_id == o->phys_proc_id &&
+				   c->cpu_core_id == o->cpu_core_id) {
+				link_thread_siblings(cpu, i);
 			}
 		}
 	} else {
-- 
1.6.4.4


  parent reply	other threads:[~2010-09-30 12:45 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-30 12:18 [PATCH 0/6] x86, amd: Add basic support for AMD CPU family 15h Andreas Herrmann
2010-09-30 12:32 ` [PATCH 1/6] x86, mtrr: Assume SYS_CFG[Tom2ForceMemTypeWB] exists on all future AMD CPUs Andreas Herrmann
2010-10-04 20:25   ` [tip:x86/amd-nb] " tip-bot for Andreas Herrmann
2010-09-30 12:33 ` [PATCH 2/6] x86, nmi: Support NMI watchdog on newer AMD CPU families Andreas Herrmann
2010-10-04 20:25   ` [tip:x86/amd-nb] " tip-bot for Andreas Herrmann
2010-09-30 12:36 ` [PATCH 3/6] x86, amd: Add support for CPUID topology extension of AMD CPUs Andreas Herrmann
2010-10-04 20:26   ` [tip:x86/amd-nb] " tip-bot for Andreas Herrmann
2010-09-30 12:38 ` [PATCH 4/6] x86, amd: Extract compute unit information for " Andreas Herrmann
2010-10-04 20:26   ` [tip:x86/amd-nb] " tip-bot for Andreas Herrmann
2010-09-30 12:41 ` Andreas Herrmann [this message]
2010-10-04 20:26   ` [tip:x86/amd-nb] x86, amd: Use compute unit information to determine thread siblings tip-bot for Andreas Herrmann
2010-09-30 12:43 ` [PATCH 6/6] x86, amd_nb: Enable GART support for AMD family 0x15 CPUs Andreas Herrmann
2010-10-04 20:27   ` [tip:x86/amd-nb] " tip-bot for Andreas Herrmann

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=20100930124156.GF20545@loge.amd.com \
    --to=herrmann.der.user@googlemail.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    /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