From: Sean Christopherson <seanjc@google.com>
To: Dongli Zhang <dongli.zhang@oracle.com>
Cc: Andrew Jones <ajones@ventanamicro.com>,
kvm@vger.kernel.org, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org, pbonzini@redhat.com,
shuah@kernel.org, dwmw2@infradead.org, joe.jin@oracle.com
Subject: Re: [PATCH 1/1] selftests: KVM: add test to print boottime wallclock
Date: Fri, 20 Oct 2023 08:22:20 -0700 [thread overview]
Message-ID: <ZTKbLKK0icwUZvlB@google.com> (raw)
In-Reply-To: <bbddbf1f-33c1-cdae-9e0a-a05403bf44bd@oracle.com>
On Fri, Oct 20, 2023, Dongli Zhang wrote:
> Hi Sean and Andrew,
>
> On 10/18/23 23:51, Andrew Jones wrote:
> > On Wed, Oct 18, 2023 at 12:51:55PM -0700, Sean Christopherson wrote:
> >> On Fri, Oct 06, 2023, Dongli Zhang wrote:
> >>> As inspired by the discussion in [1], the boottime wallclock may drift due
> >>> to the fact that the masterclock (or host monotonic clock) and kvmclock are
> >>> calculated based on the algorithms in different domains.
> >>>
> >>> This is to introduce a testcase to print the boottime wallclock
> >>> periodically to help diagnose the wallclock drift issue in the future.
> >>>
> >>> The idea is to wrmsr the MSR_KVM_WALL_CLOCK_NEW, and read the boottime
> >>> wallclock nanoseconds immediately.
> >>
> >> This doesn't actually test anything of interest though. IIUC, it requires a human
> >> looking at the output for it to provide any value. And it requires a manual
> >> cancelation, which makes it even less suitable for selftests.
> >>
> >> I like the idea, e.g. I bet there are more utilities that could be written that
> >> utilize the selftests infrastructure, just not sure what to do with this (assuming
> >> it can't be massaged into an actual test).
>
> Thank you very much for the suggestion.
>
> Would that work if I turn it into a test:
>
> 1. Capture boottime_wallclock_01.
> 2. Wait for 10-second by default (configurable, e.g., max 60-second)
> 3. Capture boottime_wallclock_02.
> 4. Report error if drift.
Rather than pick an arbitrary time of 10 seconds, deliberately introduce a
plausible bug in KVM (or re-introduce a previous bug) and see how low you can
push the wait time while still reliably detecting the unwanted drift. Then add
a reasonable buffer to give the test some margin for error. Given the drift that
David reported with the xen_shinfo test, I assume/hope that a 10 second runtime
would be overkill.
I would also differentiate between total runtime and the periodic check time,
e.g. to allow checking for drift every N (milli)seconds while having a total
runtime of M seconds. Then there's no need to set an upper bound, e.g. the user
could set the test to run in the background for multiple hours without having to
worry about the test being useless if it's canceled early.
prev parent reply other threads:[~2023-10-20 15:22 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-06 17:57 [PATCH 1/1] selftests: KVM: add test to print boottime wallclock Dongli Zhang
2023-10-10 16:13 ` Maxim Levitsky
2023-10-10 16:31 ` Dongli Zhang
2023-10-11 18:46 ` Maxim Levitsky
2023-10-18 19:51 ` Sean Christopherson
2023-10-19 6:51 ` Andrew Jones
2023-10-20 14:39 ` Dongli Zhang
2023-10-20 15:21 ` David Woodhouse
2023-10-20 15:22 ` Sean Christopherson [this message]
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=ZTKbLKK0icwUZvlB@google.com \
--to=seanjc@google.com \
--cc=ajones@ventanamicro.com \
--cc=dongli.zhang@oracle.com \
--cc=dwmw2@infradead.org \
--cc=joe.jin@oracle.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=shuah@kernel.org \
/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