]> git.baikalelectronics.ru Git - kernel.git/commit
timers, sched/clock: Match scope of read and write seqcounts
authorDaniel Thompson <daniel.thompson@linaro.org>
Thu, 26 Mar 2015 19:23:22 +0000 (12:23 -0700)
committerIngo Molnar <mingo@kernel.org>
Fri, 27 Mar 2015 07:33:56 +0000 (08:33 +0100)
commit549c16667c1389771ab51c41d699b1ae3a94b8b6
treeaab1f5735303d0fae22a7208784e99f7a323a66a
parent8d664c83cc6af93410465aa0dba7d9be190dcf24
timers, sched/clock: Match scope of read and write seqcounts

Currently the scope of the raw_write_seqcount_begin/end() in
sched_clock_register() far exceeds the scope of the read section
in sched_clock(). This gives the impression of safety during
cursory review but achieves little.

Note that this is likely to be a latent issue at present because
sched_clock_register() is typically called before we enable
interrupts, however the issue does risk bugs being needlessly
introduced as the code evolves.

This patch fixes the problem by increasing the scope of the read
locking performed by sched_clock() to cover all data modified by
sched_clock_register.

We also improve clarity by moving writes to struct clock_data
that do not impact sched_clock() outside of the critical
section.

Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
[ Reworked it slightly to apply to tip/timers/core]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Will Deacon <will.deacon@arm.com>
Link: http://lkml.kernel.org/r/1427397806-20889-2-git-send-email-john.stultz@linaro.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
kernel/time/sched_clock.c