kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Krish Sadhukhan <krish.sadhukhan@oracle.com>
Cc: kvm@vger.kernel.org, pbonzini@redhat.com, jmattson@google.com
Subject: Re: [PATCH 1/4 v2] KVM: nVMX: Reset 'nested_run_pending' only in guest mode
Date: Thu, 20 May 2021 15:00:36 +0000	[thread overview]
Message-ID: <YKZ5lNpbA7ck+/of@google.com> (raw)
In-Reply-To: <20210520005012.68377-2-krish.sadhukhan@oracle.com>

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@oracle.com>
> ---
>  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
> 

  reply	other threads:[~2021-05-20 15:00 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-20  0:50 [PATCH 0/4 v2] KVM: nVMX: nSVM: Add more statistics to KVM debugfs Krish Sadhukhan
2021-05-20  0:50 ` [PATCH 1/4 v2] KVM: nVMX: Reset 'nested_run_pending' only in guest mode Krish Sadhukhan
2021-05-20 15:00   ` Sean Christopherson [this message]
2021-05-20  0:50 ` [PATCH 2/4 v2] KVM: nVMX: nSVM: 'nested_run' should count guest-entry attempts that make it to guest code Krish Sadhukhan
2021-05-20 14:53   ` Sean Christopherson
2021-05-20 17:58     ` Krish Sadhukhan
2021-05-20  0:50 ` [PATCH 3/4 v2] KVM: nVMX: nSVM: Add a new debugfs statistic to show how many VCPUs have run nested guests Krish Sadhukhan
2021-05-20 14:56   ` Sean Christopherson
2021-05-20 16:57     ` Jim Mattson
2021-05-20 18:01       ` Krish Sadhukhan
2021-05-20  0:50 ` [PATCH 4/4 v2] KVM: x86: Add a new VM statistic to show number of VCPUs created in a given VM Krish Sadhukhan
2021-05-20 15:04   ` Sean Christopherson
2021-05-21 18:06     ` Krish Sadhukhan
2021-05-27 17:46       ` Sean Christopherson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YKZ5lNpbA7ck+/of@google.com \
    --to=seanjc@google.com \
    --cc=jmattson@google.com \
    --cc=krish.sadhukhan@oracle.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).