* Qemu & KVM bug @ 2008-02-13 14:38 Zdenek Kabelac 2008-02-13 15:24 ` Jiri Kosina 0 siblings, 1 reply; 5+ messages in thread From: Zdenek Kabelac @ 2008-02-13 14:38 UTC (permalink / raw) To: linux-kernel Hi I get this bug in my log whenever I start qemu-kvm - I do not use kqemu module - so it's with plain kernel modules. If more details are needed - just ask. (Cpu; C2D) Bye Zdenek BUG: sleeping function called from invalid context at kernel/rwsem.c:48 in_atomic():1, irqs_disabled():0 INFO: lockdep is turned off. Pid: 26600, comm: qemu-kvm Not tainted 2.6.25-rc1 #29 Call Trace: [<ffffffff81064873>] ? __debug_show_held_locks+0x23/0x30 [<ffffffff81036765>] __might_sleep+0xe5/0x110 [<ffffffff812f21b0>] down_write+0x20/0x70 [<ffffffff88271a3c>] :kvm_intel:vmx_create_vcpu+0x48c/0x61c [<ffffffff810b5d92>] ? fd_install+0x52/0x60 [<ffffffff8824edce>] :kvm:kvm_arch_vcpu_create+0xe/0x10 [<ffffffff8824dca2>] :kvm:kvm_vm_ioctl+0x122/0x220 [<ffffffff8824c770>] ? :kvm:kvm_dev_ioctl+0x80/0x1c0 [<ffffffff810c67b1>] vfs_ioctl+0x31/0xa0 [<ffffffff810c6aa3>] do_vfs_ioctl+0x283/0x2f0 [<ffffffff810c6ba9>] sys_ioctl+0x99/0xa0 [<ffffffff8100c8ae>] tracesys+0xdc/0xe1 SIPI to vcpu 1 vector 0x10 Ignoring de-assert INIT to vcpu 1 SIPI to vcpu 1 vector 0x06 SIPI to vcpu 1 vector 0x06 kvm: emulating exchange as write ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Qemu & KVM bug 2008-02-13 14:38 Qemu & KVM bug Zdenek Kabelac @ 2008-02-13 15:24 ` Jiri Kosina 2008-02-13 16:09 ` Marcelo Tosatti 0 siblings, 1 reply; 5+ messages in thread From: Jiri Kosina @ 2008-02-13 15:24 UTC (permalink / raw) To: Zdenek Kabelac; +Cc: linux-kernel, Marcelo Tosatti On Wed, 13 Feb 2008, Zdenek Kabelac wrote: > I get this bug in my log whenever I start qemu-kvm - I do not use kqemu > module - so it's with plain kernel modules. If more details are needed - > just ask. (Cpu; C2D) > BUG: sleeping function called from invalid context at kernel/rwsem.c:48 > in_atomic():1, irqs_disabled():0 > INFO: lockdep is turned off. > Pid: 26600, comm: qemu-kvm Not tainted 2.6.25-rc1 #29 This has been obviously caused by Marcelo's (added to CC) commit 10589a4699b, which added down_write(mmap_sem) to alloc_apic_access_page(), which is called with preempt disabled from vmx_create_vcpu(). -- Jiri Kosina SUSE Labs ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Qemu & KVM bug 2008-02-13 15:24 ` Jiri Kosina @ 2008-02-13 16:09 ` Marcelo Tosatti 2008-02-13 16:38 ` Zdenek Kabelac 2008-02-13 16:57 ` Avi Kivity 0 siblings, 2 replies; 5+ messages in thread From: Marcelo Tosatti @ 2008-02-13 16:09 UTC (permalink / raw) To: Jiri Kosina, Avi Kivity; +Cc: Zdenek Kabelac, linux-kernel On Wed, Feb 13, 2008 at 04:24:53PM +0100, Jiri Kosina wrote: > On Wed, 13 Feb 2008, Zdenek Kabelac wrote: > > > I get this bug in my log whenever I start qemu-kvm - I do not use kqemu > > module - so it's with plain kernel modules. If more details are needed - > > just ask. (Cpu; C2D) > > BUG: sleeping function called from invalid context at kernel/rwsem.c:48 > > in_atomic():1, irqs_disabled():0 > > INFO: lockdep is turned off. > > Pid: 26600, comm: qemu-kvm Not tainted 2.6.25-rc1 #29 > > This has been obviously caused by Marcelo's (added to CC) commit > 10589a4699b, which added down_write(mmap_sem) to alloc_apic_access_page(), > which is called with preempt disabled from vmx_create_vcpu(). alloc_apic_access_page() called mutex_lock, so the warning would trigger before that change. I think it's fine to allocate the APIC page after put_cpu(), since no vcpu state is required. Avi? --- linux-2.6.orig/arch/x86/kvm/vmx.c +++ linux-2.6/arch/x86/kvm/vmx.c @@ -1601,9 +1601,6 @@ static int vmx_vcpu_setup(struct vcpu_vm vmcs_writel(CR0_GUEST_HOST_MASK, ~0UL); vmcs_writel(CR4_GUEST_HOST_MASK, KVM_GUEST_CR4_MASK); - if (vm_need_virtualize_apic_accesses(vmx->vcpu.kvm)) - if (alloc_apic_access_page(vmx->vcpu.kvm) != 0) - return -ENOMEM; return 0; } @@ -2533,6 +2530,9 @@ static struct kvm_vcpu *vmx_create_vcpu( put_cpu(); if (err) goto free_vmcs; + if (vm_need_virtualize_apic_accesses(kvm)) + if (alloc_apic_access_page(kvm) != 0) + goto free_vmcs; return &vmx->vcpu; ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Qemu & KVM bug 2008-02-13 16:09 ` Marcelo Tosatti @ 2008-02-13 16:38 ` Zdenek Kabelac 2008-02-13 16:57 ` Avi Kivity 1 sibling, 0 replies; 5+ messages in thread From: Zdenek Kabelac @ 2008-02-13 16:38 UTC (permalink / raw) To: Marcelo Tosatti; +Cc: Jiri Kosina, Avi Kivity, linux-kernel 2008/2/13, Marcelo Tosatti <marcelo@kvack.org>: > On Wed, Feb 13, 2008 at 04:24:53PM +0100, Jiri Kosina wrote: > > On Wed, 13 Feb 2008, Zdenek Kabelac wrote: > > > > > I get this bug in my log whenever I start qemu-kvm - I do not use kqemu > > > module - so it's with plain kernel modules. If more details are needed - > > > just ask. (Cpu; C2D) > > > BUG: sleeping function called from invalid context at kernel/rwsem.c:48 > > > in_atomic():1, irqs_disabled():0 > > > INFO: lockdep is turned off. > > > Pid: 26600, comm: qemu-kvm Not tainted 2.6.25-rc1 #29 > > > > This has been obviously caused by Marcelo's (added to CC) commit > > 10589a4699b, which added down_write(mmap_sem) to alloc_apic_access_page(), > > which is called with preempt disabled from vmx_create_vcpu(). > > alloc_apic_access_page() called mutex_lock, so the warning would trigger > before that change. > > I think it's fine to allocate the APIC page after put_cpu(), since no vcpu > state is required. > > Avi? > > > --- linux-2.6.orig/arch/x86/kvm/vmx.c > +++ linux-2.6/arch/x86/kvm/vmx.c > @@ -1601,9 +1601,6 @@ static int vmx_vcpu_setup(struct vcpu_vm Hi I've checked the patch myself - and looks like there is no BUG message now - nice thanks. Zdenek ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Qemu & KVM bug 2008-02-13 16:09 ` Marcelo Tosatti 2008-02-13 16:38 ` Zdenek Kabelac @ 2008-02-13 16:57 ` Avi Kivity 1 sibling, 0 replies; 5+ messages in thread From: Avi Kivity @ 2008-02-13 16:57 UTC (permalink / raw) To: Marcelo Tosatti; +Cc: Jiri Kosina, Zdenek Kabelac, linux-kernel Marcelo Tosatti wrote: > On Wed, Feb 13, 2008 at 04:24:53PM +0100, Jiri Kosina wrote: > >> On Wed, 13 Feb 2008, Zdenek Kabelac wrote: >> >> >>> I get this bug in my log whenever I start qemu-kvm - I do not use kqemu >>> module - so it's with plain kernel modules. If more details are needed - >>> just ask. (Cpu; C2D) >>> BUG: sleeping function called from invalid context at kernel/rwsem.c:48 >>> in_atomic():1, irqs_disabled():0 >>> INFO: lockdep is turned off. >>> Pid: 26600, comm: qemu-kvm Not tainted 2.6.25-rc1 #29 >>> >> This has been obviously caused by Marcelo's (added to CC) commit >> 10589a4699b, which added down_write(mmap_sem) to alloc_apic_access_page(), >> which is called with preempt disabled from vmx_create_vcpu(). >> > > alloc_apic_access_page() called mutex_lock, so the warning would trigger > before that change. > > I think it's fine to allocate the APIC page after put_cpu(), since no vcpu > state is required. > > Looks right, but wants a changelog and signoff, of course. -- Any sufficiently difficult bug is indistinguishable from a feature. ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-02-13 16:58 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2008-02-13 14:38 Qemu & KVM bug Zdenek Kabelac 2008-02-13 15:24 ` Jiri Kosina 2008-02-13 16:09 ` Marcelo Tosatti 2008-02-13 16:38 ` Zdenek Kabelac 2008-02-13 16:57 ` Avi Kivity
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox