From: Frederic Weisbecker <frederic@kernel.org>
To: Peter Zijlstra <peterz@infradead.org>,
"Paul E . McKenney" <paulmck@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
Frederic Weisbecker <frederic@kernel.org>,
"Rafael J . Wysocki" <rafael.j.wysocki@intel.com>,
Ingo Molnar <mingo@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
stable@vger.kernel.org
Subject: [RFC PATCH 8/8] timer: Report ignored local enqueue in nohz mode
Date: Sat, 9 Jan 2021 03:05:36 +0100 [thread overview]
Message-ID: <20210109020536.127953-9-frederic@kernel.org> (raw)
In-Reply-To: <20210109020536.127953-1-frederic@kernel.org>
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 | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 6056f0374674..6c8b04272a9a 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -715,6 +715,26 @@ int get_nohz_timer_target(void)
return cpu;
}
+static void wake_idle_assert_possible(void)
+{
+#ifdef CONFIG_SCHED_DEBUG
+ /* Timers are re-evaluated after idle IRQs */
+ if (in_hardirq())
+ return;
+ /*
+ * Same as hardirqs, assuming they are executing
+ * on 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.
+ */
+ if (in_serving_softirq())
+ return;
+
+ WARN_ON_ONCE("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
@@ -729,8 +749,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
prev parent reply other threads:[~2021-01-09 2:07 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-09 2:05 [RFC PATCH 0/8] rcu/sched: Fix ignored rescheduling after rcu_eqs_enter() v3 Frederic Weisbecker
2021-01-09 2:05 ` [RFC PATCH 1/8] rcu: Remove superfluous rdp fetch Frederic Weisbecker
2021-01-09 9:03 ` Greg KH
2021-01-10 10:59 ` Frederic Weisbecker
2021-01-09 2:05 ` [RFC PATCH 2/8] rcu: Pull deferred rcuog wake up to rcu_eqs_enter() callers Frederic Weisbecker
2021-01-09 2:05 ` [RFC PATCH 3/8] rcu/nocb: Perform deferred wake up before last idle's need_resched() check Frederic Weisbecker
2021-01-09 2:05 ` [RFC PATCH 4/8] rcu/nocb: Trigger self-IPI on late deferred wake up before user resume Frederic Weisbecker
2021-01-11 12:04 ` Peter Zijlstra
2021-01-11 12:35 ` Frederic Weisbecker
2021-01-09 2:05 ` [RFC PATCH 5/8] entry: Explicitly flush pending rcuog wakeup before last rescheduling points Frederic Weisbecker
2021-01-11 0:40 ` Frederic Weisbecker
2021-01-11 5:13 ` Paul E. McKenney
2021-01-11 11:50 ` Frederic Weisbecker
2021-01-11 12:08 ` Peter Zijlstra
2021-01-11 12:54 ` Frederic Weisbecker
2021-01-09 2:05 ` [RFC PATCH 6/8] sched: Report local wake up on resched blind zone within idle loop Frederic Weisbecker
2021-01-11 12:25 ` Peter Zijlstra
2021-01-11 12:56 ` Frederic Weisbecker
2021-01-12 8:24 ` [sched] 9720a64438: WARNING:at_kernel/sched/core.c:#sched_resched_local_assert_allowed kernel test robot
[not found] ` <161062476680.19482.8402362019173198799@build.alporthouse.com>
2021-01-14 15:19 ` [RFC PATCH 6/8] sched: Report local wake up on resched blind zone within idle loop Paul E. McKenney
2021-01-09 2:05 ` [RFC PATCH 7/8] entry: Report local wake up on resched blind zone while resuming to user Frederic Weisbecker
2021-01-13 2:46 ` [entry] 8e01c5f104: unixbench.score -2.2% regression kernel test robot
2021-01-09 2:05 ` Frederic Weisbecker [this message]
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=20210109020536.127953-9-frederic@kernel.org \
--to=frederic@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=paulmck@kernel.org \
--cc=peterz@infradead.org \
--cc=rafael.j.wysocki@intel.com \
--cc=stable@vger.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;
as well as URLs for NNTP newsgroup(s).