diff options
author | Glauber de Oliveira Costa <gcosta@redhat.com> | 2008-01-30 07:31:03 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-01-30 07:31:03 -0500 |
commit | 16e2011be67b8625c1c600f9742c2279be3c0c68 (patch) | |
tree | 38ac1d9d31360cd02c15d4b4817b653bed40b967 /arch/x86/kernel/tsc_64.c | |
parent | 751de83c0c94a5235f14cff8549d3b39e745eb2b (diff) |
x86: allow sched clock to be overridden by paravirt
This patch turns the sched_clock into native_sched_clock.
sched clock becomes a weak symbol, which can then give its
place to a paravirt definition.
Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86/kernel/tsc_64.c')
-rw-r--r-- | arch/x86/kernel/tsc_64.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/arch/x86/kernel/tsc_64.c b/arch/x86/kernel/tsc_64.c index 32edd2c50e94..204a9080af04 100644 --- a/arch/x86/kernel/tsc_64.c +++ b/arch/x86/kernel/tsc_64.c | |||
@@ -63,7 +63,7 @@ static void set_cyc2ns_scale(unsigned long cpu_khz, int cpu) | |||
63 | local_irq_restore(flags); | 63 | local_irq_restore(flags); |
64 | } | 64 | } |
65 | 65 | ||
66 | unsigned long long sched_clock(void) | 66 | unsigned long long native_sched_clock(void) |
67 | { | 67 | { |
68 | unsigned long a = 0; | 68 | unsigned long a = 0; |
69 | 69 | ||
@@ -77,6 +77,19 @@ unsigned long long sched_clock(void) | |||
77 | return cycles_2_ns(a); | 77 | return cycles_2_ns(a); |
78 | } | 78 | } |
79 | 79 | ||
80 | /* We need to define a real function for sched_clock, to override the | ||
81 | weak default version */ | ||
82 | #ifdef CONFIG_PARAVIRT | ||
83 | unsigned long long sched_clock(void) | ||
84 | { | ||
85 | return paravirt_sched_clock(); | ||
86 | } | ||
87 | #else | ||
88 | unsigned long long | ||
89 | sched_clock(void) __attribute__((alias("native_sched_clock"))); | ||
90 | #endif | ||
91 | |||
92 | |||
80 | static int tsc_unstable; | 93 | static int tsc_unstable; |
81 | 94 | ||
82 | inline int check_tsc_unstable(void) | 95 | inline int check_tsc_unstable(void) |