From: Frederic Weisbecker <frederic@kernel.org>
To: "Paul E. McKenney" <paulmck@kernel.org>
Cc: linux-kernel@vger.kernel.org, peterz@infradead.org,
tglx@linutronix.de, mingo@kernel.org
Subject: Re: timer: Report ignored local enqueue in nohz mode?
Date: Fri, 5 Mar 2021 14:41:11 +0100 [thread overview]
Message-ID: <20210305134111.GA142352@lothringen> (raw)
In-Reply-To: <20210303194945.GA20866@paulmck-ThinkPad-P72>
On Wed, Mar 03, 2021 at 11:49:45AM -0800, Paul E. McKenney wrote:
> Hello, Frederic!
>
> I don't see the following commit in mainline, but figured I should
> check with you guys to see if the problem got solved in some other way.
> Unless I hear otherwise, I will continue to carry this patch in -rcu
> and will send it along for the v5.13 merge window.
I have it included in a nohz series I'm about to post but since RCU is the
motivation behind doing this, it's fine if you carry it.
I've just modified it a bit after a review from Peter:
---
From 7876725b8631147967bb9e65158ef1cb2bb94372 Mon Sep 17 00:00:00 2001
From: Frederic Weisbecker <frederic@kernel.org>
Date: Fri, 8 Jan 2021 13:50:12 +0100
Subject: [PATCH] timer: Report ignored local enqueue in nohz mode
Enqueuing a local timer after the tick has been stopped will result in
the timer being ignored until the next random interrupt.
Perform sanity checks to report these situations.
Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar<mingo@kernel.org>
Cc: Paul E. McKenney <paulmck@kernel.org>
Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
kernel/sched/core.c | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index ca2bb629595f..24552911f92b 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -674,6 +674,22 @@ int get_nohz_timer_target(void)
return cpu;
}
+/* Make sure the timer won't be ignored in dynticks-idle case */
+static void wake_idle_assert_possible(void)
+{
+#ifdef CONFIG_SCHED_DEBUG
+ /*
+ * Timers are re-evaluated after idle IRQs. In case of softirq,
+ * we assume IRQ tail. Ksoftirqd shouldn't reach here as the
+ * timer base wouldn't be idle. And inline softirq processing
+ * after a call to local_bh_enable() within idle loop sound too
+ * fun to be considered here.
+ */
+ WARN_ONCE(in_task(),
+ "Late timer enqueue may be ignored\n");
+#endif
+}
+
/*
* When add_timer_on() enqueues a timer into the timer wheel of an
* idle CPU then this timer might expire before the next timer event
@@ -688,8 +704,10 @@ static void wake_up_idle_cpu(int cpu)
{
struct rq *rq = cpu_rq(cpu);
- if (cpu == smp_processor_id())
+ if (cpu == smp_processor_id()) {
+ wake_idle_assert_possible();
return;
+ }
if (set_nr_and_not_polling(rq->idle))
smp_send_reschedule(cpu);
--
2.25.1
next prev parent reply other threads:[~2021-03-05 13:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-03 19:49 Paul E. McKenney
2021-03-05 13:41 ` Frederic Weisbecker [this message]
2021-03-05 23:48 ` Paul E. McKenney
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=20210305134111.GA142352@lothringen \
--to=frederic@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=paulmck@kernel.org \
--cc=peterz@infradead.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
Powered by JetHome