Skip to content

Commit

Permalink
sched_clock: Disable seqlock lockdep usage in sched_clock()
Browse files Browse the repository at this point in the history
Unfortunately the seqlock lockdep enablement 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.

Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Reported-by: Krzysztof Hałasa <khalasa@piap.pl>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Cc: Willy Tarreau <w@1wt.eu>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1388704274-5278-2-git-send-email-john.stultz@linaro.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
  • Loading branch information
John Stultz authored and Ingo Molnar committed Jan 12, 2014
1 parent 0c3351d commit 7a06c41
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions kernel/time/sched_clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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);
}

Expand Down

0 comments on commit 7a06c41

Please sign in to comment.