Files
linux/arch/arm/kernel
Joonsoo Kim 7c4e9ced42 ARM: 7643/1: sched: correct update_sched_clock()
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.

Cc: <stable@vger.kernel.org>
Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2013-02-11 17:33:08 +00:00
..
2012-03-28 18:30:01 +01:00
2013-01-03 15:57:04 -08:00
2012-07-01 21:59:19 +08:00
2012-03-24 09:38:56 +00:00
2012-10-09 20:24:24 +02:00
2010-10-29 13:14:40 -05:00
2012-10-11 10:55:04 +01:00
2012-11-09 11:37:26 +00:00
2012-10-01 09:58:18 -04:00
2012-03-28 18:30:01 +01:00
2012-03-28 18:30:01 +01:00