All of lore.kernel.org
 help / color / mirror / Atom feed
From: Krish Sadhukhan <krish.sadhukhan@oracle.com>
To: Sean Christopherson <seanjc@google.com>
Cc: kvm@vger.kernel.org, pbonzini@redhat.com, jmattson@google.com
Subject: Re: [PATCH 2/4 v2] KVM: nVMX: nSVM: 'nested_run' should count guest-entry attempts that make it to guest code
Date: Thu, 20 May 2021 10:58:23 -0700	[thread overview]
Message-ID: <b5e44a57-b2ba-7583-9293-9515c8d9a5d6@oracle.com> (raw)
In-Reply-To: <YKZ3115oZOB7eH5d@google.com>


On 5/20/21 7:53 AM, Sean Christopherson wrote:
> On Wed, May 19, 2021, Krish Sadhukhan wrote:
>> Currently, the 'nested_run' statistic counts all guest-entry attempts,
>> including those that fail during vmentry checks on Intel and during
>> consistency checks on AMD. Convert this statistic to count only those
>> guest-entries that make it past these state checks and make it to guest
>> code. This will tell us the number of guest-entries that actually executed
>> or tried to execute guest code.
>>
>> Also, rename this statistic to 'nested_runs' since it is a count.
>>
>> Signed-off-by: Krish Sadhukhan <Krish.Sadhukhan@oracle.com>
>> Suggested-by: Sean Christopherson <seanjc@google.com>
> I didn't suggest this, or at least I didn't intend to.


The idea behind my v1 patch was actually to eliminate failed attempts of 
vmentry but of course I didn't place the counter in the right location. 
In v2, I placed it based on your suggestion.

So, the burden of the intention to count only successful vmentries still 
falls on me 😁.

>   My point was that _if_
> we want stat.nested_run to count successful VM-Enter then the counter should be
> bumped only after VM-Enter succeeds.  I did not mean to say that we should
> actually do this.  As Dongli pointed out[*], there is value in tracking attempts,
> and I still don't understand _why_ we care about only counting successful
> VM-Enters.


If we count all attempts, failed and successful, the counter won't tell 
us if any failed and how many. On the other hand, if we count only 
successful attempts, we won't know if there were any failed attempts. 
Both ways we miss potentially valuable data, but unless the count of 
failures is greatly useful we just count attempts that actually ended up 
executing a nested guest.

The other alternative is to provide two counters, 'nested_run_attempts' 
to count all attempts and 'nested_runs' to count only successful ones.

>
> FWIW, this misses the case where L1 enters L2 in an inactive state.
>
> [*] ed4a8dae-be99-0d88-a8dd-510afe7cb956@oracle.com

  reply	other threads:[~2021-05-20 17:58 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
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 [this message]
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=b5e44a57-b2ba-7583-9293-9515c8d9a5d6@oracle.com \
    --to=krish.sadhukhan@oracle.com \
    --cc=jmattson@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=seanjc@google.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.