On Wed, May 19, 2021, Krish Sadhukhan wrote: > Currently, vmx_vcpu_run() resets 'nested_run_pending' irrespective of whether > it is in guest mode. 'nested_run_pending' matters only to guest mode and > hence reset it only in guest mode. > > Signed-off-by: Krish Sadhukhan <Krish.Sadhukhan@xxxxxxxxxx> > --- > arch/x86/kvm/vmx/vmx.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c > index f2fd447eed45..af2be5930ba4 100644 > --- a/arch/x86/kvm/vmx/vmx.c > +++ b/arch/x86/kvm/vmx/vmx.c > @@ -6839,7 +6839,9 @@ static fastpath_t vmx_vcpu_run(struct kvm_vcpu *vcpu) > > kvm_load_host_xsave_state(vcpu); > > - vmx->nested.nested_run_pending = 0; > + if (is_guest_mode(vcpu)) > + vmx->nested.nested_run_pending = 0; This patch does not stand on its own, checking is_guest_mode() is likely more expensive than unconditionally clearing the flag. If we end up with conditional stats code then I've no objection to clearing this conditionally, but that can be done opportunstically. Also, the check should be against vmx->nested.nested_run_pending itself, not against is_guest_mode(). E.g. the stats patch adds a check on that, too. > + > vmx->idt_vectoring_info = 0; > > if (unlikely(vmx->fail)) { > -- > 2.27.0 >