Skip to content

net: ravb: fix PTP clock lifetime

Xuanqiang Luo linux-renesas-soc netdev stable 2 versions – Applied

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

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest2 patches 2 repliesApplied 2/2
  2. v32 patches 5 repliesSuperseded

Changes in v4 from the cover letter

- Rebase onto Linux 7.2-rc7.
Patch 1:
- Cache the PHC index separately instead of locking clock access. (Vadim Fedorenko)
- Reword the subject and update the commit message for the cached PHC index approach.
- Add Vadim Fedorenko's Reviewed-by tag.
Patch 2:
- Replace priv->lock serialization with PTP interrupt disabling and IRQ draining before unregistering the clock. (Vadim Fedorenko)
- Use READ_ONCE() and WRITE_ONCE() for lockless clock pointer access and xchg() to detach the clock atomically.
- Track the error and management IRQs and synchronize all IRQs that can invoke the PTP handler.
- Update the commit message to describe the interrupt handler race and the new teardown sequence.

Patches in v4 All 2 applied

#Subject and filesSizeRepliesApplied
1/2net: ravb: avoid dereferencing an invalid PTP clockdrivers/net/ethernet/renesas/ravb.h drivers/net/ethernet/renesas/ravb_main.c drivers/net/ethernet/renesas/ravb_ptp.c+16 -30 repliesApplied
2/2net: ravb: serialize PTP clock teardowndrivers/net/ethernet/renesas/ravb.h drivers/net/ethernet/renesas/ravb_main.c drivers/net/ethernet/renesas/ravb_ptp.c+35 -100 repliesApplied

Reviews trailers per patch

1 of 2 patches has a Reviewed-by or Acked-by.

PatchVadim Fedorenko
1/2R-b
2/2

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v4 thread

Cover letter [PATCH net v4 0/2] net: ravb: fix PTP clock lifetime

From: Xuanqiang Luo <[email protected]>

This series fixes RAVB PTP clock lifetime handling. It reports a cached PHC index without accessing the clock pointer and drains PTP interrupts before unregistering the clock.

Patch 1 caches the PHC index and handles registration failures.

Patch 2 detaches the clock with xchg() and drains the PTP IRQs before unregistering it.

---
Changes:
v4:
- Rebase onto Linux 7.2-rc7.
Patch 1:
- Cache the PHC index separately instead of locking clock access. (Vadim Fedorenko)
- Reword the subject and update the commit message for the cached PHC index approach.
- Add Vadim Fedorenko's Reviewed-by tag.
Patch 2:
- Replace priv->lock serialization with PTP interrupt disabling and IRQ draining before unregistering the clock. (Vadim Fedorenko)
- Use READ_ONCE() and WRITE_ONCE() for lockless clock pointer access and xchg() to detach the clock atomically.
- Track the error and management IRQs and synchronize all IRQs that can invoke the PTP handler.
- Update the commit message to describe the interrupt handler race and the new teardown sequence.

v3: https://lore.kernel.org/all/[email protected]/
Patch 1:
- Omit Niklas Söderlund's Reviewed-by tag because the implementation he reviewed has changed.
- Describe the NULL pointer dereference before the first open as the most likely failure mode in the commit message. (Jakub Kicinski, Sashiko)
- Normalize PTP clock registration failures to NULL.
(Jakub Kicinski, Sashiko)
- Keep hardware timestamping capabilities independent of PHC availability. (Jakub Kicinski, Sashiko)
Patch 2 (new):
- Serialize PTP clock publication and access with priv->lock, and detach the clock before unregistering it. (Jakub Kicinski, Sashiko)

v2: https://lore.kernel.org/all/[email protected]/
- Only advertise hardware timestamping support when a PHC is available (Niklas Söderlund).

v1: https://lore.kernel.org/all/[email protected]/

Xuanqiang Luo (2):
net: ravb: avoid dereferencing an invalid PTP clock
net: ravb: serialize PTP clock teardown

 drivers/net/ethernet/renesas/ravb.h      |  3 ++
 drivers/net/ethernet/renesas/ravb_main.c |  9 +++--
 drivers/net/ethernet/renesas/ravb_ptp.c  | 44 ++++++++++++++++++++----
 3 files changed, 47 insertions(+), 9 deletions(-)

base-commit: db2ddb87143519e20a95aa36c60b36107b736a58

Signature · 1 line
2.43.0