Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753091AbXHSKzS (ORCPT ); Sun, 19 Aug 2007 06:55:18 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751317AbXHSKzF (ORCPT ); Sun, 19 Aug 2007 06:55:05 -0400 Received: from il.qumranet.com ([82.166.9.18]:51987 "EHLO il.qumranet.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751201AbXHSKzB (ORCPT ); Sun, 19 Aug 2007 06:55:01 -0400 Message-ID: <46C82191.90300@qumranet.com> Date: Sun, 19 Aug 2007 13:55:13 +0300 From: Avi Kivity User-Agent: Thunderbird 2.0.0.0 (X11/20070419) MIME-Version: 1.0 To: Paolo Ornati CC: Michal Piotrowski , Linux Kernel Mailing List , kvm-devel@lists.sourceforge.net Subject: Re: WARNING: at arch/x86_64/kernel/smp.c:379 smp_call_function_single() References: <20070810134140.2806b587@localhost> <6bffcb0e0708100504n7fbafb5bt6a35165277dc767a@mail.gmail.com> <20070813134237.23f4b5a1@localhost> <46C05017.3050806@qumranet.com> In-Reply-To: <46C05017.3050806@qumranet.com> Content-Type: multipart/mixed; boundary="------------080108090808040004090202" Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4200 Lines: 116 This is a multi-part message in MIME format. --------------080108090808040004090202 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Avi Kivity wrote: > Paolo Ornati wrote: >> On Fri, 10 Aug 2007 14:04:33 +0200 >> "Michal Piotrowski" wrote: >> >> >>>> [ 756.707601] Disabling non-boot CPUs ... >>>> [ 756.712034] kvm: disabling virtualization on CPU1 >>>> [ 756.712037] WARNING: at arch/x86_64/kernel/smp.c:379 >>>> smp_call_function_single() >>>> [ 756.712039] >>>> [ 756.712039] Call Trace: >>>> [ 756.712046] [] >>>> smp_call_function_single+0x119/0x120 >>>> [ 756.712050] [] thread_return+0x1bf/0x626 >>>> [ 756.712054] [] sys_sched_yield+0x2b/0x80 >>>> [ 756.712057] [] kvm_cpu_hotplug+0x4b/0xa0 >>>> [ 756.712060] [] notifier_call_chain+0x53/0x80 >>>> [ 756.712062] [] >>>> __raw_notifier_call_chain+0x9/0x10 >>>> [ 756.712065] [] raw_notifier_call_chain+0x11/0x20 >>>> [ 756.712068] [] take_cpu_down+0x1b/0x30 >>>> [ 756.712071] [] do_stop+0xd2/0x150 >>>> [ 756.712073] [] do_stop+0x0/0x150 >>>> [ 756.712076] [] kthread+0x4d/0x80 >>>> [ 756.712079] [] child_rip+0xa/0x12 >>>> [ 756.712081] [] restore_args+0x0/0x30 >>>> [ 756.712084] [] kthread+0x0/0x80 >>>> [ 756.712086] [] child_rip+0x0/0x12 >>>> [ 756.712087] >>>> [ 756.815693] CPU 1 is now offline >>>> [ 756.815697] lockdep: not fixing up alternatives. >>>> [ 756.819276] CPU1 is down >>>> >>>> >>> Added to KR list, thanks for the report. >>> >> >> >> I've bisected it down to this commit: >> >> cec9ad279b66793bee0b5009b7ca311060061efd >> >> KVM: Use CPU_DYING for disabling virtualization >> Only at the CPU_DYING stage can we be sure that no user >> process will >> be scheduled onto the cpu and oops when trying to use virtualization >> extensions. >> >> > > Thanks. I'll have a go at it. > > Sorry about the delay -- here is the fairly simple patch. A Tested-by: would be appreciated. -- error compiling committee.c: too many arguments to function --------------080108090808040004090202 Content-Type: text/x-patch; name="0001-KVM-Avoid-calling-smp_call_function_single-with-i.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename*0="0001-KVM-Avoid-calling-smp_call_function_single-with-i.patch" >From a8c346b28695b938018f4bafd458f6d3e70c36e3 Mon Sep 17 00:00:00 2001 From: Avi Kivity Date: Sun, 19 Aug 2007 13:51:00 +0300 Subject: [PATCH] KVM: Avoid calling smp_call_function_single() with interrupts disabled When taking a cpu down, we need to hardware_disable() it. Unfortunately, the CPU_DYING notifier is called with interrupts disabled, which means we can't use smp_call_function_single(). Fortunately, the CPU_DYING notifier is always called on the dying cpu, so we don't need to use the function at all and can simply call hardware_disable() directly. Signed-off-by: Avi Kivity --- drivers/kvm/kvm_main.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c index 9685609..cd05579 100644 --- a/drivers/kvm/kvm_main.c +++ b/drivers/kvm/kvm_main.c @@ -2974,6 +2974,10 @@ static int kvm_cpu_hotplug(struct notifier_block *notifier, unsigned long val, switch (val) { case CPU_DYING: case CPU_DYING_FROZEN: + printk(KERN_INFO "kvm: disabling virtualization on CPU%d\n", + cpu); + hardware_disable(NULL); + break; case CPU_UP_CANCELED: case CPU_UP_CANCELED_FROZEN: printk(KERN_INFO "kvm: disabling virtualization on CPU%d\n", -- 1.5.2.4 --------------080108090808040004090202-- - 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/