From: David Woodhouse <dwmw2@infradead.org>
To: qemu-devel@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
Igor Mammedov <imammedo@redhat.com>,
Ani Sinha <anisinha@redhat.com>,
David Woodhouse <dwmw2@infradead.org>,
Marcel Apfelbaum <marcel.apfelbaum@gmail.com>,
Richard Henderson <richard.henderson@linaro.org>,
Eduardo Habkost <eduardo@habkost.net>,
Cornelia Huck <cohuck@redhat.com>,
Peter Hilber <quic_philber@quicinc.com>,
"Mohamed Abuelfotoh, Hazem" <abuehaze@amazon.com>,
paul <paul@xen.org>
Subject: [PATCH v7 0/3] hw/acpi: Add vmclock device
Date: Thu, 16 Jan 2025 13:59:40 +0000 [thread overview]
Message-ID: <20250116140315.2455143-1-dwmw2@infradead.org> (raw)
(Posting one last time with the header commits split out).
The vmclock device addresses the problem of live migration with
precision clocks. The tolerances of a hardware counter (e.g. TSC) are
typically around ±50PPM. A guest will use NTP/PTP/PPS to discipline that
counter against an external source of 'real' time, and track the precise
frequency of the counter as it changes with environmental conditions.
When a guest is live migrated, anything it knows about the frequency of
the underlying counter becomes invalid. It may move from a host where
the counter running at -50PPM of its nominal frequency, to a host where
it runs at +50PPM. There will also be a step change in the value of the
counter, as the correctness of its absolute value at migration is
limited by the accuracy of the source and destination host's time
synchronization.
The device exposes a shared memory region to guests, which can be mapped
all the way to userspace. In the first phase, this merely advertises a
'disruption_marker', which indicates that the guest should throw away any
NTP synchronization it thinks it has, and start again.
Because the region can be exposed all the way to userspace, applications
can still use time from a fast vDSO 'system call', and check the
disruption marker to be sure that their timestamp is indeed truthful.
The structure also allows for the precise time, as known by the host, to
be exposed directly to guests so that they don't have to wait for NTP to
resync from scratch.
The values and fields are based on the nascent virtio-rtc specification,
and the intent is that a version (hopefully precisely this version) of
this structure will be included as an optional part of that spec. In the
meantime, a simple ACPI device along the lines of VMGENID is perfectly
sufficient and is compatible with what's being shipped in certain
commercial hypervisors.
Linux guest support was merged into the 6.13-rc1 kernel:
https://git.kernel.org/torvalds/c/205032724226
---
v7:
• Split update-kernel-headers.sh and the addition of the new header
file into separate commits, add MAINTAINERS entry.
v6:
• Rebase for DEFINE_PROP_END_OF_LIST removal and sysemu→system
rename.
v5:
• Trivial simplification to AML generation.
• Import vmclock-abi.h from Linux now the guest support is merged.
v4:
• Trivial checkpatch fixes and comment improvements.
v3:
• Add comment that vmclock-abi.h will come from the Linux kernel
headers once it gets merged there.
v2:
• Change esterror/maxerror fields to nanoseconds.
• Change to officially assigned AMZNC10C ACPI HID.
• Fix little-endian handling of fields in update.
David Woodhouse (3):
linux-headers: Add vmclock-abi.h
linux-headers: Update to Linux 6.13-rc7
hw/acpi: Add vmclock device
MAINTAINERS | 5 +
hw/acpi/Kconfig | 5 +
hw/acpi/meson.build | 1 +
hw/acpi/vmclock.c | 179 ++++++++++++++++++++++++++
hw/i386/Kconfig | 1 +
hw/i386/acpi-build.c | 10 +-
include/hw/acpi/vmclock.h | 34 +++++
include/standard-headers/linux/vmclock-abi.h | 182 +++++++++++++++++++++++++++
linux-headers/linux/iommufd.h | 31 +++--
linux-headers/linux/stddef.h | 13 +-
scripts/update-linux-headers.sh | 1 +
11 files changed, 447 insertions(+), 15 deletions(-)
next reply other threads:[~2025-01-16 14:04 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-16 13:59 David Woodhouse [this message]
2025-01-16 13:59 ` [PATCH v7 1/3] linux-headers: Add vmclock-abi.h David Woodhouse
2025-01-16 15:52 ` Cornelia Huck
2025-01-16 13:59 ` [PATCH v7 2/3] linux-headers: Update to Linux 6.13-rc7 David Woodhouse
2025-01-16 14:07 ` Paul Durrant
2025-01-16 14:10 ` David Woodhouse
2025-01-16 15:57 ` Cornelia Huck
2025-01-16 13:59 ` [PATCH v7 3/3] hw/acpi: Add vmclock device David Woodhouse
2025-01-16 15:15 ` Philippe Mathieu-Daudé
2025-01-16 15:32 ` David Woodhouse
2025-01-16 15:57 ` Philippe Mathieu-Daudé
2025-01-16 16:01 ` David Woodhouse
2025-01-17 10:44 ` David Woodhouse
2025-02-04 13:49 ` Peter Maydell
2025-02-04 14:17 ` David Woodhouse
2025-02-04 14:52 ` Peter Maydell
2025-02-06 15:11 ` David Woodhouse
2025-02-07 14:34 ` [PATCH] hw/acpi: Remove legacy reset handling from vmclock David Woodhouse
2025-03-29 7:27 ` David Woodhouse
2025-03-30 4:52 ` Ani Sinha
2025-04-09 4:23 ` Ani Sinha
2025-04-09 4:35 ` Ani Sinha
2025-02-04 18:17 ` [PATCH v7 3/3] hw/acpi: Add vmclock device Philippe Mathieu-Daudé
2025-02-04 18:19 ` Philippe Mathieu-Daudé
2025-01-16 14:44 ` [PATCH v7 0/3] " Michael S. Tsirkin
2025-01-16 14:54 ` David Woodhouse
2025-01-17 8:26 ` David Woodhouse
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=20250116140315.2455143-1-dwmw2@infradead.org \
--to=dwmw2@infradead.org \
--cc=abuehaze@amazon.com \
--cc=anisinha@redhat.com \
--cc=cohuck@redhat.com \
--cc=eduardo@habkost.net \
--cc=imammedo@redhat.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=mst@redhat.com \
--cc=paul@xen.org \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quic_philber@quicinc.com \
--cc=richard.henderson@linaro.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).