[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <020f01dc227f$03e40b60$0bac2220$@gmx.de>
Date: Wed, 10 Sep 2025 20:16:22 +0200
From: <markus.stockhausen@....de>
To: "'Daniel Lezcano'" <daniel.lezcano@...aro.org>,
<tglx@...utronix.de>
Cc: <howels@...thatwemight.be>,
<bjorn@...k.no>,
<linux-kernel@...r.kernel.org>
Subject: AW: AW: [PATCH 1/4] clocksource/drivers/timer-rtl-otto: work around dying timers
> Von: Daniel Lezcano <daniel.lezcano@...aro.org>
> Gesendet: Mittwoch, 10. September 2025 18:39
>
> > What I tried:
> >
> > 1. Read out the current (remaining) timer value: In the error cases
> > this can give any value between 1 (=320ns) and 15 (=4800ns).
> >
> > 2. Check if IRQ flag is already set and IRQ might trigger next. This was
> > never the case.
>
> It would have been interesting to check if we are in the time bug range
> to wait with a delay (5us), check the IRQ flag as the current timer
> should have expired, then set the counter and recheck the IRQ flag.
It's been 2 months that I dived deep into this case. Finding a
reproducer, adding lightweight logging and try&error a solution
was really hard. In the end I was happy to have a fix that was
intensively tested.
For some notes see
https://github.com/openwrt/openwrt/pull/19468#issuecomment-3095570297
From what I remember:
- I started on a multithreading SoC and went over to a single
core SoC to reduce side effects during analysis.
- The timer never died when it was reprogrammed from
an interrupt of a just finished timer. The reason was always
a reprogramming from outside the interrupt->reprogram
call sequence.
- Reprogramming always worked fine. A timer with <5us left, was
restarted with a timer >5us. The new timer started to count.
No interrupt flag seemed to be magically toggled during this
process. There was no active IRQ notification directly after the
reprogramming. That was how I expected it.
- But in rare cases the new timer did not trigger the subsequent
interrupt. I was totally confused that the future interrupt of
a newly started timer did not work.
Graphically:
- timer run ---+-------------------->|
| issue stop & start
| timer run ------------------>|
| no IRQ here
Conclusion was for me: If we "kill" a running timer and restart
it and it will not fire an interrupt after the newly set time,
then something must be somehow broken. The ending timer and
the stop/start sequence (that consists of two register writes)
have some interference. Whatever it might be.
Markus
Powered by blists - more mailing lists