Skip to content

pps: improve PREEMPT_RT performance

Calvin Owens linux-rt-devel lkml 2 versions – Applied

Status from this message: [merged mm-nonmm-stable] pps-pps-gpio-split-irq-handler-into-hardirq-timestamper-threaded-handler.patch removed from -mm tree

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v7 Latest1 patch 7 repliesApplied 1/1
  2. v63 patches 9 repliesSuperseded

Patches in v7 All 1 applied

#Subject and filesSizeRepliesApplied
1/1pps: pps-gpio: split IRQ handler into hardirq timestamper + threaded handlerdrivers/pps/clients/pps-gpio.c+25 -128 repliesApplied

Reviews trailers per patch

The patch has a Reviewed-by or Acked-by.

PatchMichael ByczkowskiCalvin OwensRodolfo GiomettiSebastian Andrzej Siewior
1/1T-b T-b A-b A-b R-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/1] pps: improve PREEMPT_RT performance

Hello all,

I'm relaying v7 for Michael.

A quick note, this conflicts with the patch I have out to remove
capture_clear: it's trivial to resolve, but if it saves anybody time let me know and I can respin one or the other.

Thanks,
Calvin

---
From: Michael Byczkowski <[email protected]>

Changes since v6: https://lore.kernel.org/lkml/[email protected]/
- patches 2 and 3 are dropped since neither lock is ever taken in hardirq context.

Changes since v5: https://lore.kernel.org/lkml/[email protected]/
- Reordered: the pps_kc_hardpps_lock conversion now precedes the
pps_device.lock conversion. The previous order would have briefly
produced a raw_spinlock holding a sleeping spinlock on PREEMPT_RT
(Sebastian).
- Patch 1/3: commit message reworded to describe the handler split
structurally first, then its PREEMPT_RT benefit (Sebastian).
- Patch 2/3: refactored pps_kc_bind() and pps_kc_remove() to use guard(raw_spinlock_irq) for scope-based lock release. Eliminates
four duplicated unlock call sites in pps_kc_bind() and the
ambiguous bracket structure that resulted from them (Sebastian).
- Rodolfo's Acked-by on patch 2/3 is preserved from v5; the guard()
refactor is purely stylistic and was suggested by Sebastian, but
please re-ack or NAK if disagreement.

Changes since v4: https://lore.kernel.org/lkml/[email protected]/
- Patch 2/3: added Acked-by: Rodolfo Giometti <[email protected]>

Changes since v3: https://lore.kernel.org/lkml/[email protected]/
- Patch 2/3: fixed lost indentation on pps_kc_event() call
(reported by Rodolfo Giometti <[email protected]>)

Changes since v2: https://lore.kernel.org/lkml/[email protected]/
- Patch 2/3: moved wake_up_interruptible_all() and kill_fasync() out
of raw_spinlock section to avoid sleeping-in-atomic on PREEMPT_RT
(reported by Nikolaus Buchwitz <[email protected]>)

This patchset addresses three sources of PPS jitter under PREEMPT_RT, while being fully backward-compatible with non-RT kernels:

1. pps-gpio: The IRQ handler is force-threaded on PREEMPT_RT, so the PPS timestamp is captured after scheduling delay rather than at interrupt entry. Fix: split into a hardirq primary handler (captures timestamp only) and a threaded handler (processes the event).

Tested on a Raspberry Pi 5 running 7.0.1 and 7.1-rc PREEMPT_RT kernels. On non-RT kernels there is zero behavioral change.

Michael Byczkowski (1):
pps: pps-gpio: split IRQ handler into hardirq timestamper + threaded
handler

 drivers/pps/clients/pps-gpio.c | 37 +++++++++++++++++++++++-----------
 1 file changed, 25 insertions(+), 12 deletions(-)
Signature · 1 line
2.47.3