Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758218Ab0KAPqE (ORCPT ); Mon, 1 Nov 2010 11:46:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:4288 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756831Ab0KAPqB (ORCPT ); Mon, 1 Nov 2010 11:46:01 -0400 Date: Mon, 1 Nov 2010 11:45:36 -0400 From: Don Zickus To: Jan Kiszka Cc: Ingo Molnar , Peter Zijlstra , Cyrill Gorcunov , Eric Paris , Randy Dunlap , Frederic Weisbecker , Linux Kernel Mailing List Subject: Re: BUG: using smp_processor_id() in preemptible arch_trigger_all_cpu_backtrace_handler Message-ID: <20101101154536.GT4823@redhat.com> References: <4CCEB51C.7010901@web.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4CCEB51C.7010901@web.de> User-Agent: Mutt/1.5.20 (2009-08-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2265 Lines: 62 On Mon, Nov 01, 2010 at 01:39:56PM +0100, Jan Kiszka wrote: > Hi, > > I was getting this BUG while running into a GPF: > > BUG: using smp_processor_id() in preemptible [00000000] code: qemu-system-x86/2248 > caller is arch_trigger_all_cpu_backtrace_handler+0x1d/0xf7 > Pid: 2248, comm: qemu-system-x86 Not tainted 2.6.36+ #12 > Call Trace: > [] debug_smp_processor_id+0xd8/0xf4 > [] arch_trigger_all_cpu_backtrace_handler+0x1d/0xf7 > [] notifier_call_chain+0xa4/0xdb > [] __atomic_notifier_call_chain+0x63/0x95 > [] ? __atomic_notifier_call_chain+0x0/0x95 > [] ? sub_preempt_count+0x97/0xaa > [] ? pfn_to_dma_pte+0x73/0x190 > [] atomic_notifier_call_chain+0x14/0x16 > [] notify_die+0x2e/0x30 > [] do_general_protection+0x121/0x142 > [] system_call_fastpath+0x16/0x1b > > I guess this is not intended to trigger here, specifically as it showed > up first and may be misinterpreted as the core of the issue. Heh. Yeah when I migrated the code, I completely forgot the notifier chain could be called from a preemptible context (ie not NMI). This patch should fix it and I think it is the correct fix. Let me know how it works out. Cheers, Don diff --git a/arch/x86/kernel/apic/hw_nmi.c b/arch/x86/kernel/apic/hw_nmi.c index c7c9ae4..1bdd0b5 100644 --- a/arch/x86/kernel/apic/hw_nmi.c +++ b/arch/x86/kernel/apic/hw_nmi.c @@ -63,7 +63,7 @@ arch_trigger_all_cpu_backtrace_handler(struct notifier_block *self, { struct die_args *args = __args; struct pt_regs *regs; - int cpu = smp_processor_id(); + int cpu; switch (cmd) { case DIE_NMI: @@ -74,6 +74,7 @@ arch_trigger_all_cpu_backtrace_handler(struct notifier_block *self, } regs = args->regs; + cpu = smp_processor_id(); if (cpumask_test_cpu(cpu, to_cpumask(backtrace_mask))) { static arch_spinlock_t lock = __ARCH_SPIN_LOCK_UNLOCKED; -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/