All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Colton Lewis <coltonlewis@google.com>
Cc: Vipin Sharma <vipinsh@google.com>,
	pbonzini@redhat.com, shuah@kernel.org, dmatlack@google.com,
	andrew.jones@linux.dev, maz@kernel.org, bgardon@google.com,
	ricarkol@google.com, oliver.upton@linux.dev, kvm@vger.kernel.org
Subject: Re: [PATCH v2 2/2] KVM: selftests: Print summary stats of memory latency distribution
Date: Tue, 21 Mar 2023 14:21:25 -0700	[thread overview]
Message-ID: <ZBof1SkJuo3wv3HW@google.com> (raw)
In-Reply-To: <gsntedphdip9.fsf@coltonlewis-kvm.c.googlers.com>

On Tue, Mar 21, 2023, Colton Lewis wrote:
> Vipin Sharma <vipinsh@google.com> writes:
> 
> > On Thu, Mar 16, 2023 at 3:29 PM Colton Lewis <coltonlewis@google.com>
> > wrote:
> > > +       pr_info("Latency distribution (ns) = min:%6.0lf,
> > > 50th:%6.0lf, 90th:%6.0lf, 99th:%6.0lf, max:%6.0lf\n",
> > > +               cycles_to_ns(vcpus[0], (double)host_latency_samples[0]),
> 
> > I am not much aware of how tsc is set up and used. Will all vCPUs have
> > the same tsc value? Can this change if vCPU gets scheduled to
> > different pCPU on the host?

FWIW, if this test were run on older CPUs, there would be potential divergence
across pCPUs that would then bleed into vCPUs to some extent.  Older CPUs tied
the TSC frequency to the core frequency, e.g. would change frequency depending
on the power/turbo state, and the TSC would even stop counting altogether at
certain C-states.  KVM does its best to adjust the guest's perception of the TSC,
but it can't be hidden completely.

But for what this test is trying to do, IMO there's zero reason to worry about
that.
 
> All vCPUs *in one VM* should have the same frequency. The alternative is
> probably possible but so weird I can't imagine a reason for doing it.

Somewhat related to Vipin's question, "host_latency_samples" is a confusing name.
It's easy to miss that "host_latency_samples" are actually samples collected in
the guest, and thus to think that this code will depend on which pCPU it runs on.

I don't see any reason for such a verbose name, e.g. can't it just be "samples"?

  reply	other threads:[~2023-03-21 21:21 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-16 22:27 [PATCH v2 0/2] Calculate memory access latency stats Colton Lewis
2023-03-16 22:27 ` [PATCH v2 1/2] KVM: selftests: Provide generic way to read system counter Colton Lewis
2023-03-17  9:26   ` Andrew Jones
2023-03-21 19:08     ` Colton Lewis
2023-03-17 17:04   ` Vipin Sharma
2023-03-21 19:09     ` Colton Lewis
2023-03-17 17:09   ` Marc Zyngier
2023-03-21 19:10     ` Colton Lewis
2023-03-28 10:09       ` Marc Zyngier
2023-03-28 15:38         ` Sean Christopherson
2023-03-28 15:50           ` Marc Zyngier
2023-03-28 21:51         ` Colton Lewis
2023-03-16 22:27 ` [PATCH v2 2/2] KVM: selftests: Print summary stats of memory latency distribution Colton Lewis
2023-03-17 18:16   ` Vipin Sharma
2023-03-21 19:10     ` Colton Lewis
2023-03-21 21:21       ` Sean Christopherson [this message]
2023-03-24 16:26         ` Colton Lewis

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=ZBof1SkJuo3wv3HW@google.com \
    --to=seanjc@google.com \
    --cc=andrew.jones@linux.dev \
    --cc=bgardon@google.com \
    --cc=coltonlewis@google.com \
    --cc=dmatlack@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=maz@kernel.org \
    --cc=oliver.upton@linux.dev \
    --cc=pbonzini@redhat.com \
    --cc=ricarkol@google.com \
    --cc=shuah@kernel.org \
    --cc=vipinsh@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.