drivers/pps/clients/pps-gpio.c | 37 +++++++++++++++++++++++----------- drivers/pps/kapi.c | 18 ++++++++++------- drivers/pps/kc.c | 22 ++++++++++---------- drivers/pps/pps.c | 16 +++++++-------- include/linux/pps_kernel.h | 2 +- 5 files changed, 56 insertions(+), 39 deletions(-)
Dear Rodolfo, Dear Andrew, This is v5 of the PPS PREEMPT_RT patchset, including your Acked-by for the the fixe of the sleeping-in-atomic issue in patch 2/3 as well as the lost indentation now squashed in. Changes since v4b: - corrected typo, corrected email structure Changes since v4: - Patch 2/3: added Acked-by: Rodolfo Giometti <giometti@enneenne.com> Changes since v3: - Patch 2/3: fixed lost indentation on pps_kc_event() call (reported by Rodolfo Giometti <giometti@enneenne.com>) Changes since v2: - 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) Changes since v2: - 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>) 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). 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 and move sleeping calls out of the critical section. 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. On non-RT kernels there is zero behavioral change. Signed-off-by: Michael Byczkowski <by@by-online.de> Acked-by: Rodolfo Giometti <giometti@enneenne.com> Tested-by: Michael Byczkowski <by@by-online.de> 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 | 18 ++++++++++------- drivers/pps/kc.c | 22 ++++++++++---------- drivers/pps/pps.c | 16 +++++++-------- include/linux/pps_kernel.h | 2 +- 5 files changed, 56 insertions(+), 39 deletions(-) -- 2.47.3
Gentle ping on this series. v4 patches 1/3 and 3/3 carried Rodolfo's Acked-by; v5 addressed the remaining feedback on 2/3. Happy to rework anything or split the series if that helps it move forward. Adding linux-rt-users@ and Sebastian on Cc in case there's interest from the PREEMPT_RT side. > On 25. Apr 2026, at 19:18, Michael Byczkowski <by@by-online.de> wrote: > > Dear Rodolfo, Dear Andrew, > > This is v5 of the PPS PREEMPT_RT patchset, including your > Acked-by for the the fixe of the sleeping-in-atomic issue in > patch 2/3 as well as the lost indentation > now squashed in. > > Changes since v4b: - corrected typo, corrected email structure > > Changes since v4: - Patch 2/3: added Acked-by: Rodolfo Giometti > <giometti@enneenne.com> > > Changes since v3: - Patch 2/3: fixed lost indentation on pps_kc_event() > call (reported by Rodolfo Giometti <giometti@enneenne.com>) > > Changes since v2: - 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) > > Changes since v2: > - 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>) > > 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). > > 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 and move sleeping calls out of the critical section. > > 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. On non-RT kernels there is zero behavioral change. > > Signed-off-by: Michael Byczkowski <by@by-online.de> > Acked-by: Rodolfo Giometti <giometti@enneenne.com> > Tested-by: Michael Byczkowski <by@by-online.de> > > 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 | 18 ++++++++++------- > drivers/pps/kc.c | 22 ++++++++++---------- > drivers/pps/pps.c | 16 +++++++-------- > include/linux/pps_kernel.h | 2 +- > 5 files changed, 56 insertions(+), 39 deletions(-) > > -- > 2.47.3
On 2026-05-16 13:32:03 [+0200], Michael Byczkowski wrote: > Gentle ping on this series. v4 patches 1/3 and 3/3 carried Rodolfo's Acked-by; v5 addressed the remaining feedback on 2/3. Happy to rework anything or split the series if that helps it move forward. > > Adding linux-rt-users@ and Sebastian on Cc in case there's interest from the PREEMPT_RT side. Was there a follow-up to the series? Sebastian
Hi Sebastian,
Thanks very much for the review.
On 22 May 2026, at 16:13, Sebastian Andrzej Siewior wrote:
> Was there a follow-up to the series?
Yes: v6 is on the way. Calvin Owens kindly offered to relay it for
me (Apple Mail has been corrupting my patches in transit; I'm
addressing that separately), so the v6 series will arrive from him
shortly.
A summary of how I've addressed your v5 comments:
1/3 (pps-gpio handler split): commit message reworded. The new
message describes the split structurally first -- primary hardirq
handler that captures the timestamp, threaded handler that
processes the event -- and then describes the PREEMPT_RT benefit
second (no more scheduling delay between IRQ entry and timestamp
capture). The patch itself is unchanged.
2/3 (pps_kc_hardpps_lock -> raw_spinlock_t): I'd appreciate a quick
clarification here. You wrote that pps_kc_hardpps_lock "is
spinlock_t in my tree". My patch is against mainline at
0d9363a764d9 ("Input: xpad - add support for BETOP BTP-KP50B/C
controller's wireless mode"), where it is still DEFINE_SPINLOCK.
Could you point me at the branch you were looking at, so I can
check whether v6 needs to rebase on top of an existing conversion
in your tree?
Separately: I've also taken your suggestion and refactored
pps_kc_bind() (and pps_kc_remove() while I was in the file) to use
guard(raw_spinlock_irq). That eliminates the four duplicated unlock
call sites in pps_kc_bind() and removes the ambiguous bracket
nesting. Thank you for that pointer.
3/3 (pps_device.lock -> raw_spinlock_t): reordered so this comes
after the kc_hardpps conversion (which now becomes patch 2/3 in
v6), as you noted -- the previous ordering would briefly produce
a raw_spinlock holding a sleeping spinlock on PREEMPT_RT. Thank
you for catching that.
Also: thank you for auditing pps_gpio_echo() on my behalf, much
appreciated.
Best regards,
Michael
Hi Sebastian,
Quick update: v7 is on the way, addressing your v5 feedback plus
a separate bug Calvin Owens found in v6 during testing with
CONFIG_DEBUG_ATOMIC_SLEEP.
The new bug: pps_event() in kapi.c was holding pps->lock (now
raw_spinlock_t) across wake_up_interruptible_all() and
kill_fasync(), both of which internally take regular spinlock_t
locks that become rt_mutexes on PREEMPT_RT. This is the same
illegal-nesting pattern Nikolaus Buchwitz caught for the pps_kc
path between v2 and v3 -- I should have audited pps_event() for
the same issue back then and didn't. Patch 3/3 in v7 moves the
unlock above the wakeup calls.
Your v5 feedback is fully addressed:
1/3: commit message reworded to describe the split structurally
first, then the PREEMPT_RT benefit.
2/3: pps_kc_hardpps_lock conversion, now ordered before the
pps_device.lock conversion as you noted. While here, also
refactored pps_kc_bind() and pps_kc_remove() to use
guard(raw_spinlock_irq), eliminating the awkward bracket
placement you flagged.
3/3: pps_device.lock conversion, now with Calvin's wake-up
reordering. Rodolfo's Acked-by is dropped on this patch
since the change is substantive; hoping he'll re-ack.
Calvin is relaying v7 the same way he relayed v6.
Thanks again for the review,
Michael
> On 23. May 2026, at 19:58, Michael Byczkowski <by@by-online.de> wrote:
>
> Hi Sebastian,
>
> Thanks very much for the review.
>
> On 22 May 2026, at 16:13, Sebastian Andrzej Siewior wrote:
>> Was there a follow-up to the series?
>
> Yes: v6 is on the way. Calvin Owens kindly offered to relay it for
> me (Apple Mail has been corrupting my patches in transit; I'm
> addressing that separately), so the v6 series will arrive from him
> shortly.
>
> A summary of how I've addressed your v5 comments:
>
> 1/3 (pps-gpio handler split): commit message reworded. The new
> message describes the split structurally first -- primary hardirq
> handler that captures the timestamp, threaded handler that
> processes the event -- and then describes the PREEMPT_RT benefit
> second (no more scheduling delay between IRQ entry and timestamp
> capture). The patch itself is unchanged.
>
> 2/3 (pps_kc_hardpps_lock -> raw_spinlock_t): I'd appreciate a quick
> clarification here. You wrote that pps_kc_hardpps_lock "is
> spinlock_t in my tree". My patch is against mainline at
> 0d9363a764d9 ("Input: xpad - add support for BETOP BTP-KP50B/C
> controller's wireless mode"), where it is still DEFINE_SPINLOCK.
> Could you point me at the branch you were looking at, so I can
> check whether v6 needs to rebase on top of an existing conversion
> in your tree?
>
> Separately: I've also taken your suggestion and refactored
> pps_kc_bind() (and pps_kc_remove() while I was in the file) to use
> guard(raw_spinlock_irq). That eliminates the four duplicated unlock
> call sites in pps_kc_bind() and removes the ambiguous bracket
> nesting. Thank you for that pointer.
>
> 3/3 (pps_device.lock -> raw_spinlock_t): reordered so this comes
> after the kc_hardpps conversion (which now becomes patch 2/3 in
> v6), as you noted -- the previous ordering would briefly produce
> a raw_spinlock holding a sleeping spinlock on PREEMPT_RT. Thank
> you for catching that.
>
> Also: thank you for auditing pps_gpio_echo() on my behalf, much
> appreciated.
>
> Best regards,
> Michael
>
On Saturday 05/16 at 13:32 +0200, Michael Byczkowski wrote: > > On 25. Apr 2026, at 19:18, Michael Byczkowski <by@by-online.de> wrote: > > > > 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). > > > > 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 and move sleeping calls out of the critical section. > > > > 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. On non-RT kernels there is zero behavioral change. > > > > Signed-off-by: Michael Byczkowski <by@by-online.de> > > Acked-by: Rodolfo Giometti <giometti@enneenne.com> > > Tested-by: Michael Byczkowski <by@by-online.de> > > > > 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 | 18 ++++++++++------- > > drivers/pps/kc.c | 22 ++++++++++---------- > > drivers/pps/pps.c | 16 +++++++-------- > > include/linux/pps_kernel.h | 2 +- > > 5 files changed, 56 insertions(+), 39 deletions(-) > > > > -- > > 2.47.3 > > Gentle ping on this series. v4 patches 1/3 and 3/3 carried Rodolfo's > Acked-by; v5 addressed the remaining feedback on 2/3. Happy to rework > anything or split the series if that helps it move forward. Unfortunately apple mail is corrupting your patches :/ Greg KH usually applies patches for drivers/pps/, but I didn't add him here yet because the patches don't apply. If you can point me at a git branch for v5, I'd be happy to re-send the patches myself with your authorship. This is all useful for me and I'd like to help :) If you do it yourself, just make sure to add Greg to the Cc: list. Cheers, Calvin > Adding linux-rt-users@ and Sebastian on Cc in case there's interest from the > PREEMPT_RT side.
Dear Calvin, Thanks for picking this up, and yes, I’m actually a bit overwhelmed, so your help is much appreciated! And my apologies for the delay, I was traveling. The clean v5 series is at: https://github.com/by/linux-PPS/tree/pps-rt-v5-clean Three commits on top of torvalds 0d9363a764d9 (around v7.0-rc6): pps: pps-gpio: split IRQ handler into hardirq timestamper + threaded handler pps: convert pps_device.lock to raw_spinlock_t pps: kc: convert pps_kc_hardpps_lock to raw_spinlock_t Your suspicion about Apple Mail was correct: I diffed the GitHub branch against the lore mbox and the sent version has quoted-printable damage which would explain why nobody could git am it cleanly. The GitHub branch is the ground truth. Let me know how you'd like to proceed. Lore thread for context: https://lore.kernel.org/lkml/719A31CE-CA58-45C3-A013-1BFE81F724C5@by-online.de/ Thanks and best regards, Michael > On 19. May 2026, at 18:19, Calvin Owens <calvin@wbinvd.org> wrote: > > On Saturday 05/16 at 13:32 +0200, Michael Byczkowski wrote: >>> On 25. Apr 2026, at 19:18, Michael Byczkowski <by@by-online.de> wrote: >>> >>> 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). >>> >>> 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 and move sleeping calls out of the critical section. >>> >>> 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. On non-RT kernels there is zero behavioral change. >>> >>> Signed-off-by: Michael Byczkowski <by@by-online.de> >>> Acked-by: Rodolfo Giometti <giometti@enneenne.com> >>> Tested-by: Michael Byczkowski <by@by-online.de> >>> >>> 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 | 18 ++++++++++------- >>> drivers/pps/kc.c | 22 ++++++++++---------- >>> drivers/pps/pps.c | 16 +++++++-------- >>> include/linux/pps_kernel.h | 2 +- >>> 5 files changed, 56 insertions(+), 39 deletions(-) >>> >>> -- >>> 2.47.3 >> >> Gentle ping on this series. v4 patches 1/3 and 3/3 carried Rodolfo's >> Acked-by; v5 addressed the remaining feedback on 2/3. Happy to rework >> anything or split the series if that helps it move forward. > > Unfortunately apple mail is corrupting your patches :/ > > Greg KH usually applies patches for drivers/pps/, but I didn't add him > here yet because the patches don't apply. > > If you can point me at a git branch for v5, I'd be happy to re-send the > patches myself with your authorship. This is all useful for me and I'd > like to help :) > > If you do it yourself, just make sure to add Greg to the Cc: list. > > Cheers, > Calvin > >> Adding linux-rt-users@ and Sebastian on Cc in case there's interest from the >> PREEMPT_RT side.
Hi Calvin,
Thank you again for offering to relay the series. v6 is ready,
addressing all of Sebastian's review feedback on v5.
Branch: https://github.com/by/linux-PPS/tree/pps-rt-v6
Tip SHA: 013781f19756a4c6ac9c91e83b3a74a52882b707
Base: 0d9363a764d9d601a05591f9695cea8b429e9be3
("Input: xpad - add support for BETOP BTP-KP50B/C
controller's wireless mode")
To regenerate:
git fetch https://github.com/by/linux-PPS.git pps-rt-v6
git format-patch -3 \
--cover-letter \
--thread \
--subject-prefix="PATCH v6" \
--base=0d9363a764d9d601a05591f9695cea8b429e9be3 \
FETCH_HEAD
If easier, I have the four .patch files generated locally and can
attach them on request.
checkpatch.pl is clean on all three patches (0 errors, 0 warnings).
Suggested recipients (per scripts/get_maintainer.pl):
To: Rodolfo Giometti <giometti@enneenne.com>
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Clark Williams <clrkwllms@kernel.org>
Steven Rostedt <rostedt@goodmis.org>
Thomas Gleixner <tglx@linutronix.de>
linux-kernel@vger.kernel.org
linux-rt-devel@lists.linux.dev
Please add yourself with Signed-off-by as the relayer; the patches
preserve my authorship via the From: line inside each patch.
Cover letter content for the 0000 file:
----------------------------------------------------------------
Subject: [PATCH v6 0/3] pps: improve PREEMPT_RT performance
This is v6 of the PPS PREEMPT_RT patchset, addressing the review
feedback from Sebastian Andrzej Siewior on v5.
Changes since v5:
- 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:
- Patch 2/3: added Acked-by: Rodolfo Giometti <giometti@enneenne.com>
Changes since v3:
- Patch 2/3: fixed lost indentation on pps_kc_event() call
(reported by Rodolfo Giometti <giometti@enneenne.com>)
Changes since v2:
- 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@xxxxxxxxxxxx>)
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.
----------------------------------------------------------------
Thank you again. Let me know if you hit anything unexpected.
Best regards,
Michael
> On 22. May 2026, at 17:56, Michael Byczkowski <by@by-online.de> wrote:
>
> Dear Calvin,
>
> Thanks for picking this up, and yes, I’m actually a bit overwhelmed, so your help is much appreciated! And my apologies for the delay, I was traveling.
>
> The clean v5 series is at:
> https://github.com/by/linux-PPS/tree/pps-rt-v5-clean
>
> Three commits on top of torvalds 0d9363a764d9 (around v7.0-rc6):
> pps: pps-gpio: split IRQ handler into hardirq timestamper + threaded handler pps: convert pps_device.lock to raw_spinlock_t pps: kc: convert pps_kc_hardpps_lock to raw_spinlock_t
>
> Your suspicion about Apple Mail was correct: I diffed the GitHub branch against the lore mbox and the sent version has quoted-printable damage which would explain why nobody could git am it cleanly. The GitHub branch is the ground truth.
>
> Let me know how you'd like to proceed.
> Lore thread for context: https://lore.kernel.org/lkml/719A31CE-CA58-45C3-A013-1BFE81F724C5@by-online.de/
>
> Thanks and best regards,
> Michael
>
>
>> On 19. May 2026, at 18:19, Calvin Owens <calvin@wbinvd.org> wrote:
>>
>> On Saturday 05/16 at 13:32 +0200, Michael Byczkowski wrote:
>>>> On 25. Apr 2026, at 19:18, Michael Byczkowski <by@by-online.de> wrote:
>>>>
>>>> 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).
>>>>
>>>> 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 and move sleeping calls out of the critical section.
>>>>
>>>> 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. On non-RT kernels there is zero behavioral change.
>>>>
>>>> Signed-off-by: Michael Byczkowski <by@by-online.de>
>>>> Acked-by: Rodolfo Giometti <giometti@enneenne.com>
>>>> Tested-by: Michael Byczkowski <by@by-online.de>
>>>>
>>>> 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 | 18 ++++++++++-------
>>>> drivers/pps/kc.c | 22 ++++++++++----------
>>>> drivers/pps/pps.c | 16 +++++++--------
>>>> include/linux/pps_kernel.h | 2 +-
>>>> 5 files changed, 56 insertions(+), 39 deletions(-)
>>>>
>>>> --
>>>> 2.47.3
>>>
>>> Gentle ping on this series. v4 patches 1/3 and 3/3 carried Rodolfo's
>>> Acked-by; v5 addressed the remaining feedback on 2/3. Happy to rework
>>> anything or split the series if that helps it move forward.
>>
>> Unfortunately apple mail is corrupting your patches :/
>>
>> Greg KH usually applies patches for drivers/pps/, but I didn't add him
>> here yet because the patches don't apply.
>>
>> If you can point me at a git branch for v5, I'd be happy to re-send the
>> patches myself with your authorship. This is all useful for me and I'd
>> like to help :)
>>
>> If you do it yourself, just make sure to add Greg to the Cc: list.
>>
>> Cheers,
>> Calvin
>>
>>> Adding linux-rt-users@ and Sebastian on Cc in case there's interest from the
>>> PREEMPT_RT side.
>
© 2016 - 2026 Red Hat, Inc.