Sean Christopherson <seanjc@xxxxxxxxxx> writes:
On Tue, Mar 21, 2023, Colton Lewis wrote:
Vipin Sharma <vipinsh@xxxxxxxxxx> writes:
> On Thu, Mar 16, 2023 at 3:29 PM Colton Lewis <coltonlewis@xxxxxxxxxx>
> 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.
Thanks for the confirmation.
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"?
Yes it can.