[PATCH net v4 0/5] ptp: make virtual clock sampling and teardown failure-safe
From: James Hilliard
Date: Thu Oct 15 2026 - 19:33:45 EST
Fix virtual-clock sampling errors, registration rollback and parent
teardown in separate patches. Keep failed PHC reads out of the timecounter
and serialize extended samples with virtual-clock adjustments. Also
preserve the zero sentinel for packets without hardware timestamps.
Retain the existing cyclecounter mask, scaling and conversion windows.
Retry failed refreshes promptly and queue the first refresh immediately
after registration. This does not guarantee recovery across prolonged
sampling gaps or assume full-width nanosecond samples.
Changes in v4:
- Retry failed refreshes after 10 ms, keeping the normal two-second
interval after success.
- Queue the first refresh immediately after registration, while keeping
counter initialization before publication.
- Clarify the half-wrap conversion window and full-wrap sampling limit.
- Document the zero-input return from ptp_convert_timestamp().
- Add Vadim Fedorenko's Reviewed-by tags to patches 1 and 5.
- Rebase onto current net.
- Link to v3: https://patch.msgid.link/20261013-ptp-vclock-sampling-v3-0-d3ee4ea62fc6@xxxxxxxxx
Changes in v3:
- Split the independent fixes into separate patches, as requested by Paolo.
- Retain the existing timecounter arithmetic and conversion windows; drop
the full-width rewrite and extended-read anchor updates from v2.
- Propagate registration errors through sysfs, including a failed initial
PHC sample, and initialize the counter before publishing the clock.
- Preserve absent hardware timestamps instead of converting zero.
- Correct the sysfs teardown rationale and its Fixes tag.
- Rebase onto current net.
- Link to v2: https://patch.msgid.link/20261005-ptp-vclock-sampling-v2-0-8ed12d4d10af@xxxxxxxxx
Changes in v2:
- Drain virtual clock sysfs changes before parent unregister walks children.
- Use full-width samples and overflow-safe scaling across long sampling gaps.
- Update the anchor for extended and cross-timestamp reads under the clock lock.
- Link to v1: https://patch.msgid.link/20260930-ptp-vclock-sampling-v1-1-c11bc16691ae@xxxxxxxxx
Assisted-by: Codex:gpt-6-astra
---
James Hilliard (5):
ptp: drain virtual clock sysfs operations before unregistering children
ptp: unwind partially completed virtual clock creation
ptp: vclock: propagate physical clock sampling errors
ptp: vclock: serialize extended samples with counter updates
ptp: vclock: preserve missing hardware timestamps
drivers/ptp/ptp_clock.c | 5 ++
drivers/ptp/ptp_private.h | 4 +-
drivers/ptp/ptp_sysfs.c | 18 ++++++-
drivers/ptp/ptp_vclock.c | 109 +++++++++++++++++++++++++--------------
include/linux/ptp_clock_kernel.h | 2 +-
5 files changed, 95 insertions(+), 43 deletions(-)
---
base-commit: 045958acaa75205b31578cb22c4345e28dd2e4bf
change-id: 20260930-ptp-vclock-sampling-902f98408c93
Best regards,
--
James Hilliard <james.hilliard1@xxxxxxxxx>