diff options
author | Andy Lutomirski <luto@MIT.EDU> | 2011-05-23 09:31:28 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2011-05-24 08:51:29 -0400 |
commit | 44259b1abfaa8bb819d25d41d71e8e33e25dd36a (patch) | |
tree | 6255324c0bf2fef17ec3f7d92cdc88d9bbed44a3 /arch/x86/kernel/tsc.c | |
parent | 0f51f2852ccf0fe38a02d340d0ba625e8e32a863 (diff) |
x86-64: Move vread_tsc into a new file with sensible options
vread_tsc is short and hot, and it's userspace code so the usual
reasons to enable -pg and turn off sibling calls don't apply.
(OK, turning off sibling calls has no effect. But it might
someday...)
As an added benefit, tsc.c is profilable now.
Signed-off-by: Andy Lutomirski <luto@mit.edu>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Borislav Petkov <bp@amd64.org>
Link: http://lkml.kernel.org/r/%3C99c6d7f5efa3ccb65b4ac6eb443e1ab7bad47d7b.1306156808.git.luto%40mit.edu%3E
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86/kernel/tsc.c')
-rw-r--r-- | arch/x86/kernel/tsc.c | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c index 24249a5360b6..6cc6922262af 100644 --- a/arch/x86/kernel/tsc.c +++ b/arch/x86/kernel/tsc.c | |||
@@ -763,40 +763,6 @@ static cycle_t read_tsc(struct clocksource *cs) | |||
763 | ret : clocksource_tsc.cycle_last; | 763 | ret : clocksource_tsc.cycle_last; |
764 | } | 764 | } |
765 | 765 | ||
766 | #ifdef CONFIG_X86_64 | ||
767 | static cycle_t __vsyscall_fn vread_tsc(void) | ||
768 | { | ||
769 | cycle_t ret; | ||
770 | u64 last; | ||
771 | |||
772 | /* | ||
773 | * Empirically, a fence (of type that depends on the CPU) | ||
774 | * before rdtsc is enough to ensure that rdtsc is ordered | ||
775 | * with respect to loads. The various CPU manuals are unclear | ||
776 | * as to whether rdtsc can be reordered with later loads, | ||
777 | * but no one has ever seen it happen. | ||
778 | */ | ||
779 | rdtsc_barrier(); | ||
780 | ret = (cycle_t)vget_cycles(); | ||
781 | |||
782 | last = VVAR(vsyscall_gtod_data).clock.cycle_last; | ||
783 | |||
784 | if (likely(ret >= last)) | ||
785 | return ret; | ||
786 | |||
787 | /* | ||
788 | * GCC likes to generate cmov here, but this branch is extremely | ||
789 | * predictable (it's just a funciton of time and the likely is | ||
790 | * very likely) and there's a data dependence, so force GCC | ||
791 | * to generate a branch instead. I don't barrier() because | ||
792 | * we don't actually need a barrier, and if this function | ||
793 | * ever gets inlined it will generate worse code. | ||
794 | */ | ||
795 | asm volatile (""); | ||
796 | return last; | ||
797 | } | ||
798 | #endif | ||
799 | |||
800 | static void resume_tsc(struct clocksource *cs) | 766 | static void resume_tsc(struct clocksource *cs) |
801 | { | 767 | { |
802 | clocksource_tsc.cycle_last = 0; | 768 | clocksource_tsc.cycle_last = 0; |