summaryrefslogtreecommitdiffstats
path: root/drivers/oprofile/oprofile_stats.h
diff options
context:
space:
mode:
authorStephen Boyd <sboyd@codeaurora.org>2014-02-17 10:45:36 -0800
committerThomas Gleixner <tglx@linutronix.de>2014-02-19 17:07:22 +0100
commit5ae8aabeaec3fe69c4fb21cbe5b17b72b35b5892 (patch)
tree5cd5d476049486e228d60e59de46811f4161f1dd /drivers/oprofile/oprofile_stats.h
parent6d0abeca3242a88cab8232e4acd7e2bf088f3bc2 (diff)
downloadlinux-stable-5ae8aabeaec3fe69c4fb21cbe5b17b72b35b5892.tar.gz
linux-stable-5ae8aabeaec3fe69c4fb21cbe5b17b72b35b5892.tar.bz2
linux-stable-5ae8aabeaec3fe69c4fb21cbe5b17b72b35b5892.zip
sched_clock: Prevent callers from seeing half-updated data
The generic sched_clock registration function was previously done lockless, due to the fact that it was expected to be called only once. However, now there are systems that may register multiple sched_clock sources, for which the lack of locking has casued problems: If two sched_clock sources are registered we may end up in a situation where a call to sched_clock() may be accessing the epoch cycle count for the old counter and the cycle count for the new counter. This can lead to confusing results where sched_clock() values jump and then are reset to 0 (due to the way the registration function forces the epoch_ns to be 0). Fix this by reorganizing the registration function to hold the seqlock for as short a time as possible while we update the clock_data structure for a new counter. We also put any accumulated time into epoch_ns instead of resetting the time to 0 so that the clock doesn't reset after each successful registration. [jstultz: Added extra context to the commit message] Reported-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Ingo Molnar <mingo@kernel.org> Cc: Will Deacon <will.deacon@arm.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Josh Cartwright <joshc@codeaurora.org> Link: http://lkml.kernel.org/r/1392662736-7803-2-git-send-email-john.stultz@linaro.org Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'drivers/oprofile/oprofile_stats.h')
0 files changed, 0 insertions, 0 deletions