[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] x86/mce: eliminate unnecessary NR_CPUS-sized arrays



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1278674632 -3600
# Node ID da2b019ba6442cffff3ca5f0bcc99438814b7614
# Parent  84719437205c896943fa2a06bd33bc8834928e28
x86/mce: eliminate unnecessary NR_CPUS-sized arrays

Replace them with per-CPU data.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
---
 xen/arch/x86/cpu/mcheck/mce_intel.c |    6 +++---
 xen/arch/x86/cpu/mcheck/mctelem.c   |   31 +++++++++++++++++--------------
 2 files changed, 20 insertions(+), 17 deletions(-)

diff -r 84719437205c -r da2b019ba644 xen/arch/x86/cpu/mcheck/mce_intel.c
--- a/xen/arch/x86/cpu/mcheck/mce_intel.c       Fri Jul 09 12:22:52 2010 +0100
+++ b/xen/arch/x86/cpu/mcheck/mce_intel.c       Fri Jul 09 12:23:52 2010 +0100
@@ -41,13 +41,13 @@ static void intel_thermal_interrupt(stru
 {
     uint64_t msr_content;
     unsigned int cpu = smp_processor_id();
-    static s_time_t next[NR_CPUS];
+    static DEFINE_PER_CPU(s_time_t, next);
 
     ack_APIC_irq();
-    if (NOW() < next[cpu])
+    if (NOW() < per_cpu(next, cpu))
         return;
 
-    next[cpu] = NOW() + MILLISECS(5000);
+    per_cpu(next, cpu) = NOW() + MILLISECS(5000);
     rdmsrl(MSR_IA32_THERM_STATUS, msr_content);
     if (msr_content & 0x1) {
         printk(KERN_EMERG "CPU%d: Temperature above threshold\n", cpu);
diff -r 84719437205c -r da2b019ba644 xen/arch/x86/cpu/mcheck/mctelem.c
--- a/xen/arch/x86/cpu/mcheck/mctelem.c Fri Jul 09 12:22:52 2010 +0100
+++ b/xen/arch/x86/cpu/mcheck/mctelem.c Fri Jul 09 12:23:52 2010 +0100
@@ -109,15 +109,19 @@ static struct mc_telem_ctl {
         * Telemetry array
         */
        struct mctelem_ent *mctc_elems;
+} mctctl;
+
+struct mc_telem_cpu_ctl {
        /*
         * Per-CPU processing lists, used for deferred (softirq)
-        * processing of telemetry. mctc_cpu is indexed by the
-        * CPU that the telemetry belongs to. mctc_cpu_processing
-        * is indexed by the CPU that is processing the telemetry.
-        */
-       struct mctelem_ent *mctc_cpu[NR_CPUS];
-       struct mctelem_ent *mctc_cpu_processing[NR_CPUS];
-} mctctl;
+        * processing of telemetry. @pending is indexed by the
+        * CPU that the telemetry belongs to. @processing is indexed
+        * by the CPU that is processing the telemetry.
+        */
+       struct mctelem_ent *pending;
+       struct mctelem_ent *processing;
+};
+static DEFINE_PER_CPU(struct mc_telem_cpu_ctl, mctctl);
 
 /* Lock protecting all processing lists */
 static DEFINE_SPINLOCK(processing_lock);
@@ -139,8 +143,7 @@ void mctelem_defer(mctelem_cookie_t cook
 {
        struct mctelem_ent *tep = COOKIE2MCTE(cookie);
 
-       mctelem_xchg_head(&mctctl.mctc_cpu[smp_processor_id()],
-           &tep->mcte_next, tep);
+       mctelem_xchg_head(&this_cpu(mctctl.pending), &tep->mcte_next, tep);
 }
 
 void mctelem_process_deferred(unsigned int cpu,
@@ -154,10 +157,10 @@ void mctelem_process_deferred(unsigned i
         * First, unhook the list of telemetry structures, and  
         * hook it up to the processing list head for this CPU.
         */
-       mctelem_xchg_head(&mctctl.mctc_cpu[cpu],
-           &mctctl.mctc_cpu_processing[smp_processor_id()], NULL);
-
-       head = mctctl.mctc_cpu_processing[smp_processor_id()];
+       mctelem_xchg_head(&per_cpu(mctctl.pending, cpu),
+                         &this_cpu(mctctl.processing), NULL);
+
+       head = this_cpu(mctctl.processing);
 
        /*
         * Then, fix up the list to include prev pointers, to make
@@ -193,7 +196,7 @@ void mctelem_process_deferred(unsigned i
 
 int mctelem_has_deferred(unsigned int cpu)
 {
-       if (mctctl.mctc_cpu[cpu] != NULL)
+       if (per_cpu(mctctl.pending, cpu) != NULL)
                return 1;
        return 0;
 }

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.