* kvm_set_shared_msr using smp_processor_id() in preemptible code @ 2012-04-18 2:58 Dave Jones 2012-04-18 12:03 ` [PATCH 3.4-rc] KVM: VMX: Fix kvm_set_shared_msr() called in preemptible context Avi Kivity 0 siblings, 1 reply; 3+ messages in thread From: Dave Jones @ 2012-04-18 2:58 UTC (permalink / raw) To: Linux Kernel; +Cc: avi I see a bunch of these when I start a kvm guest using Linus' current tree. Dave BUG: using smp_processor_id() in preemptible [00000000] code: qemu-kvm/22713 caller is kvm_set_shared_msr+0x32/0xa0 [kvm] Pid: 22713, comm: qemu-kvm Not tainted 3.4.0-rc3+ #39 Call Trace: [<ffffffff8131fa82>] debug_smp_processor_id+0xe2/0x100 [<ffffffffa0328ae2>] kvm_set_shared_msr+0x32/0xa0 [kvm] [<ffffffffa03a103b>] vmx_set_msr+0x28b/0x2d0 [kvm_intel] [<ffffffffa03a5f1a>] handle_wrmsr+0x4a/0x310 [kvm_intel] [<ffffffffa03a7638>] vmx_handle_exit+0xc8/0x6f0 [kvm_intel] [<ffffffffa03354f6>] kvm_arch_vcpu_ioctl_run+0x616/0x18c0 [kvm] [<ffffffffa0335445>] ? kvm_arch_vcpu_ioctl_run+0x565/0x18c0 [kvm] [<ffffffff8164dc47>] ? mutex_lock_nested+0x2c7/0x3c0 [<ffffffffa031b5ca>] ? vcpu_load+0x1a/0xb0 [kvm] [<ffffffffa031bb35>] kvm_vcpu_ioctl+0x465/0x780 [kvm] [<ffffffff81078ef9>] ? creds_are_invalid+0x29/0x60 [<ffffffff812aec85>] ? inode_has_perm+0x35/0xa0 [<ffffffff811ba5e8>] do_vfs_ioctl+0x98/0x570 [<ffffffff811bab51>] sys_ioctl+0x91/0xa0 [<ffffffff81659692>] system_call_fastpath+0x16/0x1b BUG: using smp_processor_id() in preemptible [00000000] code: qemu-kvm/22713 caller is user_return_notifier_register+0x2f/0x70 Pid: 22713, comm: qemu-kvm Not tainted 3.4.0-rc3+ #39 Call Trace: [<ffffffff8131fa82>] debug_smp_processor_id+0xe2/0x100 [<ffffffff81134eaf>] user_return_notifier_register+0x2f/0x70 [<ffffffffa0328b47>] kvm_set_shared_msr+0x97/0xa0 [kvm] [<ffffffffa03a103b>] vmx_set_msr+0x28b/0x2d0 [kvm_intel] [<ffffffffa03248e0>] ? kvm_enable_efer_bits+0x20/0x20 [kvm] [<ffffffffa03248f9>] do_set_msr+0x19/0x20 [kvm] [<ffffffffa032be51>] msr_io+0x101/0x220 [kvm] [<ffffffffa032bdcf>] ? msr_io+0x7f/0x220 [kvm] [<ffffffffa03307fa>] kvm_arch_vcpu_ioctl+0x30a/0x1030 [kvm] [<ffffffffa031b5ca>] ? vcpu_load+0x1a/0xb0 [kvm] [<ffffffffa03a1f45>] ? vmx_vcpu_load+0x35/0x1b0 [kvm_intel] [<ffffffff81083fe1>] ? get_parent_ip+0x11/0x50 [<ffffffff8165570d>] ? sub_preempt_count+0x9d/0xd0 [<ffffffffa031b77e>] kvm_vcpu_ioctl+0xae/0x780 [kvm] [<ffffffff81078ef9>] ? creds_are_invalid+0x29/0x60 [<ffffffff812aec85>] ? inode_has_perm+0x35/0xa0 [<ffffffff811ba5e8>] do_vfs_ioctl+0x98/0x570 [<ffffffff811bab51>] sys_ioctl+0x91/0xa0 [<ffffffff81659692>] system_call_fastpath+0x16/0x1b ^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 3.4-rc] KVM: VMX: Fix kvm_set_shared_msr() called in preemptible context 2012-04-18 2:58 kvm_set_shared_msr using smp_processor_id() in preemptible code Dave Jones @ 2012-04-18 12:03 ` Avi Kivity 2012-04-19 2:42 ` Marcelo Tosatti 0 siblings, 1 reply; 3+ messages in thread From: Avi Kivity @ 2012-04-18 12:03 UTC (permalink / raw) To: kvm, Marcelo Tosatti; +Cc: linux-kernel, davej kvm_set_shared_msr() may not be called in preemptible context, but vmx_set_msr() does so: BUG: using smp_processor_id() in preemptible [00000000] code: qemu-kvm/22713 caller is kvm_set_shared_msr+0x32/0xa0 [kvm] Pid: 22713, comm: qemu-kvm Not tainted 3.4.0-rc3+ #39 Call Trace: [<ffffffff8131fa82>] debug_smp_processor_id+0xe2/0x100 [<ffffffffa0328ae2>] kvm_set_shared_msr+0x32/0xa0 [kvm] [<ffffffffa03a103b>] vmx_set_msr+0x28b/0x2d0 [kvm_intel] ... Making kvm_set_shared_msr() work in preemptible is cleaner, but it's used in the fast path. Making two variants is overkill, so this patch just disables preemption around the call. Reported-by: Dave Jones <davej@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com> --- arch/x86/kvm/vmx.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index ad85adf..4ff0ab9 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -2210,9 +2210,12 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 data) msr = find_msr_entry(vmx, msr_index); if (msr) { msr->data = data; - if (msr - vmx->guest_msrs < vmx->save_nmsrs) + if (msr - vmx->guest_msrs < vmx->save_nmsrs) { + preempt_disable(); kvm_set_shared_msr(msr->index, msr->data, msr->mask); + preempt_enable(); + } break; } ret = kvm_set_msr_common(vcpu, msr_index, data); -- 1.7.10 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 3.4-rc] KVM: VMX: Fix kvm_set_shared_msr() called in preemptible context 2012-04-18 12:03 ` [PATCH 3.4-rc] KVM: VMX: Fix kvm_set_shared_msr() called in preemptible context Avi Kivity @ 2012-04-19 2:42 ` Marcelo Tosatti 0 siblings, 0 replies; 3+ messages in thread From: Marcelo Tosatti @ 2012-04-19 2:42 UTC (permalink / raw) To: Avi Kivity; +Cc: kvm, linux-kernel, davej On Wed, Apr 18, 2012 at 03:03:04PM +0300, Avi Kivity wrote: > kvm_set_shared_msr() may not be called in preemptible context, > but vmx_set_msr() does so: > > BUG: using smp_processor_id() in preemptible [00000000] code: qemu-kvm/22713 > caller is kvm_set_shared_msr+0x32/0xa0 [kvm] > Pid: 22713, comm: qemu-kvm Not tainted 3.4.0-rc3+ #39 > Call Trace: > [<ffffffff8131fa82>] debug_smp_processor_id+0xe2/0x100 > [<ffffffffa0328ae2>] kvm_set_shared_msr+0x32/0xa0 [kvm] > [<ffffffffa03a103b>] vmx_set_msr+0x28b/0x2d0 [kvm_intel] > ... > > Making kvm_set_shared_msr() work in preemptible is cleaner, but > it's used in the fast path. Making two variants is overkill, so > this patch just disables preemption around the call. > > Reported-by: Dave Jones <davej@redhat.com> > Signed-off-by: Avi Kivity <avi@redhat.com> > --- > arch/x86/kvm/vmx.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) Applied, thanks. ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-04-19 2:48 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2012-04-18 2:58 kvm_set_shared_msr using smp_processor_id() in preemptible code Dave Jones 2012-04-18 12:03 ` [PATCH 3.4-rc] KVM: VMX: Fix kvm_set_shared_msr() called in preemptible context Avi Kivity 2012-04-19 2:42 ` Marcelo Tosatti
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox