Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751793AbbFYMJ5 (ORCPT ); Thu, 25 Jun 2015 08:09:57 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:33607 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751171AbbFYMJ4 (ORCPT ); Thu, 25 Jun 2015 08:09:56 -0400 Date: Thu, 25 Jun 2015 14:09:49 +0200 From: Peter Zijlstra To: Pontus Fuchs Cc: mingo@redhat.com, "linux-kernel@vger.kernel.org" , gleb@kernel.org Subject: Re: Regression: sched/preempt: Add static_key() to preempt_notifiers breaks my KVM Message-ID: <20150625120949.GZ3644@twins.programming.kicks-ass.net> References: <558BED42.1030000@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <558BED42.1030000@gmail.com> User-Agent: Mutt/1.5.21 (2012-12-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2779 Lines: 71 On Thu, Jun 25, 2015 at 02:00:02PM +0200, Pontus Fuchs wrote: > Hi, > > On 4.1+ kernels I can no longer start my KVM guest. Upon trying to start it > I can see the following log message: > > [ 25.821060] BUG: sleeping function called from invalid context at > kernel/locking/mutex.c:97 > [ 25.821063] in_atomic(): 1, irqs_disabled(): 0, pid: 2113, name: > qemu-system-x86 > [ 25.821066] CPU: 0 PID: 2113 Comm: qemu-system-x86 Not tainted 4.1.0+ #88 > [ 25.821067] Hardware name: Dell Inc. Dell System XPS 15Z/00WW5M, > BIOS A12 09/07/2012 > [ 25.821068] 0000000000000061 ffff88021339bcd8 ffffffff816b8c81 > 0000000000000007 > [ 25.821070] ffff880231159d40 ffff88021339bcf8 ffffffff8107d163 > ffff88021339bd18 > [ 25.821072] ffffffff81a451bc ffff88021339bd28 ffffffff8107d1ed > ffff8802133a0000 > [ 25.821073] Call Trace: > [ 25.821078] [] dump_stack+0x4c/0x65 > [ 25.821081] [] ___might_sleep+0xd3/0x110 > [ 25.821083] [] __might_sleep+0x4d/0x90 > [ 25.821085] [] mutex_lock+0x24/0x50 > [ 25.821087] [] static_key_slow_inc+0x57/0xc0 > [ 25.821089] [] preempt_notifier_register+0x1d/0x60 > [ 25.821099] [] vcpu_load+0x3d/0x70 [kvm] > [ 25.821108] [] kvm_arch_vcpu_setup+0x1e/0x50 [kvm] > [ 25.821115] [] ? kvm_arch_vcpu_create+0x51/0x70 [kvm] > [ 25.821120] [] kvm_vm_ioctl+0x1d2/0x7a0 [kvm] > [ 25.821123] [] do_vfs_ioctl+0x301/0x550 > [ 25.821124] [] SyS_ioctl+0x79/0x90 > [ 25.821127] [] entry_SYSCALL_64_fastpath+0x12/0x6a > That seems pointless.. --- virt/kvm/kvm_main.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 90977418aeb6..d7aafa0458a0 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -128,8 +128,9 @@ int vcpu_load(struct kvm_vcpu *vcpu) if (mutex_lock_killable(&vcpu->mutex)) return -EINTR; - cpu = get_cpu(); preempt_notifier_register(&vcpu->preempt_notifier); + + cpu = get_cpu(); kvm_arch_vcpu_load(vcpu, cpu); put_cpu(); return 0; @@ -139,8 +140,8 @@ void vcpu_put(struct kvm_vcpu *vcpu) { preempt_disable(); kvm_arch_vcpu_put(vcpu); - preempt_notifier_unregister(&vcpu->preempt_notifier); preempt_enable(); + preempt_notifier_unregister(&vcpu->preempt_notifier); mutex_unlock(&vcpu->mutex); } -- 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/