Skip to contentSkip to conversation

KVM: move slots_lock acquision down to vapic_exit (resend)

PATCH Marcelo Tosatti 1 participant 1 message Jun 25, 2008

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

There is no need to grab slots_lock if the vapic_page will not be touched.

arch/x86/kvm/x86.c +2 -2
index 26b051b..29e8983 100644
@@ -2759,8 +2759,10 @@ static void vapic_exit(struct kvm_vcpu *vcpu)
 	if (!apic || !apic->vapic_addr)
 		return;
 
+	down_read(&vcpu->kvm->slots_lock);
 	kvm_release_page_dirty(apic->vapic_page);
 	mark_page_dirty(vcpu->kvm, apic->vapic_addr >> PAGE_SHIFT);
+	up_read(&vcpu->kvm->slots_lock);
 }
 
 static int __vcpu_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
@@ -2916,9 +2918,7 @@ out:
 
 	post_kvm_run_save(vcpu, kvm_run);
 
-	down_read(&vcpu->kvm->slots_lock);
 	vapic_exit(vcpu);
-	up_read(&vcpu->kvm->slots_lock);
 
 	return r;
 }