[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1357610913-1080-31-git-send-email-fweisbec@gmail.com>
Date: Tue, 8 Jan 2013 03:08:30 +0100
From: Frederic Weisbecker <fweisbec@...il.com>
To: LKML <linux-kernel@...r.kernel.org>
Cc: Frederic Weisbecker <fweisbec@...il.com>,
Alessio Igor Bogani <abogani@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Chris Metcalf <cmetcalf@...era.com>,
Christoph Lameter <cl@...ux.com>,
Geoff Levand <geoff@...radead.org>,
Gilad Ben Yossef <gilad@...yossef.com>,
Hakan Akkan <hakanakkan@...il.com>,
Ingo Molnar <mingo@...nel.org>,
Li Zhong <zhong@...ux.vnet.ibm.com>,
Namhyung Kim <namhyung.kim@....com>,
"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
Paul Gortmaker <paul.gortmaker@...driver.com>,
Peter Zijlstra <peterz@...radead.org>,
Steven Rostedt <rostedt@...dmis.org>,
Thomas Gleixner <tglx@...utronix.de>
Subject: [PATCH 30/33] sched: Debug nohz rq clock
The runqueue clock is supposed to be periodically updated by the
tick. On full dynticks CPU we call update_nohz_rq_clock() before
reading it. Now the scheduler code is complicated enough that we
may miss some update_nohz_rq_clock() calls before reading the
runqueue clock.
This therefore introduce a new debugging feature that detects
when the rq clock is stale due to missing updates on full
dynticks CPUs.
This can be later expanded to debug stale clocks on dynticks-idle
CPUs.
Signed-off-by: Frederic Weisbecker <fweisbec@...il.com>
Cc: Alessio Igor Bogani <abogani@...nel.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>
Cc: Chris Metcalf <cmetcalf@...era.com>
Cc: Christoph Lameter <cl@...ux.com>
Cc: Geoff Levand <geoff@...radead.org>
Cc: Gilad Ben Yossef <gilad@...yossef.com>
Cc: Hakan Akkan <hakanakkan@...il.com>
Cc: Ingo Molnar <mingo@...nel.org>
Cc: Li Zhong <zhong@...ux.vnet.ibm.com>
Cc: Namhyung Kim <namhyung.kim@....com>
Cc: Paul E. McKenney <paulmck@...ux.vnet.ibm.com>
Cc: Paul Gortmaker <paul.gortmaker@...driver.com>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Steven Rostedt <rostedt@...dmis.org>
Cc: Thomas Gleixner <tglx@...utronix.de>
---
kernel/sched/sched.h | 23 +++++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index e1bac76..0fef0b3 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -502,16 +502,39 @@ DECLARE_PER_CPU(struct rq, runqueues);
#define cpu_curr(cpu) (cpu_rq(cpu)->curr)
#define raw_rq() (&__raw_get_cpu_var(runqueues))
+static inline void rq_clock_check(struct rq *rq)
+{
+#if defined(CONFIG_SCHED_DEBUG) && defined(CONFIG_NO_HZ_FULL)
+ unsigned long long clock;
+ unsigned long flags;
+ int cpu;
+
+ cpu = cpu_of(rq);
+ if (!tick_nohz_full_cpu(cpu) || rq->curr == rq->idle)
+ return;
+
+ local_irq_save(flags);
+ clock = sched_clock_cpu(cpu_of(rq));
+ local_irq_restore(flags);
+
+ if (abs(clock - rq->clock) > (TICK_NSEC * 3))
+ WARN_ON_ONCE(1);
+#endif
+}
+
static inline u64 rq_clock(struct rq *rq)
{
+ rq_clock_check(rq);
return rq->clock;
}
static inline u64 rq_clock_task(struct rq *rq)
{
+ rq_clock_check(rq);
return rq->clock_task;
}
+
#ifdef CONFIG_SMP
#define rcu_dereference_check_sched_domain(p) \
--
1.7.5.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists