KVM: SVM: Move svm_complete_interrupts() into svm_vcpu_run()
PATCH 2/3 KVM: SVM: Move svm_complete_interrupts() into svm_vcpu_run()
From: Wanpeng Li <[email protected]>
Moving svm_complete_interrupts() into svm_vcpu_run() which can align VMX and SVM with respect to completing interrupts.
--- arch/x86/kvm/svm/svm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/kvm/svm/svm.c +2 -2
@@ -2938,8 +2938,6 @@ static int handle_exit(struct kvm_vcpu *vcpu, fastpath_t exit_fastpath)if (npt_enabled) vcpu->arch.cr3 = svm->vmcb->save.cr3; -svm_complete_interrupts (svm); -if (is_guest_mode (vcpu)) {int vmexit;
@@ -3530,6 +3528,8 @@ static __no_kcsan fastpath_t svm_vcpu_run(struct kvm_vcpu *vcpu) SVM_EXIT_EXCP_BASE + MC_VECTOR))svm_handle_mce (svm); +svm_complete_interrupts (svm); +vmcb_mark_all_clean (svm->vmcb);return exit_fastpath; }
Signature · 1 line
2.7.4
Quoted 26 lines · Wanpeng Li
From: Wanpeng Li <[email protected]>
Moving
svm_complete_interrupts()intosvm_vcpu_run()which can align VMX and SVM with respect to completing interrupts.Suggested-by Sean Christopherson <[email protected]>Cc Paul K. <[email protected]>Signed-off-by Wanpeng Li <[email protected]>--- arch/x86/kvm/svm/svm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)arch/x86/kvm/svm/svm.c +0
-2@@ -2938,8 +2938,6 @@ static int handle_exit(struct kvm_vcpu *vcpu, fastpath_t exit_fastpath)if (npt_enabled) vcpu->arch.cr3 = svm->vmcb->save.cr3; -svm_complete_interrupts (svm); -if (is_guest_mode (vcpu)) {int vmexit;
arch/x86/kvm/svm/svm.c static __no_kcsan fastpath_t svm_vcpu_run(struct kvm_vcpu *vcpu) · line 3535
Quoted 8 lines
arch/x86/kvm/svm/svm.c +2
-0@@ -3530,6 +3528,8 @@ static __no_kcsan fastpath_t svm_vcpu_run(struct kvm_vcpu *vcpu) SVM_EXIT_EXCP_BASE + MC_VECTOR))svm_handle_mce (svm); +svm_complete_interrupts (svm); +vmcb_mark_all_clean (svm->vmcb);return exit_fastpath; }
This seems to be the right thing to do, however, the amount of code between kvm_x86_ops.run() and kvm_x86_ops.handle_exit() is non-trivial, hope it won't blow up in testing...
One more thing:
VMX version does
vmx_complete_interrupts(vmx);
if (is_guest_mode(vcpu))
return EXIT_FASTPATH_NONE;and on SVM we analyze is_guest_mode() inside svm_exit_handlers_fastpath() - should we also change that for conformity?
Signature · 1 line
Vitaly
Quoted 48 lines · Vitaly Kuznetsov
Quoted 26 lines · Wanpeng Li
From: Wanpeng Li <[email protected]>
Moving
svm_complete_interrupts()intosvm_vcpu_run()which can align VMX and SVM with respect to completing interrupts.Suggested-by Sean Christopherson <[email protected]>Cc Paul K. <[email protected]>Signed-off-by Wanpeng Li <[email protected]>--- arch/x86/kvm/svm/svm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)arch/x86/kvm/svm/svm.c +0
-2@@ -2938,8 +2938,6 @@ static int handle_exit(struct kvm_vcpu *vcpu, fastpath_t exit_fastpath)if (npt_enabled) vcpu->arch.cr3 = svm->vmcb->save.cr3; -svm_complete_interrupts (svm); -if (is_guest_mode (vcpu)) {int vmexit;arch/x86/kvm/svm/svm.c static __no_kcsan fastpath_t svm_vcpu_run(struct kvm_vcpu *vcpu) · line 3535
Quoted 8 lines
arch/x86/kvm/svm/svm.c +2
-0@@ -3530,6 +3528,8 @@ static __no_kcsan fastpath_t svm_vcpu_run(struct kvm_vcpu *vcpu) SVM_EXIT_EXCP_BASE + MC_VECTOR))svm_handle_mce (svm); +svm_complete_interrupts (svm); +vmcb_mark_all_clean (svm->vmcb);return exit_fastpath; }This seems to be the right thing to do, however, the amount of code between
kvm_x86_ops.run()andkvm_x86_ops.handle_exit()is non-trivial, hope it won't blow up in testing...Reviewed-by Vitaly Kuznetsov <[email protected]>One more thing:
VMX version does
Quoted 7 lines
vmx_complete_interrupts(vmx); if (is_guest_mode(vcpu)) return EXIT_FASTPATH_NONE;and on SVM we analyze
is_guest_mode()insidesvm_exit_handlers_fastpath()- should we also change that for conformity?
Agreed, will do in v2.
Wanpeng
Paolo Bonzini
maintainerQuoted 8 lines · Wanpeng Li
Quoted 8 lines
One more thing:
VMX version does
vmx_complete_interrupts(vmx); if (is_guest_mode(vcpu)) return EXIT_FASTPATH_NONE;
Quoted 5 lines
Quoted 3 lines
and on SVM we analyze
is_guest_mode()insidesvm_exit_handlers_fastpath()- should we also change that for conformity?Agreed, will do in v2.
Please just send an incremental patch. Thanks!
Paolo
Quoted 10 lines · Paolo Bonzini
Quoted 8 lines · Wanpeng Li
Quoted 8 lines
One more thing:
VMX version does
vmx_complete_interrupts(vmx); if (is_guest_mode(vcpu)) return EXIT_FASTPATH_NONE;
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
and on SVM we analyze
is_guest_mode()insidesvm_exit_handlers_fastpath()- should we also change that for conformity?Agreed, will do in v2.
Please just send an incremental patch. Thanks!
Just sent out a patch to do it. :)
Wanpeng