Skip to content

Commit

Permalink
x86: allow sched clock to be overridden by paravirt
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Glauber de Oliveira Costa authored and Ingo Molnar committed Jan 30, 2008
1 parent 751de83 commit 16e2011
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion arch/x86/kernel/tsc_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ static void set_cyc2ns_scale(unsigned long cpu_khz, int cpu)
local_irq_restore(flags);
}

unsigned long long sched_clock(void)
unsigned long long native_sched_clock(void)
{
unsigned long a = 0;

Expand All @@ -77,6 +77,19 @@ unsigned long long sched_clock(void)
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;

inline int check_tsc_unstable(void)
Expand Down

0 comments on commit 16e2011

Please sign in to comment.