From: David Woodhouse <dwmw2@infradead.org>
To: Vitaly Kuznetsov <vkuznets@redhat.com>,
Sean Christopherson <seanjc@google.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Thomas Gleixner <tglx@kernel.org>,
John Stultz <jstultz@google.com>,
Michael Kelley <mhklinux@outlook.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>,
"Christopher S. Hall" <christopher.s.hall@intel.com>,
Stephen Boyd <sboyd@kernel.org>,
Miroslav Lichvar <mlichvar@redhat.com>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
"H. Peter Anvin" <hpa@zytor.com>,
"K. Y. Srinivasan" <kys@microsoft.com>,
Haiyang Zhang <haiyangz@microsoft.com>,
Wei Liu <wei.liu@kernel.org>, Dexuan Cui <decui@microsoft.com>,
Daniel Lezcano <daniel.lezcano@kernel.org>,
kvm@vger.kernel.org, linux-hyperv@vger.kernel.org,
x86@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC] KVM/x86: Killing kvm_get_time_and_clockread() in favour of ktime_get_snapshot()
Date: Wed, 27 May 2026 09:42:49 +0100 [thread overview]
Message-ID: <be5f16f0dabb4240d7d99326aee8e956f6a0dc7e.camel@infradead.org> (raw)
In-Reply-To: <87zf1ljluq.fsf@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1454 bytes --]
On Wed, 2026-05-27 at 10:30 +0200, Vitaly Kuznetsov wrote:
> David Woodhouse <dwmw2@infradead.org> writes:
>
> ...
>
> >
> > Then in 2018, Vitaly Kuznetsov added Hyper-V TSC page support in
> > commit b0c39dc68e3b ("x86/kvm: Pass stable clocksource to guests when
> > running nested on Hyper-V"), which extended vgettsc() to handle the
> > HVCLOCK case.
> >
> > I'd quite like to kill it all with fire and make KVM use
> > ktime_get_snapshot() instead.
>
> The main motivation is reducing the complexity of KVM's timekeeping code
> I guess?
Reduce the complexity, and clean it up to use the core kernel snapshot
facility as $DEITY intended, yes.
> The statement "TSC isn't reliable" deserves a book of its own :-)
... deserves a whole wing in a rehab facility...
Thanks for the clarification.
> > One simple option that occurs to me would be to add a 'cycles_raw'
> > value to the system_time_snapshot, for PV clocksources like hyperv and
> > kvmclock to populate with the original TSC reading.
>
> Personally, I don't see this as such an ugly hack.
Yeah, having thrown that together last night to see what it looks like,
I'm not all that unhappy with it. And it does indeed let me provide
precise vmclock paired time when the clocksource is kvmclock, too.
There are probably some details to tweak, and I'm sure Thomas will call
me a moron again, but I think it's worth it for the resulting cleanup
:)
[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5069 bytes --]
next prev parent reply other threads:[~2026-05-27 8:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-26 13:57 David Woodhouse
2026-05-26 23:04 ` David Woodhouse
2026-05-27 8:30 ` Vitaly Kuznetsov
2026-05-27 8:42 ` David Woodhouse [this message]
2026-05-27 8:49 ` Paolo Bonzini
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=be5f16f0dabb4240d7d99326aee8e956f6a0dc7e.camel@infradead.org \
--to=dwmw2@infradead.org \
--cc=bp@alien8.de \
--cc=christopher.s.hall@intel.com \
--cc=daniel.lezcano@kernel.org \
--cc=dave.hansen@linux.intel.com \
--cc=decui@microsoft.com \
--cc=haiyangz@microsoft.com \
--cc=hpa@zytor.com \
--cc=jstultz@google.com \
--cc=kvm@vger.kernel.org \
--cc=kys@microsoft.com \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mhklinux@outlook.com \
--cc=mingo@redhat.com \
--cc=mlichvar@redhat.com \
--cc=mtosatti@redhat.com \
--cc=pbonzini@redhat.com \
--cc=sboyd@kernel.org \
--cc=seanjc@google.com \
--cc=tglx@kernel.org \
--cc=vkuznets@redhat.com \
--cc=wei.liu@kernel.org \
--cc=x86@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
all inboxes | Powered by JetHome®