diff options
author | Joonsoo Kim <js1304@gmail.com> | 2013-02-09 04:52:45 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-02-28 13:38:38 (GMT) |
commit | db0f5de3c8c38c4a59b829c0117440bb851fbe0d (patch) | |
tree | 67a96e4287981c4a97541de3e747df242205c4db /arch/powerpc | |
parent | 97730e9fae095b8a6da1d4b3494cc648a4c35bb1 (diff) | |
download | linux-fsl-qoriq-db0f5de3c8c38c4a59b829c0117440bb851fbe0d.tar.xz |
ARM: 7643/1: sched: correct update_sched_clock()
commit 7c4e9ced424be4d36df6a3e3825763e97ee97607 upstream.
If we want load epoch_cyc and epoch_ns atomically,
we should update epoch_cyc_copy first of all.
This notify reader that updating is in progress.
If we update epoch_cyc first like as current implementation,
there is subtle error case.
Look at the below example.
<Initial Condition>
cyc = 9
ns = 900
cyc_copy = 9
== CASE 1 ==
<CPU A = reader> <CPU B = updater>
write cyc = 10
read cyc = 10
read ns = 900
write ns = 1000
write cyc_copy = 10
read cyc_copy = 10
output = (10, 900)
== CASE 2 ==
<CPU A = reader> <CPU B = updater>
read cyc = 9
write cyc = 10
write ns = 1000
read ns = 1000
read cyc_copy = 9
write cyc_copy = 10
output = (9, 1000)
If atomic read is ensured, output should be (9, 900) or (10, 1000).
But, output in example case are not.
So, change updating sequence in order to correct this problem.
Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'arch/powerpc')
0 files changed, 0 insertions, 0 deletions