lkml.org 
[lkml]   [2009]   [Oct]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 1/4] mce-inject: make raise_global()
Move large block into a function.  No code changed.

Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
---
arch/x86/kernel/cpu/mcheck/mce-inject.c | 73 ++++++++++++++++++-------------
1 files changed, 42 insertions(+), 31 deletions(-)
diff --git a/arch/x86/kernel/cpu/mcheck/mce-inject.c b/arch/x86/kernel/cpu/mcheck/mce-inject.c
index a481291..835c072 100644
--- a/arch/x86/kernel/cpu/mcheck/mce-inject.c
+++ b/arch/x86/kernel/cpu/mcheck/mce-inject.c
@@ -148,6 +148,45 @@ static int raise_local(void)
return ret;
}

+#ifdef CONFIG_X86_LOCAL_APIC
+static void raise_global(void)
+{
+ unsigned long start;
+ int cpu;
+
+ get_online_cpus();
+ mce_inject_cpumask = cpu_online_map;
+ cpu_clear(get_cpu(), mce_inject_cpumask);
+
+ for_each_online_cpu(cpu) {
+ struct mce *m = &per_cpu(mce_fake_banks, cpu).injectm;
+ if (!m->finished || MCE_INJ_CTX(m->inject_flags)
+ != MCE_INJ_CTX_RANDOM)
+ cpu_clear(cpu, mce_inject_cpumask);
+ }
+ /* make sure mce_inject_cpumask is visible on other CPUs */
+ smp_mb();
+
+ if (!cpus_empty(mce_inject_cpumask))
+ apic->send_IPI_mask(&mce_inject_cpumask, NMI_VECTOR);
+
+ start = jiffies;
+ while (!cpus_empty(mce_inject_cpumask)) {
+ if (!time_before(jiffies, start + 2*HZ)) {
+ printk(KERN_ERR
+ "Timeout waiting for mce inject NMI %lx\n",
+ *cpus_addr(mce_inject_cpumask));
+ break;
+ }
+ cpu_relax();
+ }
+ raise_local();
+
+ put_cpu();
+ put_online_cpus();
+}
+#endif
+
static void raise_mce(struct mce *m)
{
/*
@@ -157,37 +196,9 @@ static void raise_mce(struct mce *m)
schedule_timeout(2);

#ifdef CONFIG_X86_LOCAL_APIC
- if (m->inject_flags & MCE_INJ_NMI_BROADCAST) {
- unsigned long start;
- int cpu;
- get_online_cpus();
- mce_inject_cpumask = cpu_online_map;
- cpu_clear(get_cpu(), mce_inject_cpumask);
- for_each_online_cpu(cpu) {
- struct mce *m = &per_cpu(mce_fake_banks, cpu).injectm;
- if (!m->finished || MCE_INJ_CTX(m->inject_flags)
- != MCE_INJ_CTX_RANDOM)
- cpu_clear(cpu, mce_inject_cpumask);
- }
- /* make sure mce_inject_cpumask is visible on other CPUs */
- smp_mb();
-
- if (!cpus_empty(mce_inject_cpumask))
- apic->send_IPI_mask(&mce_inject_cpumask, NMI_VECTOR);
- start = jiffies;
- while (!cpus_empty(mce_inject_cpumask)) {
- if (!time_before(jiffies, start + 2*HZ)) {
- printk(KERN_ERR
- "Timeout waiting for mce inject NMI %lx\n",
- *cpus_addr(mce_inject_cpumask));
- break;
- }
- cpu_relax();
- }
- raise_local();
- put_cpu();
- put_online_cpus();
- } else
+ if (m->inject_flags & MCE_INJ_NMI_BROADCAST)
+ raise_global();
+ else
#endif
raise_local();
}
--
1.6.2.2



\
 
 \ /
  Last update: 2009-10-09 07:47    [from the cache]
©2003-2011 Jasper Spaans