[2/2] sched_clock: Disable seqlock lockdep usage in sched_clock
diff mbox

Message ID 1388704274-5278-2-git-send-email-john.stultz@linaro.org
State New
Headers show

Commit Message

John Stultz Jan. 2, 2014, 11:11 p.m. UTC
Unforunately the seqlock lockdep enablmenet can't be used
in sched_clock, since the lockdep infrastructure eventually
calls into sched_clock, which causes a deadlock.

Thus, this patch changes all generic sched_clock usage
to use the raw_* methods.

Cc: Krzysztof Hałasa <khalasa@piap.pl>
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Cc: Willy Tarreau <w@1wt.eu>
Cc: Ingo Molnar <mingo@kernel.org>,
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephen Boyd <sboyd@codeaurora.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-arm-kernel@lists.infradead.org
Reported-by: Krzysztof Hałasa <khalasa@piap.pl>
Signed-off-by: John Stultz <john.stultz@linaro.org>
---
 kernel/time/sched_clock.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Stephen Boyd Jan. 3, 2014, 12:46 a.m. UTC | #1
On 01/02/14 15:11, John Stultz wrote:
> Unforunately the seqlock lockdep enablmenet can't be used

s/Unforunately/Unfortunately/
s/enablmenet/enablement/

> in sched_clock, since the lockdep infrastructure eventually
> calls into sched_clock, which causes a deadlock.
>
> Thus, this patch changes all generic sched_clock usage
> to use the raw_* methods.
>
> Cc: Krzysztof Hałasa <khalasa@piap.pl>
> Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> Cc: Willy Tarreau <w@1wt.eu>
> Cc: Ingo Molnar <mingo@kernel.org>,
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Stephen Boyd <sboyd@codeaurora.org>
> Cc: Linus Torvalds <torvalds@linux-foundation.org>
> Cc: linux-arm-kernel@lists.infradead.org
> Reported-by: Krzysztof Hałasa <khalasa@piap.pl>
> Signed-off-by: John Stultz <john.stultz@linaro.org>

Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Krzysztof =?utf-8?Q?Ha=C5=82asa?= Jan. 3, 2014, 6:05 a.m. UTC | #2
John Stultz <john.stultz@linaro.org> writes:

> Unforunately the seqlock lockdep enablmenet can't be used
> in sched_clock, since the lockdep infrastructure eventually
> calls into sched_clock, which causes a deadlock.
>
> Thus, this patch changes all generic sched_clock usage
> to use the raw_* methods.

These two patches fix the problem. Thanks to all involved.

Patch
diff mbox

diff --git a/kernel/time/sched_clock.c b/kernel/time/sched_clock.c
index 68b7993..0abb364 100644
--- a/kernel/time/sched_clock.c
+++ b/kernel/time/sched_clock.c
@@ -74,7 +74,7 @@  unsigned long long notrace sched_clock(void)
 		return cd.epoch_ns;
 
 	do {
-		seq = read_seqcount_begin(&cd.seq);
+		seq = raw_read_seqcount_begin(&cd.seq);
 		epoch_cyc = cd.epoch_cyc;
 		epoch_ns = cd.epoch_ns;
 	} while (read_seqcount_retry(&cd.seq, seq));
@@ -99,10 +99,10 @@  static void notrace update_sched_clock(void)
 			  cd.mult, cd.shift);
 
 	raw_local_irq_save(flags);
-	write_seqcount_begin(&cd.seq);
+	raw_write_seqcount_begin(&cd.seq);
 	cd.epoch_ns = ns;
 	cd.epoch_cyc = cyc;
-	write_seqcount_end(&cd.seq);
+	raw_write_seqcount_end(&cd.seq);
 	raw_local_irq_restore(flags);
 }