aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm64/kernel
diff options
context:
space:
mode:
authorWill Deacon <will.deacon@arm.com>2012-11-29 17:11:51 -0500
committerCatalin Marinas <catalin.marinas@arm.com>2012-12-05 06:20:03 -0500
commitf84a935db47d7f261c025ba9eaa7700261257469 (patch)
tree0df122141ab5862220184f5f6746038daf925cf3 /arch/arm64/kernel
parent251db45336c8fb5fd0c36f71aabc6950e427110f (diff)
arm64: vdso: check sequence counter even for coarse realtime operations
When returning coarse realtime values from clock_gettime, we must still check the sequence counter to ensure that the kernel does not update the vdso datapage whilst we are loading the coarse timespec as this could potentially result in time appearing to go backwards. This patch delays the coarse realtime check until after we have loaded successfully from the vdso datapage. This does mean that we always load the wtm timespec, but conditionalising the load and adding an extra sequence test is unlikely to buy us anything other than messy code, particularly as the sequence test implies a read barrier. Signed-off-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Diffstat (limited to 'arch/arm64/kernel')
-rw-r--r--arch/arm64/kernel/vdso/gettimeofday.S6
1 files changed, 3 insertions, 3 deletions
diff --git a/arch/arm64/kernel/vdso/gettimeofday.S b/arch/arm64/kernel/vdso/gettimeofday.S
index 05c1229a2874..3a7bdcd55ab6 100644
--- a/arch/arm64/kernel/vdso/gettimeofday.S
+++ b/arch/arm64/kernel/vdso/gettimeofday.S
@@ -124,15 +124,15 @@ ENTRY(__kernel_clock_gettime)
1243: seqcnt_acquire 1243: seqcnt_acquire
125 ldp x9, x10, [vdso_data, #VDSO_XTIME_CRS_SEC] 125 ldp x9, x10, [vdso_data, #VDSO_XTIME_CRS_SEC]
126 126
127 cmp w0, #CLOCK_MONOTONIC_COARSE
128 b.ne 6f
129
130 /* Get wtm timespec. */ 127 /* Get wtm timespec. */
131 ldp x14, x15, [vdso_data, #VDSO_WTM_CLK_SEC] 128 ldp x14, x15, [vdso_data, #VDSO_WTM_CLK_SEC]
132 129
133 /* Check the sequence counter. */ 130 /* Check the sequence counter. */
134 seqcnt_read w13 131 seqcnt_read w13
135 seqcnt_check w13, 3b 132 seqcnt_check w13, 3b
133
134 cmp w0, #CLOCK_MONOTONIC_COARSE
135 b.ne 6f
1364: 1364:
137 /* Add on wtm timespec. */ 137 /* Add on wtm timespec. */
138 add x9, x9, x14 138 add x9, x9, x14