All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v6 0/3] pps: improve PREEMPT_RT performance
@ 2026-05-25 19:49 Calvin Owens
  2026-05-25 19:49 ` [PATCH v6 1/3] pps: pps-gpio: split IRQ handler into hardirq timestamper + threaded handler Calvin Owens
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Calvin Owens @ 2026-05-25 19:49 UTC (permalink / raw)
  To: linux-kernel
  Cc: Rodolfo Giometti, Sebastian Andrzej Siewior, Clark Williams,
	Steven Rostedt, Thomas Gleixner, Ingo Molnar, Greg Kroah-Hartman,
	Michael Byczkowski, Eliav Farber, linux-rt-devel, David Laight

Hello all,

Michael is busy, and I have some extra bandwidth, so I've volunteered to
help out with the patch schlepping here. These v6 patches are based on
7.1-rc5.

This is all Michael's work, and Michael's cover letter follows. I added
lore links to the older patch versions next to his change descriptions.

Note that I replaced two emdashes in comment blocks with regular hypens
in patch 1/3, to avoid 8bit encoding.

Thanks,
Calvin

---
From: Michael Byczkowski <by@by-online.de>

This is v6 of the PPS PREEMPT_RT patchset, addressing the review
feedback from Sebastian Andrzej Siewior on v5.

Changes since v5: https://lore.kernel.org/lkml/719A31CE-CA58-45C3-A013-1BFE81F724C5@by-online.de/
 - 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/B24484C5-3117-4C56-9522-1EE9876E64BA@by-online.de/
 - Patch 2/3: added Acked-by: Rodolfo Giometti <giometti@enneenne.com>

Changes since v3: https://lore.kernel.org/lkml/83318241-44C3-48BE-829D-5C5F82A78A74@by-online.de/
 - Patch 2/3: fixed lost indentation on pps_kc_event() call
   (reported by Rodolfo Giometti <giometti@enneenne.com>)

Changes since v2: https://lore.kernel.org/lkml/1BB87C0C-33C1-45C3-B50E-C5F349DA3FDC@by-online.de/
 - 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 <nb@buchwitz.com>)

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).

2. pps_kc_hardpps_lock: spinlock_t becomes a sleeping mutex on
   PREEMPT_RT. Since pps_kc_event() calls hardpps() under this lock
   and hardpps() takes the raw_spinlock_t tk_core.lock, the nesting
   is invalid. Fix: convert to DEFINE_RAW_SPINLOCK.

3. pps_device.lock: same issue as (2), in the PPS event delivery
   path. Fix: convert to raw_spinlock_t and move sleeping calls out
   of the critical section.

All three patches are 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 (3):
  pps: pps-gpio: split IRQ handler into hardirq timestamper + threaded
    handler
  pps: kc: convert pps_kc_hardpps_lock to raw_spinlock_t
  pps: convert pps_device.lock to raw_spinlock_t

 drivers/pps/clients/pps-gpio.c | 37 +++++++++++++------
 drivers/pps/kapi.c             |  6 +--
 drivers/pps/kc.c               | 67 ++++++++++++++++------------------
 drivers/pps/pps.c              | 16 ++++----
 include/linux/pps_kernel.h     |  2 +-
 5 files changed, 68 insertions(+), 60 deletions(-)

-- 
2.47.3


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2026-05-30 11:14 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-25 19:49 [PATCH v6 0/3] pps: improve PREEMPT_RT performance Calvin Owens
2026-05-25 19:49 ` [PATCH v6 1/3] pps: pps-gpio: split IRQ handler into hardirq timestamper + threaded handler Calvin Owens
2026-05-25 19:49 ` [PATCH v6 2/3] pps: kc: convert pps_kc_hardpps_lock to raw_spinlock_t Calvin Owens
2026-05-25 19:49 ` [PATCH v6 3/3] pps: convert pps_device.lock " Calvin Owens
2026-05-26 17:50   ` Calvin Owens
2026-05-26 18:31     ` Michael Byczkowski
2026-05-30 11:14       ` Michael Byczkowski
2026-05-28  7:49     ` Sebastian Andrzej Siewior
2026-05-28 15:57       ` Calvin Owens
2026-05-29  7:19         ` Sebastian Andrzej Siewior
2026-05-29 12:37           ` Calvin Owens
2026-05-29 12:57             ` Sebastian Andrzej Siewior
2026-05-30 11:03               ` Michael Byczkowski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.