Re: [PATCH v3 00/18] vDSO: Introduce generic data storage

David Woodhouse
2025-02-06T09:32:51Z

[-- Attachment #1: Type: text/plain, Size: 1724 bytes --]

On Tue, 2025-02-04 at 13:05 +0100, Thomas Weißschuh wrote:
> Currently each architecture defines the setup of the vDSO data page on
> its own, mostly through copy-and-paste from some other architecture.
> Extend the existing generic vDSO implementation to also provide generic
> data storage.
> This removes duplicated code and paves the way for further changes to
> the generic vDSO implementation without having to go through a lot of
> per-architecture changes.
>
> Based on v6.14-rc1 and intended to be merged through the tip tree.

Thanks for working on this. Is there a plan to expose the time data
directly to userspace in a form which is usable *other* than by
function calls which get the value of the clock at a given moment?

For populating the vmclock device¹ we need to know the actual
relationship between the hardware counter (TSC, arch timer, etc.) and
real time in order to propagate that to the guest.

I see two options for doing this:

1. Via userspace, exposing the vdso time data (and a notification when
it changes?) and letting the userspace VMM populate the vmclock.
This is complex for x86 because of TSC scaling; in fact userspace
doesn't currently know the precise scaling from host to guest TSC
so we'd have to be able to extract that from KVM.

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.

¹ https://gitlab.com/qemu-project/qemu/-/commit/3634039b93cc5

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5069 bytes --]