[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <231dbdc2eeb094c2d8ec847cb4ea869510c79ca7.1242299014.git.ptesarik@suse.cz>
Date: Thu, 14 May 2009 15:07:09 +0200
From: Petr Tesarik <ptesarik@...e.cz>
To: linux-kernel@...r.kernel.org, linux-x86_64@...r.kernel.org,
mingo@...e.hu, andi@...stfloor.org
Cc: zwane@....linux.org.uk, roland@...hat.com,
Petr Tesarik <ptesarik@...e.cz>
Subject: [PATCH 4/4] x86: add rdtsc_barrier() to vgetns()
Commit cb9e35dce94a1b9c59d46224e8a94377d673e204 removed
rdtsc_barrier() from vget_cycles() and moved it to
do_vgettimeofday().
AFAICS the same is also needed for vgetns(), because it may
call vread_tsc(), which in turn reads the TSC counter
using vget_cycles().
Signed-off-by: Petr Tesarik <ptesarik@...e.cz>
---
arch/x86/vdso/vclock_gettime.c | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/arch/x86/vdso/vclock_gettime.c b/arch/x86/vdso/vclock_gettime.c
index 6a40b78..ab1ae6c 100644
--- a/arch/x86/vdso/vclock_gettime.c
+++ b/arch/x86/vdso/vclock_gettime.c
@@ -36,11 +36,14 @@ notrace static long vdso_fallback_gettime(long clock, struct timespec *ts)
notrace static inline long vgetns(void)
{
- long v;
- cycles_t (*vread)(void);
+ cycle_t now, cycle_delta;
+ cycle_t (*vread)(void);
vread = gtod->clock.vread;
- v = (vread() - gtod->clock.cycle_last) & gtod->clock.mask;
- return (v * gtod->clock.mult) >> gtod->clock.shift;
+ rdtsc_barrier();
+ now = vread();
+ rdtsc_barrier();
+ cycle_delta = (now - gtod->clock.cycle_last) & gtod->clock.mask;
+ return (cycle_delta * gtod->clock.mult) >> gtod->clock.shift;
}
notrace static noinline int do_realtime(struct timespec *ts)
--
1.6.0.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists