From: "Chalios, Babis" <bchalios@amazon.es>
To: "robh@kernel.org" <robh@kernel.org>,
"krzk+dt@kernel.org" <krzk+dt@kernel.org>,
"conor+dt@kernel.org" <conor+dt@kernel.org>,
"richardcochran@gmail.com" <richardcochran@gmail.com>,
"dwmw2@infradead.org" <dwmw2@infradead.org>,
"andrew+netdev@lunn.ch" <andrew+netdev@lunn.ch>,
"davem@davemloft.net" <davem@davemloft.net>,
"edumazet@google.com" <edumazet@google.com>,
"kuba@kernel.org" <kuba@kernel.org>,
"pabeni@redhat.com" <pabeni@redhat.com>
Cc: "devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"Chalios, Babis" <bchalios@amazon.es>, "Graf (AWS),
Alexander" <graf@amazon.de>,
"mzxreary@0pointer.de" <mzxreary@0pointer.de>,
"Cali, Marco" <xmarcalx@amazon.co.uk>
Subject: [PATCH v4 0/7] ptp: vmclock: Add VM generation counter and ACPI notification
Date: Thu, 18 Dec 2025 14:24:10 +0000 [thread overview]
Message-ID: <20251218142408.8395-1-bchalios@amazon.es> (raw)
Similarly to live migration, starting a VM from some serialized state
(aka snapshot) is an event which calls for adjusting guest clocks, hence
a hypervisor should increase the disruption_marker before resuming the
VM vCPUs, letting the guest know.
However, loading a snapshot, is slightly different than live migration,
especially since we can start multiple VMs from the same serialized
state. Apart from adjusting clocks, the guest needs to take additional
action during such events, e.g. recreate UUIDs, reset network
adapters/connections, reseed entropy pools, etc. These actions are not
necessary during live migration. This calls for a differentiation
between the two triggering events.
We differentiate between the two events via an extra field in the
vmclock_abi, called vm_generation_counter. Whereas hypervisors should
increase the disruption marker in both cases, they should only increase
vm_generation_counter when a snapshot is loaded in a VM (not during live
migration).
Additionally, we attach an ACPI notification to VMClock. Implementing
the notification is optional for the device. VMClock device will declare
that it implements the notification by setting
VMCLOCK_FLAG_NOTIFICATION_PRESENT bit in vmclock_abi flags. Hypervisors
that implement the notification must send an ACPI notification every
time seq_count changes to an even number. The driver will propagate
these notifications to userspace via the poll() interface.
Changes:
* RFC -> v1:
- Made the notification support optional. Hypervisor needs to
advertise support for the notification via a flag in vmclock_abi.
Subsequently, poll() will return POLLHUP when the feature is not
supported, to avoid having userspace blocking indefinitely waiting
for events that won't arrive
- Reworded the comment around vm_generation_counter field to avoid
speaking about "jumping forward in time".
* v1 -> v2:
- Correctly handle failures when calling vmclock_setup_notification to
setup notifications.
- Use atomic_t for fst->seq and handle the case of concurrent
read()/poll() accesses.
- Initialize fst->seq to 0 rather than what is currently stored in the
shared page. This is to avoid reading odd numbers.
- Add DT bindings similar to existing VMGenID ones.
* v2 -> v3:
- Include missing header file and drop unused variables in PATH 2/4.
- Include missing Reviewed-by in PATCH 1/4.
- Fix DT node name to be generic (s/vmclock/ptp).
- Include missing maintainers.
* v3 -> v4:
- Added bindings file as maintained by David as part for PTP VMCLOCK
SUPPORT.
- Use le64_to_cpu() to access clk->flags.
- Reference public specification.
- Pass struct vmclock_state * in the of IRQ handler
- Included three new patches from David:
* Making ACPI optional for the driver.
* Adding "VMCLOCK" to ACPI match.
* Return TAI instead of UTC.
Babis Chalios (2):
ptp: vmclock: add vm generation counter
ptp: vmclock: support device notifications
David Woodhouse (5):
dt-bindings: ptp: Add amazon,vmclock
ptp: ptp_vmclock: Add device tree support
ptp: ptp_vmclock: add 'VMCLOCK' to ACPI device match
ptp: ptp_vmclock: remove dependency on CONFIG_ACPI
ptp: ptp_vmclock: return TAI not UTC
.../bindings/ptp/amazon,vmclock.yaml | 46 ++++
MAINTAINERS | 1 +
drivers/ptp/Kconfig | 2 +-
drivers/ptp/ptp_vmclock.c | 197 ++++++++++++++++--
include/uapi/linux/vmclock-abi.h | 20 ++
5 files changed, 252 insertions(+), 14 deletions(-)
create mode 100644 Documentation/devicetree/bindings/ptp/amazon,vmclock.yaml
--
2.34.1
next reply other threads:[~2025-12-18 14:24 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-18 14:24 Chalios, Babis [this message]
2025-12-18 14:24 ` [PATCH v4 1/7] ptp: vmclock: add vm generation counter Chalios, Babis
2025-12-18 14:24 ` [PATCH v4 2/7] ptp: vmclock: support device notifications Chalios, Babis
2025-12-18 14:24 ` [PATCH v4 3/7] dt-bindings: ptp: Add amazon,vmclock Chalios, Babis
2025-12-18 14:24 ` [PATCH v4 4/7] ptp: ptp_vmclock: Add device tree support Chalios, Babis
2025-12-18 14:25 ` [PATCH v4 5/7] ptp: ptp_vmclock: add 'VMCLOCK' to ACPI device match Chalios, Babis
2025-12-18 14:25 ` [PATCH v4 6/7] ptp: ptp_vmclock: remove dependency on CONFIG_ACPI Chalios, Babis
2025-12-18 14:25 ` [PATCH v4 7/7] ptp: ptp_vmclock: return TAI not UTC Chalios, Babis
2025-12-28 14:42 ` [PATCH v4 0/7] ptp: vmclock: Add VM generation counter and ACPI notification Paolo Abeni
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=20251218142408.8395-1-bchalios@amazon.es \
--to=bchalios@amazon.es \
--cc=andrew+netdev@lunn.ch \
--cc=conor+dt@kernel.org \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=dwmw2@infradead.org \
--cc=edumazet@google.com \
--cc=graf@amazon.de \
--cc=krzk+dt@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mzxreary@0pointer.de \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=richardcochran@gmail.com \
--cc=robh@kernel.org \
--cc=xmarcalx@amazon.co.uk \
/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).