[PATCH v2 0/3] timekeeping: Implement and use read_snapshot() functionality

From: David Woodhouse

Date: Thu Jun 04 2026 - 06:04:04 EST


Commit ca1ec8bfac8c ("timekeeping: Add clocksource read_snapshot()
method and hw_cycles to snapshot") provided a way for clocksources like
kvmclock and Hyper-V to expose the underlying hardware counter value
from which their clock reading is calculated.

This is useful for consumers like the KVM masterclock (when hosting
nested guests), and vmclock which needs the hardware counter value to
calculate time according to the information it's given.

Now that Thomas has beaten my initial proof of concept¹ into shape and
merged it (thanks) here are the two providers and the trivial consumer
case in the vmclock driver, reworked accordingly.

I will rework the other four KVM master clock patches into my kvmclock
series² which I'll rebase on top of tip/timers/ptp in due course.

¹ https://lore.kernel.org/all/20260526230635.136914-1-dwmw2@xxxxxxxxxxxxx/#r
² https://lore.kernel.org/all/20260509224824.3264567-1-dwmw2@xxxxxxxxxxxxx/

David Woodhouse (3):
clocksource/hyperv: Implement read_snapshot() for TSC page clocksource
x86/kvmclock: Implement read_snapshot() for kvmclock clocksource
ptp: vmclock: Use hw_cycles from snapshot for precise TSC pairing

arch/x86/kernel/kvmclock.c | 36 +++++++++++++++++++++++++++++-------
drivers/clocksource/hyperv_timer.c | 37 +++++++++++++++++++++++++++----------
drivers/ptp/ptp_vmclock.c | 4 ++++
3 files changed, 60 insertions(+), 17 deletions(-)

base-commit: ca1ec8bfac8c95d0fed9e3611ea21400d1f37262