public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86 MCE: shut up lockdep warning
@ 2009-05-08  3:47 Shaohua Li
  2009-05-08  6:45 ` Andi Kleen
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Shaohua Li @ 2009-05-08  3:47 UTC (permalink / raw)
  To: lkml; +Cc: Andi Kleen, Andrew Morton

lockdep report below warning when I try to offline one cpu:
[  110.835487] =================================
[  110.835616] [ INFO: inconsistent lock state ]
[  110.835688] 2.6.30-rc4-00336-g8c9ed89 #52
[  110.835757] ---------------------------------
[  110.835828] inconsistent {HARDIRQ-ON-W} -> {IN-HARDIRQ-W} usage.
[  110.835908] swapper/0 [HC1[1]:SC0[0]:HE0:SE1] takes:
[  110.835982]  (cmci_discover_lock){?.+...}, at: [<ffffffff80236dc0>] cmci_clear+0x30/0x9b

smp_call_function_single() will disable interrupt. moving mce reenable/disable
to workqueue, so no irq is disabled.

Signed-off-by: Shaohua Li<shaohua.li@intel.com>
diff --git a/arch/x86/kernel/cpu/mcheck/mce_64.c b/arch/x86/kernel/cpu/mcheck/mce_64.c
index 6fb0b35..739c824 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_64.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_64.c
@@ -1057,30 +1057,32 @@ static __cpuinit void mce_remove_device(unsigned int cpu)
 }
 
 /* Make sure there are no machine checks on offlined CPUs. */
-static void mce_disable_cpu(void *h)
+static long mce_disable_cpu(void *h)
 {
 	int i;
 	unsigned long action = *(unsigned long *)h;
 
 	if (!mce_available(&current_cpu_data))
-		return;
+		return 0;
 	if (!(action & CPU_TASKS_FROZEN))
 		cmci_clear();
 	for (i = 0; i < banks; i++)
 		wrmsrl(MSR_IA32_MC0_CTL + i*4, 0);
+	return 0;
 }
 
-static void mce_reenable_cpu(void *h)
+static long mce_reenable_cpu(void *h)
 {
 	int i;
 	unsigned long action = *(unsigned long *)h;
 
 	if (!mce_available(&current_cpu_data))
-		return;
+		return 0;
 	if (!(action & CPU_TASKS_FROZEN))
 		cmci_reenable();
 	for (i = 0; i < banks; i++)
 		wrmsrl(MSR_IA32_MC0_CTL + i*4, bank[i]);
+	return 0;
 }
 
 /* Get notified when a cpu comes on/off. Be hotplug friendly. */
@@ -1106,14 +1108,14 @@ static int __cpuinit mce_cpu_callback(struct notifier_block *nfb,
 	case CPU_DOWN_PREPARE:
 	case CPU_DOWN_PREPARE_FROZEN:
 		del_timer_sync(t);
-		smp_call_function_single(cpu, mce_disable_cpu, &action, 1);
+		work_on_cpu(cpu, mce_disable_cpu, &action);
 		break;
 	case CPU_DOWN_FAILED:
 	case CPU_DOWN_FAILED_FROZEN:
 		t->expires = round_jiffies(jiffies +
 						__get_cpu_var(next_interval));
 		add_timer_on(t, cpu);
-		smp_call_function_single(cpu, mce_reenable_cpu, &action, 1);
+		work_on_cpu(cpu, mce_reenable_cpu, &action);
 		break;
 	case CPU_POST_DEAD:
 		/* intentionally ignoring frozen here */



^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2009-05-08 19:06 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-08  3:47 [PATCH] x86 MCE: shut up lockdep warning Shaohua Li
2009-05-08  6:45 ` Andi Kleen
2009-05-08  9:10   ` Ingo Molnar
2009-05-08  9:37     ` Andi Kleen
2009-05-08 12:14       ` Shaohua Li
2009-05-08  8:17 ` Hidetoshi Seto
2009-05-08  8:28 ` [PATCH] x86 MCE: yet another " Hidetoshi Seto
2009-05-08  9:07   ` [tip:x86/urgent] x86: MCE: make cmci_discover_lock irq-safe tip-bot for Hidetoshi Seto
2009-05-08  8:34 ` [PATCH] x86 MCE: shut up lockdep warning Peter Zijlstra
2009-05-08 19:11   ` Andi Kleen
2009-05-08  9:04 ` Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox