On Thu, Aug 08, 2019 at 07:30:50PM +0200, Vitaly Kuznetsov wrote: > Regardless of whether or not nested_svm_vmrun_msrpm() fails, we return 1 > from vmrun_interception() so there's no point in doing goto. Also, > nested_svm_vmrun_msrpm() call can be made from nested_svm_vmrun() where > other nested launch issues are handled. > > Suggested-by: Sean Christopherson <sean.j.christopherson@xxxxxxxxx> > Signed-off-by: Vitaly Kuznetsov <vkuznets@xxxxxxxxxx> > --- > arch/x86/kvm/svm.c | 23 +++++++++-------------- > 1 file changed, 9 insertions(+), 14 deletions(-) > > diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c > index 6d16d1898810..43bc4a5e4948 100644 > --- a/arch/x86/kvm/svm.c > +++ b/arch/x86/kvm/svm.c > @@ -3658,6 +3658,15 @@ static bool nested_svm_vmrun(struct vcpu_svm *svm) > > enter_svm_guest_mode(svm, vmcb_gpa, nested_vmcb, &map); > > + if (!nested_svm_vmrun_msrpm(svm)) { > + svm->vmcb->control.exit_code = SVM_EXIT_ERR; > + svm->vmcb->control.exit_code_hi = 0; > + svm->vmcb->control.exit_info_1 = 0; > + svm->vmcb->control.exit_info_2 = 0; > + > + nested_svm_vmexit(svm); > + } > + > return true; nested_svm_vmrun() no longer needs a return value, it just needs to return early. But making it 'void' just to change it to 'int' in the next patch is a bit gratuitous, so what about changing it to return an 'int' in this patch? That'd also eliminate the funky if (!nested_svm_vmrun(svm)) return 1; return 1; chunk in vmrun_interception() that temporarily exists until patch 7/7. > } > > @@ -3740,20 +3749,6 @@ static int vmrun_interception(struct vcpu_svm *svm) > if (!nested_svm_vmrun(svm)) > return 1; > > - if (!nested_svm_vmrun_msrpm(svm)) > - goto failed; > - > - return 1; > - > -failed: > - > - svm->vmcb->control.exit_code = SVM_EXIT_ERR; > - svm->vmcb->control.exit_code_hi = 0; > - svm->vmcb->control.exit_info_1 = 0; > - svm->vmcb->control.exit_info_2 = 0; > - > - nested_svm_vmexit(svm); > - > return 1; > } > > -- > 2.20.1 >