All of lore.kernel.org
 help / color / mirror / Atom feed
* KVM: VMX: vmx_set_cr0 expects kvm->srcu locked
@ 2012-03-27 22:47 Marcelo Tosatti
  2012-03-28  9:43 ` Avi Kivity
  0 siblings, 1 reply; 2+ messages in thread
From: Marcelo Tosatti @ 2012-03-27 22:47 UTC (permalink / raw)
  To: kvm; +Cc: Avi Kivity


vmx_set_cr0 is called from vcpu run context, therefore it expects
kvm->srcu to be held.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>

diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 2c22fc7..a8e3a53 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -3906,7 +3906,9 @@ static int vmx_vcpu_reset(struct kvm_vcpu *vcpu)
 		vmcs_write16(VIRTUAL_PROCESSOR_ID, vmx->vpid);
 
 	vmx->vcpu.arch.cr0 = X86_CR0_NW | X86_CR0_CD | X86_CR0_ET;
+	vcpu->srcu_idx = srcu_read_lock(&vcpu->kvm->srcu);
 	vmx_set_cr0(&vmx->vcpu, kvm_read_cr0(vcpu)); /* enter rmode */
+	srcu_read_unlock(&vcpu->kvm->srcu, vcpu->srcu_idx);
 	vmx_set_cr4(&vmx->vcpu, 0);
 	vmx_set_efer(&vmx->vcpu, 0);
 	vmx_fpu_activate(&vmx->vcpu);

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: KVM: VMX: vmx_set_cr0 expects kvm->srcu locked
  2012-03-27 22:47 KVM: VMX: vmx_set_cr0 expects kvm->srcu locked Marcelo Tosatti
@ 2012-03-28  9:43 ` Avi Kivity
  0 siblings, 0 replies; 2+ messages in thread
From: Avi Kivity @ 2012-03-28  9:43 UTC (permalink / raw)
  To: Marcelo Tosatti; +Cc: kvm

On 03/28/2012 12:47 AM, Marcelo Tosatti wrote:
> vmx_set_cr0 is called from vcpu run context, therefore it expects
> kvm->srcu to be held.
>

Thanks, applied.

-- 
error compiling committee.c: too many arguments to function


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-03-28  9:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-27 22:47 KVM: VMX: vmx_set_cr0 expects kvm->srcu locked Marcelo Tosatti
2012-03-28  9:43 ` Avi Kivity

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.