[PATCH net v3 0/4] ptp: fix timestamp teardown and OCP DPLL routing

From
Ahmad Byagowi <hidden>
Date
2026-11-20 21:21:32
This revision keeps timestamp shutdown in PTP core, after removal of the
user interfaces, instead of adding a driver-specific stopping flag.

Patch 1 changes ptp_disable_all_events() to disable all advertised EXTTS
channels, not just channels recorded in pin descriptors. ptp_ocp has six
channels and four SMA descriptors; assigning artificial pins would change
the existing interface and cannot represent all enabled channels at once.
The patch removes ptp_ocp's early disable loop and ensures that an empty
shared PPS map still causes hardware disable and IRQ draining. The latter
also covers overlapping sysfs and ioctl requests before unregister.

This follows Vadim's agreement to fix PTP core cleanup in the discussion
linked below. It does not add pins or change normal SMA routing. The
existing PPS/EXTTS shortcut remains while another subscription is active.
Patch 1 does not claim a formal Reviewed-by or Acked-by for the new code.

Patches 2-4 are unchanged in code and carry Vadim's Reviewed-by tags.

Validation:
- 100 source-derived ASan/UBSan removal/shared-PPS runs, including the
  empty-map race, six timestamp channels and IRQ-drain ordering.
- Seven deliberate regressions rejected by runtime assertions.
- Five KUnit cases pass using real PTP register/unregister in QEMU with
  KASAN, lockdep and DEBUG_ATOMIC_SLEEP. All five fail on the old core.
  The test callback models event state; no physical IRQ source is used.
- DPLL/SMA source-derived tests pass.
- Complete drivers/ptp/ subtree builds pass for x86-64 and i386 with
  allmodconfig and allyesconfig, W=1 and KCFLAGS=-Werror.

No physical card was removed or tested. Other PTP hardware drivers have
not received runtime coverage from these tests.

Changes from v2:
- Replace the timestamp stopping flag and spinlock solution with core
  channel cleanup after the user interfaces are drained.
- Remove the preliminary OCP disable loop and drain an empty PPS map.
- Preserve the three review tags and keep the other code fixes unchanged.
- Refresh on current net; the PTP sources are unchanged by the rebase.
- The v2 80-column warning is gone with the removed spinlock code.
  Keep the replacement shared-PPS comment within 80 columns as well.

v2: https://lore.kernel.org/r/20261119-timecard-common-v2-078fe69f33-0-ahmadexp@gmail.com (local)
Cleanup discussion: https://lore.kernel.org/r/75abd6c6-f0ee-4665-9451-05e0e1a7a3d7@linux.dev (local)

This series replaces the earlier common fixes, rather than stacking on
them. The CI pending tree net-next-2026-11-20--00-00 still contains v1's
mutex implementation and the three routing fixes. That explains v2's
pending-tree apply conflict; those four old patches must be replaced.

The original common-driver issues were reported by the netdev Sashiko AI
review. Codex revised patch 1, its tests and the explanatory text from the
request to test Vadim's approach and preserve shared PPS behavior. The
unchanged patches retain their original provenance statements.

Ahmad Byagowi (4):
  ptp: disable all timestamp channels after removing the user interfaces
  ptp: ocp: use hardware selectors in DPLL frequency operations
  ptp: ocp: report disabled SMA inputs consistently over DPLL
  ptp: ocp: correct the DCF output frequency

 drivers/ptp/ptp_chardev.c |  8 +++-----
 drivers/ptp/ptp_ocp.c     | 25 ++++++++-----------------
 2 files changed, 11 insertions(+), 22 deletions(-)


base-commit: d7f2d9b6c7d0ff0af7d19d889810d35dfe07da90
Thread (5 messages) 5 messages, 1 author, last reply 1h ago
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help