From: Johannes Berg <johannes@sipsolutions.net>
To: Vincent Whitchurch <vincent.whitchurch@axis.com>
Cc: linux-um@lists.infradead.org, linux-kernel@vger.kernel.org,
Anna-Maria Gleixner <anna-maria@linutronix.de>,
Thomas Gleixner <tglx@linutronix.de>,
Frederic Weisbecker <frederic@kernel.org>
Subject: Re: UML time-travel warning from __run_timers
Date: Sat, 02 Apr 2022 16:09:29 +0200 [thread overview]
Message-ID: <84f9d627092660c38400b607198c3b83f795be7f.camel@sipsolutions.net> (raw)
In-Reply-To: <20220330110156.GA9250@axis.com>
Hi Vincent,
> [10737482.720000][ C0] ------------[ cut here ]------------
> [10737482.720000][ C0] WARNING: CPU: 0 PID: 0 at kernel/time/timer.c:1729 __run_timers+0x36d/0x380
>
[for those new on the thread, full message and config here:
https://lore.kernel.org/r/20220330110156.GA9250@axis.com]
I think maybe you found a bug in the timers code?
Your config has CONFIG_NO_HZ_COMMON, so we have both BASE_STD and
BASE_DEF.
Evidently, in your config, we *never* have any timer with
TIMER_DEFERRABLE, which would put it into BASE_DEF.
(I put a WARN_ON into get_timer_cpu_base() and get_timer_this_cpu_base()
in the if, and it never triggered; I guess my config has something that
creates a deferrable timer, so it didn't trigger, but I didn't check
that now.)
Therefore, base->next_expiry never changes or something?
At init, we get
init_timer_cpu(0) base 0 clk=0xffff8ad0, next_expiry=0x13fff8acf
init_timer_cpu(0) base 1 clk=0xffff8ad0, next_expiry=0x13fff8acf
which makes sense, jiffies is set up to wrap very quickly after boot.
The warning triggers when we have jiffies=0x13fff9600, so it's just
after the "next_expiry", so in this code:
static inline void __run_timers(struct timer_base *base)
{
struct hlist_head heads[LVL_DEPTH];
int levels;
if (time_before(jiffies, base->next_expiry))
return;
we no longer return. Previously, we've *never* executed past that if for
BASE_DEF.
But we never touched this timer base nor did we ever want to recalc it I
guess, so
WARN_ON_ONCE(!levels && !base->next_expiry_recalc);
triggers.
I thought about changing that condition to
if (time_before(...) || !base->timers_pending)
return;
and that *does* make the splat go away, but I fear that might make it
not recalculate when needed, so perhaps in the condition we should have
if (time_before(...) ||
(!base->timers_pending && !base->next_expiry_recalc))
return;
or something? (which also avoids hitting the warning)
But I really don't know anything about this code, so adding a few CCs.
Can you help?
Thanks,
johannes
next prev parent reply other threads:[~2022-04-02 14:09 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-30 11:01 Vincent Whitchurch
2022-03-30 12:33 ` Johannes Berg
2022-04-02 14:09 ` Johannes Berg [this message]
2022-04-02 14:17 ` Johannes Berg
2022-04-03 16:18 ` Thomas Gleixner
2022-04-03 17:13 ` Johannes Berg
2022-04-03 17:19 ` Johannes Berg
2022-04-03 23:23 ` Thomas Gleixner
2022-04-03 19:51 ` Thomas Gleixner
2022-04-04 7:02 ` Johannes Berg
2022-04-04 8:32 ` Thomas Gleixner
2022-04-04 8:37 ` Johannes Berg
2022-04-04 12:17 ` Thomas Gleixner
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=84f9d627092660c38400b607198c3b83f795be7f.camel@sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=anna-maria@linutronix.de \
--cc=frederic@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-um@lists.infradead.org \
--cc=tglx@linutronix.de \
--cc=vincent.whitchurch@axis.com \
/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®