From: David Woodhouse <dwmw2@infradead.org>
To: "Thomas Gleixner" <tglx@linutronix.de>,
"Thomas Weißschuh" <thomas.weissschuh@linutronix.de>,
"James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>,
"Helge Deller" <deller@gmx.de>,
"Andy Lutomirski" <luto@kernel.org>,
"Vincenzo Frascino" <vincenzo.frascino@arm.com>,
"Anna-Maria Behnsen" <anna-maria@linutronix.de>,
"Frederic Weisbecker" <frederic@kernel.org>,
"Andrew Morton" <akpm@linux-foundation.org>,
"Catalin Marinas" <catalin.marinas@arm.com>,
"Will Deacon" <will@kernel.org>, "Theodore Ts'o" <tytso@mit.edu>,
"Jason A. Donenfeld" <Jason@zx2c4.com>,
"Paul Walmsley" <paul.walmsley@sifive.com>,
"Palmer Dabbelt" <palmer@dabbelt.com>,
"Albert Ou" <aou@eecs.berkeley.edu>,
"Huacai Chen" <chenhuacai@kernel.org>,
"WANG Xuerui" <kernel@xen0n.name>,
"Russell King" <linux@armlinux.org.uk>,
"Heiko Carstens" <hca@linux.ibm.com>,
"Vasily Gorbik" <gor@linux.ibm.com>,
"Alexander Gordeev" <agordeev@linux.ibm.com>,
"Christian Borntraeger" <borntraeger@linux.ibm.com>,
"Sven Schnelle" <svens@linux.ibm.com>,
"Thomas Bogendoerfer" <tsbogend@alpha.franken.de>,
"Michael Ellerman" <mpe@ellerman.id.au>,
"Nicholas Piggin" <npiggin@gmail.com>,
"Christophe Leroy" <christophe.leroy@csgroup.eu>,
"Naveen N Rao" <naveen@kernel.org>,
"Madhavan Srinivasan" <maddy@linux.ibm.com>,
"Ingo Molnar" <mingo@redhat.com>,
"Borislav Petkov" <bp@alien8.de>,
"Dave Hansen" <dave.hansen@linux.intel.com>,
x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
"Arnd Bergmann" <arnd@arndb.de>, "Guo Ren" <guoren@kernel.org>
Cc: linux-parisc@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-riscv@lists.infradead.org, loongarch@lists.linux.dev,
linux-s390@vger.kernel.org, linux-mips@vger.kernel.org,
linuxppc-dev@lists.ozlabs.org, linux-arch@vger.kernel.org,
Nam Cao <namcao@linutronix.de>,
linux-csky@vger.kernel.org, "Ridoux,
Julien" <ridouxj@amazon.com>, "Luu, Ryan" <rluu@amazon.com>,
kvm <kvm@vger.kernel.org>
Subject: Re: [PATCH v3 00/18] vDSO: Introduce generic data storage
Date: Fri, 14 Feb 2025 12:04:38 +0000 [thread overview]
Message-ID: <8e9fb0c37ae4a3f60b09b8da5d39dbf909ec038e.camel@infradead.org> (raw)
In-Reply-To: <87ed00kbe3.ffs@tglx>
[-- Attachment #1: Type: text/plain, Size: 2581 bytes --]
On Fri, 2025-02-14 at 12:34 +0100, Thomas Gleixner wrote:
> > 2. In kernel, asking KVM to populate the vmclock structure much like
> > it does other pvclocks shared with the guest. KVM/x86 already uses
> > pvclock_gtod_register_notifier() to hook changes; should we expand
> > on that? The problem with that notifier is that it seems to be
> > called far more frequently than I'd expect.
>
> It's called once per tick to expose the continous updates to the
> conversion factors and related internal data.
My recollection (a vague one) is that it's called, and reports
"changes", even when there *are* no changes to underlying conversion
factors. Something along the lines of "N ticks at 333 counts per tick,
then one tick at 334 counts per tick to catch up" because it can't
express the division factor completely without that discontinuity?
The actual 'error' caused by the apparent fluctuation in rate is
probably entirely negligible, but I am slightly concerned about the
steal time, if the hypervisor then spends stolen CPU time relaying all
those "changes" to the guest, and then the guest has to spend time
feeding the "changes" into its own timekeeping.
I'd like to strive for a mode where we only adjust what we tell guests,
when adjtimex actually changes the real timing factors.
In fact if we have a userspace tool like chrony feeding adjtimex based
on external NTP/PPS/whatever, that tool could probably calibrate a
stable host TSC directly against the external real time. And in that
mode maybe we don't even need to feed the guest from the kernel's
CLOCK_REALTIME; that would be just another conversion step to introduce
noise.
We might end up with the direct setup for dedicated hosting
environments, but I do also want to support the general-purpose QEMU-
based setup where we expose the host's CLOCK_REALTIME as efficiently as
possible.
How about this: A KVM feature to provide/populate the VMCLOCK, since
only KVM knows the precise TSC scaling (and can immediately flip the
VMCLOCK to report invalid state if the TSC becomes unreliable).
It can *either* be fed the precise TSC/realtime relationship from
userspace (maybe in a vmclock structure that *userspace* populates, so
all the kernel has to do is scale/offset to account for the guest TSC
being different from the host TSC).
Or it can be in 'automatic' mode, where it derives from the host's
timekeeping. Which at the moment would have "too many" updates for my
liking, but we can worry about that later if necessary.
[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5069 bytes --]
prev parent reply other threads:[~2025-02-14 12:05 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-04 12:05 [PATCH v3 00/18] vDSO: Introduce generic data storage Thomas Weißschuh
2025-02-04 12:05 ` [PATCH v3 01/18] x86/vdso: Fix latent bug in vclock_pages calculation Thomas Weißschuh
2025-02-04 12:05 ` [PATCH v3 02/18] parisc: Remove unused symbol vdso_data Thomas Weißschuh
2025-02-04 12:05 ` [PATCH v3 03/18] vdso: Introduce vdso/align.h Thomas Weißschuh
2025-02-04 12:05 ` [PATCH v3 04/18] vdso: Rename included Makefile Thomas Weißschuh
2025-02-04 12:05 ` [PATCH v3 05/18] vdso: Add generic time data storage Thomas Weißschuh
2025-02-04 12:05 ` [PATCH v3 06/18] vdso: Add generic random " Thomas Weißschuh
2025-02-04 12:05 ` [PATCH v3 07/18] vdso: Add generic architecture-specific " Thomas Weißschuh
2025-02-04 12:05 ` [PATCH v3 08/18] arm64: vdso: Switch to generic storage implementation Thomas Weißschuh
2025-02-04 12:05 ` [PATCH v3 09/18] riscv: " Thomas Weißschuh
2025-02-22 8:17 ` Xi Ruoyao
2025-02-22 10:14 ` Thomas Gleixner
2025-02-04 12:05 ` [PATCH v3 10/18] LoongArch: vDSO: " Thomas Weißschuh
2025-02-22 8:20 ` Xi Ruoyao
2025-02-04 12:05 ` [PATCH v3 11/18] arm: vdso: " Thomas Weißschuh
2025-02-04 12:05 ` [PATCH v3 12/18] s390/vdso: " Thomas Weißschuh
2025-02-04 12:05 ` [PATCH v3 13/18] MIPS: vdso: " Thomas Weißschuh
2025-02-04 12:05 ` [PATCH v3 14/18] powerpc/vdso: " Thomas Weißschuh
2025-02-05 8:50 ` Christophe Leroy
2025-02-04 12:05 ` [PATCH v3 15/18] x86/vdso: " Thomas Weißschuh
2025-02-04 12:05 ` [PATCH v3 16/18] x86/vdso/vdso2c: Remove page handling Thomas Weißschuh
2025-02-04 12:05 ` [PATCH v3 17/18] vdso: Remove remnants of architecture-specific random state storage Thomas Weißschuh
2025-02-04 12:05 ` [PATCH v3 18/18] vdso: Remove remnants of architecture-specific time storage Thomas Weißschuh
2025-02-06 9:31 ` [PATCH v3 00/18] vDSO: Introduce generic data storage David Woodhouse
2025-02-06 10:59 ` Thomas Weißschuh
2025-02-07 10:15 ` David Woodhouse
2025-02-14 11:34 ` Thomas Gleixner
2025-02-14 12:04 ` David Woodhouse [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=8e9fb0c37ae4a3f60b09b8da5d39dbf909ec038e.camel@infradead.org \
--to=dwmw2@infradead.org \
--cc=James.Bottomley@HansenPartnership.com \
--cc=Jason@zx2c4.com \
--cc=agordeev@linux.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=anna-maria@linutronix.de \
--cc=aou@eecs.berkeley.edu \
--cc=arnd@arndb.de \
--cc=borntraeger@linux.ibm.com \
--cc=bp@alien8.de \
--cc=catalin.marinas@arm.com \
--cc=chenhuacai@kernel.org \
--cc=christophe.leroy@csgroup.eu \
--cc=dave.hansen@linux.intel.com \
--cc=deller@gmx.de \
--cc=frederic@kernel.org \
--cc=gor@linux.ibm.com \
--cc=guoren@kernel.org \
--cc=hca@linux.ibm.com \
--cc=hpa@zytor.com \
--cc=kernel@xen0n.name \
--cc=kvm@vger.kernel.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-csky@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=linux-parisc@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linux-s390@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=loongarch@lists.linux.dev \
--cc=luto@kernel.org \
--cc=maddy@linux.ibm.com \
--cc=mingo@redhat.com \
--cc=mpe@ellerman.id.au \
--cc=namcao@linutronix.de \
--cc=naveen@kernel.org \
--cc=npiggin@gmail.com \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=ridouxj@amazon.com \
--cc=rluu@amazon.com \
--cc=svens@linux.ibm.com \
--cc=tglx@linutronix.de \
--cc=thomas.weissschuh@linutronix.de \
--cc=tsbogend@alpha.franken.de \
--cc=tytso@mit.edu \
--cc=vincenzo.frascino@arm.com \
--cc=will@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;
as well as URLs for NNTP newsgroup(s).