Skip to contentSkip to conversation

KVM: VMX: vmx_set_cr0 expects kvm->srcu locked

PATCH Applied Marcelo Tosatti 2 participants 2 messages Mar 27, 2012 – Mar 28, 2012

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

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

arch/x86/kvm/vmx.c +2 -0
index 2c22fc7..a8e3a53 100644
@@ -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);
Applied
#1 lore raw
Quoted 3 lines · Marcelo Tosatti

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

Thanks, applied.

Signature · 1 line
error compiling committee.c: too many arguments to function