Skip to content

ptp: vmclock: Add VM generation counter and ACPI notification

Takahiro Itazuri linux-devicetree lkml netdev 2 versions – Applied

Status from this message: This series was applied to netdev/net-next.git (main)

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v7 Latest7 patches 0 repliesApplied 7/7
  2. v67 patches 2 repliesSuperseded

Changes from the cover letter

* 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

Patches in v7 All 7 applied

#Subject and filesSizeRepliesApplied
1/7ptp: vmclock: add vm generation counterinclude/uapi/linux/vmclock-abi.h+15 -00 repliesApplied
2/7ptp: vmclock: support device notificationsdrivers/ptp/ptp_vmclock.c include/uapi/linux/vmclock-abi.h+148 -190 repliesApplied
3/7dt-bindings: ptp: Add amazon,vmclockDocumentation/devicetree/bindings/ptp/amazon,vmclock.yaml MAINTAINERS+47 -00 repliesApplied
4/7ptp: ptp_vmclock: Add device tree supportdrivers/ptp/ptp_vmclock.c+61 -60 repliesApplied
5/7ptp: ptp_vmclock: add 'VMCLOCK' to ACPI device matchdrivers/ptp/ptp_vmclock.c+1 -00 repliesApplied
6/7ptp: ptp_vmclock: remove dependency on CONFIG_ACPIdrivers/ptp/Kconfig drivers/ptp/ptp_vmclock.c+11 -50 repliesApplied
7/7ptp: ptp_vmclock: return TAI not UTCdrivers/ptp/ptp_vmclock.c+5 -50 repliesApplied

Reviews trailers per patch

3 of 7 patches have a Reviewed-by or Acked-by.

PatchDavid WoodhouseTakahiro ItazurKrzysztof KozlowskiTakahiro Itazuri
1/7R-b T-b
2/7R-b T-b
3/7T-b R-b
4/7T-b
5/7T-b
6/7T-b
7/7T-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 4 reviewers.

Read the v7 thread

Cover letter [PATCH v7 0/7] ptp: vmclock: Add VM generation counter and ACPI notification

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.
* v4 -> v5:
- Use IF_ENABLED instead of #ifdef
- Use reverse christmas tree order in variable declaration
- Fix empty changelog
* v5 -> v6:
- Fix blank line CHECKs reported by checkpatch.pl
* v6 -> v7:
- Unregister the ACPI notify handler on removal to prevent UAF
- Fix a race where the ACPI notifier handler could run before driver_data initialization.

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                     | 236 ++++++++++++++++--
 include/uapi/linux/vmclock-abi.h              |  20 ++
 5 files changed, 279 insertions(+), 26 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/ptp/amazon,vmclock.yaml
Signature · 1 line
2.50.1