Skip to content

Commit

Permalink
x86/xen/time: set pvclock flags on xen_time_init()
Browse files Browse the repository at this point in the history
Specifically check for PVCLOCK_TSC_STABLE_BIT and if this bit is set,
then set it too on pvclock flags. This allows Xen clocksource to use it
and thus speeding up xen_clocksource_read() callers (i.e. sched_clock())

Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
  • Loading branch information
Joao Martins authored and Boris Ostrovsky committed Nov 8, 2017
1 parent 9f08890 commit b888808
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions arch/x86/xen/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ static const struct pv_time_ops xen_time_ops __initconst = {

static void __init xen_time_init(void)
{
struct pvclock_vcpu_time_info *pvti;
int cpu = smp_processor_id();
struct timespec tp;

Expand All @@ -395,6 +396,14 @@ static void __init xen_time_init(void)

setup_force_cpu_cap(X86_FEATURE_TSC);

/*
* We check ahead on the primary time info if this
* bit is supported hence speeding up Xen clocksource.
*/
pvti = &__this_cpu_read(xen_vcpu)->time;
if (pvti->flags & PVCLOCK_TSC_STABLE_BIT)
pvclock_set_flags(PVCLOCK_TSC_STABLE_BIT);

xen_setup_runstate_info(cpu);
xen_setup_timer(cpu);
xen_setup_cpu_clockevents();
Expand Down

0 comments on commit b888808

Please sign in to comment.