From: Guenter Roeck <linux@roeck-us.net>
To: Thomas Gleixner <tglx@linutronix.de>, John Stultz <jstultz@google.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
Anna-Maria Behnsen <anna-maria@linutronix.de>,
Frederic Weisbecker <frederic@kernel.org>,
Stephen Boyd <sboyd@kernel.org>,
Peter Zijlstra <peterz@infradead.org>
Subject: Re: [patch 2/2] timekeeping: Always check for negative motion
Date: Thu, 28 Nov 2024 07:30:22 -0800 [thread overview]
Message-ID: <2cb25f89-50b9-4e72-9b18-bee78e09c57c@roeck-us.net> (raw)
In-Reply-To: <87cyifxvgj.ffs@tglx>
On 11/28/24 06:51, Thomas Gleixner wrote:
> On Wed, Nov 27 2024 at 15:02, Guenter Roeck wrote:
>> On 11/27/24 14:08, John Stultz wrote:
>> An example log is at [1]. It says
>>
>> clocksource: npcm7xx-timer1: mask: 0xffffff max_cycles: 0xffffff, max_idle_ns: 597268854 ns
>
> That's a 24bit counter. So negative motion happens when the readouts are
> more than (1 << 23) apart. AFAICT the counter runs with about 14MHz, but
> I'd like to have that confirmed.
>
>> clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
>> ...
>> clocksource: Switched to clocksource npcm7xx-timer1
>>
>> I don't know where exactly it stalls; sometime after handover to userspace.
>> I'll be happy to do some more debugging, but you'll nee to let me know what
>> to look for.
>
> On that platform max_idle_ns should correspond to 50% of the counter
> width. So if both CPUs go deep idle for max_idle_ns, then the next timer
> interrupt doing the timeeeping advancement sees a delta of > (1 << 23)
> and timekeeping stalls.
>
> If my ssumption is correct, then the below should fix it.
>
Unfortunately not, it just makes things worse and stalls earlier.
[ 2.080000] Fusion MPT SAS Host driver 3.04.20
[ 2.080000] npcm7xx-ehci f0806000.usb: EHCI Host Controller
[ 2.080000] npcm7xx-ehci f0806000.usb: new USB bus registered, assigned bus number 1
[ 2.080000] npcm7xx-ehci f0806000.usb: irq 39, io mem 0xf0806000
qemu-system-arm: terminating on signal 15 from pid 17184 (/bin/bash)
There is something else going on. I reverted the offending patch and
added
+ pr_warn("###### now: %llx last: %llx mask: %llx return: %llx", now, last, mask, (now - last) & mask);
into clocksource_delta(). Here is what I get:
...
[ 3.310000] ###### now: f8c502 last: f6c964 mask: ffffff return: 1fb9e
[ 3.320000] ###### now: fbc513 last: f8b1ac mask: ffffff return: 31367
[ 3.330000] ###### now: fd368d last: fa99f4 mask: ffffff return: 29c99
[ 3.340000] ###### now: ffe8b3 last: fc823c mask: ffffff return: 36677
[ 3.350000] ###### now: 6c4f last: fe6a84 mask: ffffff return: 201cb <---
[ 3.360000] ###### now: 40427 last: 10052cc mask: ffffff return: 3b15b <---
[ 3.370000] ###### now: 43bfe last: 1023b14 mask: ffffff return: 200ea
[ 3.380000] ###### now: 6f438 last: 104235c mask: ffffff return: 2d0dc
[ 3.390000] ###### now: 8e9a3 last: 1060ba4 mask: ffffff return: 2ddff
[ 3.400000] ###### now: ac9d3 last: 107f3ec mask: ffffff return: 2d5e7
[ 3.410000] ###### now: cb9b4 last: 109dc34 mask: ffffff return: 2dd80
[ 3.420000] ###### now: e9ba2 last: 10bc47c mask: ffffff return: 2d726
[ 3.430000] ###### now: 108994 last: 10dacc4 mask: ffffff return: 2dcd0
[ 3.440000] ###### now: 1200a0 last: 10f950c mask: ffffff return: 26b94
[ 3.450000] ###### now: 14c55f last: 1117d54 mask: ffffff return: 3480b
[ 3.460000] ###### now: 15d43a last: 113659c mask: ffffff return: 26e9e
...
[ 18.100000] ###### now: f8c39f last: ceea990 mask: ffffff return: a1a0f
[ 18.290000] ###### now: 1d01af last: cf832f8 mask: ffffff return: 24ceb7
[ 18.500000] ###### now: 45b0a2 last: d1c7050 mask: ffffff return: 294052
[ 19.090000] ###### now: b5ac62 last: d447e38 mask: ffffff return: 712e2a
[ 19.110000] ###### now: b9ebc3 last: db506d0 mask: ffffff return: 4e4f3
[ 19.120000] ###### now: bb842f last: db8d760 mask: ffffff return: 2accf
[ 19.160000] ###### now: c43f2e last: dbabfa8 mask: ffffff return: 97f86
'last' advances beyond 'mask', and after that the result is always bad. The call to
clocksource_delta() is from timekeeping_advance().
Guenter
next prev parent reply other threads:[~2024-11-28 15:30 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-31 12:04 [patch 0/2] timekeeping: Fall cleaning Thomas Gleixner
2024-10-31 12:04 ` [patch 1/2] timekeeping: Remove CONFIG_DEBUG_TIMEKEEPING Thomas Gleixner
2024-11-02 4:14 ` John Stultz
2024-11-02 9:24 ` [tip: timers/core] " tip-bot2 for Thomas Gleixner
2024-10-31 12:04 ` [patch 2/2] timekeeping: Always check for negative motion Thomas Gleixner
2024-11-02 4:15 ` John Stultz
2024-11-02 9:24 ` [tip: timers/core] " tip-bot2 for Thomas Gleixner
2024-11-25 0:48 ` [patch 2/2] " Guenter Roeck
2024-11-27 22:08 ` John Stultz
2024-11-27 23:02 ` Guenter Roeck
2024-11-28 14:51 ` Thomas Gleixner
2024-11-28 15:30 ` Guenter Roeck [this message]
2024-11-29 12:16 ` Thomas Gleixner
2024-11-29 16:09 ` Guenter Roeck
2024-11-30 11:09 ` Thomas Gleixner
2024-11-30 18:21 ` Guenter Roeck
2024-12-03 10:16 ` [patch] clocksource: Make negative motion detection more robust Thomas Gleixner
2024-12-05 15:11 ` [tip: timers/urgent] " tip-bot2 for Thomas Gleixner
2024-11-28 15:57 ` [patch 2/2] timekeeping: Always check for negative motion Guenter Roeck
2024-11-28 17:13 ` Guenter Roeck
2024-11-28 17:47 ` Guenter Roeck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2cb25f89-50b9-4e72-9b18-bee78e09c57c@roeck-us.net \
--to=linux@roeck-us.net \
--cc=anna-maria@linutronix.de \
--cc=frederic@kernel.org \
--cc=jstultz@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=sboyd@kernel.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®