All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Winchester <kjwinchester@gmail.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: Kevin Winchester <kjwinchester@gmail.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Borislav Petkov <bp@alien8.de>,
	Randy Dunlap <rdunlap@xenotime.net>,
	Nick Bowler <nbowler@elliptictech.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH v5 4/5] x86: Move per cpu cpu_core_map to a field in struct cpuinfo_x86
Date: Wed, 28 Mar 2012 19:43:06 -0300	[thread overview]
Message-ID: <1332974587-15452-5-git-send-email-kjwinchester@gmail.com> (raw)
In-Reply-To: <1332974587-15452-1-git-send-email-kjwinchester@gmail.com>

This simplifies the various code paths using this field as it
groups the per-cpu data together.

Acked-by: Borislav Petkov <bp@alien8.de>
Signed-off-by: Kevin Winchester <kjwinchester@gmail.com>
---
 arch/x86/include/asm/processor.h |    5 +++++
 arch/x86/include/asm/smp.h       |    3 +--
 arch/x86/include/asm/topology.h  |    2 +-
 arch/x86/kernel/smpboot.c        |   11 +----------
 arch/x86/xen/smp.c               |    4 ----
 drivers/cpufreq/powernow-k8.c    |    7 -------
 6 files changed, 8 insertions(+), 24 deletions(-)

diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
index 774efb5..22af2da 100644
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -115,6 +115,11 @@ struct cpuinfo_x86 {
 	u16			llc_id;
 	/* representing HT siblings of each logical CPU */
 	cpumask_t		sibling_map;
+	/*
+	 * representing all execution threads on a logical CPU, i.e. per
+	 * physical socket
+	 */
+	cpumask_t		core_map;
 } __attribute__((__aligned__(SMP_CACHE_BYTES)));
 
 #define X86_VENDOR_INTEL	0
diff --git a/arch/x86/include/asm/smp.h b/arch/x86/include/asm/smp.h
index ef01857..408152e 100644
--- a/arch/x86/include/asm/smp.h
+++ b/arch/x86/include/asm/smp.h
@@ -31,7 +31,6 @@ static inline bool cpu_has_ht_siblings(void)
 	return has_siblings;
 }
 
-DECLARE_PER_CPU(cpumask_var_t, cpu_core_map);
 DECLARE_PER_CPU(int, cpu_number);
 
 static inline struct cpumask *cpu_sibling_mask(int cpu)
@@ -41,7 +40,7 @@ static inline struct cpumask *cpu_sibling_mask(int cpu)
 
 static inline struct cpumask *cpu_core_mask(int cpu)
 {
-	return per_cpu(cpu_core_map, cpu);
+	return &cpu_data(cpu).core_map;
 }
 
 static inline struct cpumask *cpu_llc_shared_mask(int cpu)
diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topology.h
index 5297acbf..5ffa396 100644
--- a/arch/x86/include/asm/topology.h
+++ b/arch/x86/include/asm/topology.h
@@ -160,7 +160,7 @@ extern const struct cpumask *cpu_coregroup_mask(int cpu);
 #ifdef ENABLE_TOPO_DEFINES
 #define topology_physical_package_id(cpu)	(cpu_data(cpu).phys_proc_id)
 #define topology_core_id(cpu)			(cpu_data(cpu).cpu_core_id)
-#define topology_core_cpumask(cpu)		(per_cpu(cpu_core_map, cpu))
+#define topology_core_cpumask(cpu)		(&cpu_data(cpu).core_map)
 #define topology_thread_cpumask(cpu)		(&cpu_data(cpu).sibling_map)
 
 /* indicates that pointers to the topology cpumask_t maps are valid */
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index 4946501..88b8320 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -116,10 +116,6 @@ static struct task_struct *idle_thread_array[NR_CPUS] __cpuinitdata ;
 int smp_num_siblings = 1;
 EXPORT_SYMBOL(smp_num_siblings);
 
-/* representing HT and core siblings of each logical CPU */
-DEFINE_PER_CPU(cpumask_var_t, cpu_core_map);
-EXPORT_PER_CPU_SYMBOL(cpu_core_map);
-
 /* Per CPU bogomips and other parameters */
 DEFINE_PER_CPU_SHARED_ALIGNED(struct cpuinfo_x86, cpu_info);
 EXPORT_PER_CPU_SYMBOL(cpu_info);
@@ -391,7 +387,7 @@ const struct cpumask *cpu_coregroup_mask(int cpu)
 	struct cpuinfo_x86 *c = &cpu_data(cpu);
 	/*
 	 * For perf, we return last level cache shared map.
-	 * And for power savings, we return cpu_core_map
+	 * And for power savings, we return core map.
 	 */
 	if ((sched_mc_power_savings || sched_smt_power_savings) &&
 	    !(cpu_has(c, X86_FEATURE_AMD_DCM)))
@@ -1015,8 +1011,6 @@ static void __init smp_cpu_index_default(void)
  */
 void __init native_smp_prepare_cpus(unsigned int max_cpus)
 {
-	unsigned int i;
-
 	preempt_disable();
 	smp_cpu_index_default();
 
@@ -1028,9 +1022,6 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus)
 	mb();
 
 	current_thread_info()->cpu = 0;  /* needed? */
-	for_each_possible_cpu(i) {
-		zalloc_cpumask_var(&per_cpu(cpu_core_map, i), GFP_KERNEL);
-	}
 	set_cpu_sibling_map(0);
 
 
diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c
index c80cf8b..53f774d 100644
--- a/arch/x86/xen/smp.c
+++ b/arch/x86/xen/smp.c
@@ -212,7 +212,6 @@ static void __init xen_smp_prepare_boot_cpu(void)
 static void __init xen_smp_prepare_cpus(unsigned int max_cpus)
 {
 	unsigned cpu;
-	unsigned int i;
 
 	if (skip_ioapic_setup) {
 		char *m = (max_cpus == 0) ?
@@ -228,9 +227,6 @@ static void __init xen_smp_prepare_cpus(unsigned int max_cpus)
 	smp_store_cpu_info(0);
 	cpu_data(0).x86_max_cores = 1;
 
-	for_each_possible_cpu(i) {
-		zalloc_cpumask_var(&per_cpu(cpu_core_map, i), GFP_KERNEL);
-	}
 	set_cpu_sibling_map(0);
 
 	if (xen_smp_intr_init(0))
diff --git a/drivers/cpufreq/powernow-k8.c b/drivers/cpufreq/powernow-k8.c
index c0e8164..f81fdb5 100644
--- a/drivers/cpufreq/powernow-k8.c
+++ b/drivers/cpufreq/powernow-k8.c
@@ -67,13 +67,6 @@ static struct msr __percpu *msrs;
 
 static struct cpufreq_driver cpufreq_amd64_driver;
 
-#ifndef CONFIG_SMP
-static inline const struct cpumask *cpu_core_mask(int cpu)
-{
-	return cpumask_of(0);
-}
-#endif
-
 /* Return a frequency in MHz, given an input fid */
 static u32 find_freq_from_fid(u32 fid)
 {
-- 
1.7.9.5


  parent reply	other threads:[~2012-03-28 22:44 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-23 23:57 [PATCH v4 0/5] x86: Cleanup and simplify cpu-specific data Kevin Winchester
2012-02-23 23:57 ` [PATCH v4 1/5] x86: Move per cpu cpu_llc_shared_map to a field in struct cpuinfo_x86 Kevin Winchester
2012-02-23 23:57 ` [PATCH v4 2/5] x86: Move per cpu cpu_llc_id " Kevin Winchester
2012-02-23 23:57 ` [PATCH v4 3/5] x86: Move per cpu cpu_sibling_map " Kevin Winchester
2012-02-23 23:57 ` [PATCH v4 4/5] x86: Move per cpu cpu_core_map " Kevin Winchester
2012-02-23 23:57 ` [PATCH v4 5/5] x86: Remove #ifdef CONFIG_SMP sections by moving smp_num_siblings into common.c Kevin Winchester
2012-02-24 11:47 ` [PATCH v4 0/5] x86: Cleanup and simplify cpu-specific data Borislav Petkov
2012-02-24 12:22   ` Kevin Winchester
2012-02-24 12:30     ` Borislav Petkov
2012-02-27 11:59 ` Ingo Molnar
2012-02-28  0:52   ` Kevin Winchester
2012-02-28  3:43     ` H. Peter Anvin
2012-02-28  8:24       ` Ingo Molnar
2012-02-28  8:31         ` H. Peter Anvin
2012-03-01 13:06           ` Kevin Winchester
2012-03-01 13:45             ` Ingo Molnar
2012-03-28 22:43   ` [PATCH v5 " Kevin Winchester
2012-03-28 22:43     ` [PATCH v5 1/5] x86: Move per cpu cpu_llc_shared_map to a field in struct cpuinfo_x86 Kevin Winchester
2012-03-28 22:43     ` [PATCH v5 2/5] x86: Move per cpu cpu_llc_id " Kevin Winchester
2012-03-28 22:43     ` [PATCH v5 3/5] x86: Move per cpu cpu_sibling_map " Kevin Winchester
2012-03-28 22:43     ` Kevin Winchester [this message]
2012-03-28 22:43     ` [PATCH v5 5/5] x86: Remove #ifdef CONFIG_SMP sections by moving smp_num_siblings into common.c Kevin Winchester
2012-04-26 18:09     ` [PATCH v5 0/5] x86: Cleanup and simplify cpu-specific data Kevin Winchester
2012-04-26 19:48     ` H. Peter Anvin
     [not found]       ` <CAELBVzAi_yndZbDc0TkXhbqzn2wULpnsFMA_dop=Uvaii8tkqg@mail.gmail.com>
2012-04-26 21:21         ` H. Peter Anvin
2012-04-27 23:37           ` Kevin Winchester
2012-04-29 12:47             ` Borislav Petkov
2012-04-29 22:55               ` Kevin Winchester
2012-04-29 23:33           ` [PATCH v6 " Kevin Winchester
2012-04-29 23:33             ` [PATCH v6 1/5] x86: Move per cpu cpu_llc_shared_map to a field in struct cpuinfo_x86 Kevin Winchester
2012-04-29 23:37               ` H. Peter Anvin
2012-04-30 15:05                 ` Kevin Winchester
2012-05-07  8:32                   ` Ingo Molnar
2012-04-29 23:33             ` [PATCH v6 2/5] x86: Move per cpu cpu_llc_id " Kevin Winchester
2012-04-29 23:33             ` [PATCH v6 3/5] x86: Move per cpu cpu_sibling_map " Kevin Winchester
2012-04-29 23:33             ` [PATCH v6 4/5] x86: Move per cpu cpu_core_map " Kevin Winchester
2012-04-29 23:33             ` [PATCH v6 5/5] x86: Remove #ifdef CONFIG_SMP sections by moving smp_num_siblings into common.c Kevin Winchester

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=1332974587-15452-5-git-send-email-kjwinchester@gmail.com \
    --to=kjwinchester@gmail.com \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=nbowler@elliptictech.com \
    --cc=rdunlap@xenotime.net \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.