提交 16e2011b 编写于 作者: G Glauber de Oliveira Costa 提交者: Ingo Molnar

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: NGlauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: NIngo Molnar <mingo@elte.hu>
Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
上级 751de83c
...@@ -63,7 +63,7 @@ static void set_cyc2ns_scale(unsigned long cpu_khz, int cpu) ...@@ -63,7 +63,7 @@ static void set_cyc2ns_scale(unsigned long cpu_khz, int cpu)
local_irq_restore(flags); local_irq_restore(flags);
} }
unsigned long long sched_clock(void) unsigned long long native_sched_clock(void)
{ {
unsigned long a = 0; unsigned long a = 0;
...@@ -77,6 +77,19 @@ unsigned long long sched_clock(void) ...@@ -77,6 +77,19 @@ unsigned long long sched_clock(void)
return cycles_2_ns(a); return cycles_2_ns(a);
} }
/* We need to define a real function for sched_clock, to override the
weak default version */
#ifdef CONFIG_PARAVIRT
unsigned long long sched_clock(void)
{
return paravirt_sched_clock();
}
#else
unsigned long long
sched_clock(void) __attribute__((alias("native_sched_clock")));
#endif
static int tsc_unstable; static int tsc_unstable;
inline int check_tsc_unstable(void) inline int check_tsc_unstable(void)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册