[PATCH 1/4] mce-inject: make raise_global()

From: Hidetoshi Seto
Date: Fri Oct 09 2009 - 01:45:11 EST


Move large block into a function. No code changed.

Signed-off-by: Hidetoshi Seto <seto.hidetoshi@xxxxxxxxxxxxxx>
---
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


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/