mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 0/3] pps: improve PREEMPT_RT performance
@ 2026-04-06 20:50 Michael Byczkowski
  2026-04-06 20:51 ` [PATCH v2 1/3] pps: pps-gpio: split IRQ handler into hardirq and threaded parts Michael Byczkowski
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Michael Byczkowski @ 2026-04-06 20:50 UTC (permalink / raw)
  To: giometti; +Cc: linux-kernel, akpm

Dear Rodolfo,

Andrew Morton pointed me your way as PPS maintainer. I'm running a
precision NTP time server on a Raspberry Pi 5 with a PREEMPT_RT kernel
and a u-blox ZED-F9P GPS receiver providing PPS via GPIO.

I found three issues in the PPS subsystem that cause unnecessary 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).
   On non-RT kernels, request_threaded_irq with an explicit primary
   handler behaves identically to the current code.

2. pps_device.lock: spinlock_t becomes a sleeping mutex on PREEMPT_RT,
   allowing pps_event() to be preempted mid-update. Fix: convert to
   raw_spinlock_t, which compiles to identical code on non-RT.

3. pps_kc_hardpps_lock: Same issue as (2), in the kernel consumer path
   that calls hardpps(). Fix: convert to DEFINE_RAW_SPINLOCK.

All three patches are tested on a Raspberry Pi 5 running a 7.0.0-rc6
PREEMPT_RT kernel with a PPS-disciplined NTP server. On non-RT kernels,
raw_spinlock_t compiles identically to spinlock_t, and
request_threaded_irq with a primary handler works the same as
request_irq — so there is zero behavioral change for non-RT users.

Signed-off-by: Michael Byczkowski <by@by-online.de>
Acked-by: Rodolfo Giometti <giometti@enneenne.com>
Tested-by: Michael Byczkowski <by@by-online.de>
Tested-by: Calvin Owens <calvin@wbinvd.org>

by (3):
  pps: pps-gpio: split IRQ handler into hardirq and threaded parts
  pps: convert pps_device lock to raw_spinlock for PREEMPT_RT
  pps: convert pps_kc_hardpps_lock to raw_spinlock for PREEMPT_RT

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

-- 
2.47.3


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

end of thread, other threads:[~2026-04-07 14:47 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-04-06 20:50 [PATCH v2 0/3] pps: improve PREEMPT_RT performance Michael Byczkowski
2026-04-06 20:51 ` [PATCH v2 1/3] pps: pps-gpio: split IRQ handler into hardirq and threaded parts Michael Byczkowski
2026-04-06 20:52 ` Michael Byczkowski
2026-04-06 20:52 ` [PATCH v2 2/3] pps: convert pps_device lock to raw_spinlock for PREEMPT_RT Michael Byczkowski
2026-04-07 14:24   ` [PATCH 4/3] pps: move wake_up and kill_fasync out of raw_spinlock section Michael Byczkowski
2026-04-07 14:44     ` Rodolfo Giometti
2026-04-06 20:53 ` [PATCH v2 3/3] pps: convert pps_kc_hardpps_lock to raw_spinlock for PREEMPT_RT Michael Byczkowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®