From: Jan Beulich Date: Thu, 4 Aug 2016 08:04:29 +0000 (+0200) Subject: x86/time: fold recurring code X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~621 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=6dd04c7579dddb88fd0131ed5eb6fc636095f36c;p=xen.git x86/time: fold recurring code Common code between time_calibration_{std,tsc}_rendezvous() can better live in a single place, eliminating the risk of adjusting one without the other. Signed-off-by: Jan Beulich Tested-by: Dario Faggioli Tested-by: Joao Martins Reviewed-by: Andrew Cooper --- diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c index 33b51d894e..7311058b18 100644 --- a/xen/arch/x86/time.c +++ b/xen/arch/x86/time.c @@ -1263,6 +1263,18 @@ struct calibration_rendezvous { u64 master_tsc_stamp; }; +static void +time_calibration_rendezvous_tail(const struct calibration_rendezvous *r) +{ + struct cpu_calibration *c = &this_cpu(cpu_calibration); + + c->local_tsc_stamp = rdtsc_ordered(); + c->stime_local_stamp = get_s_time_fixed(c->local_tsc_stamp); + c->stime_master_stamp = r->master_stime; + + raise_softirq(TIME_CALIBRATE_SOFTIRQ); +} + /* * Keep TSCs in sync when they run at the same rate, but may stop in * deep-sleep C states. @@ -1270,7 +1282,6 @@ struct calibration_rendezvous { static void time_calibration_tsc_rendezvous(void *_r) { int i; - struct cpu_calibration *c = &this_cpu(cpu_calibration); struct calibration_rendezvous *r = _r; unsigned int total_cpus = cpumask_weight(&r->cpu_calibration_map); @@ -1311,17 +1322,12 @@ static void time_calibration_tsc_rendezvous(void *_r) } } - c->local_tsc_stamp = rdtsc_ordered(); - c->stime_local_stamp = get_s_time_fixed(c->local_tsc_stamp); - c->stime_master_stamp = r->master_stime; - - raise_softirq(TIME_CALIBRATE_SOFTIRQ); + time_calibration_rendezvous_tail(r); } /* Ordinary rendezvous function which does not modify TSC values. */ static void time_calibration_std_rendezvous(void *_r) { - struct cpu_calibration *c = &this_cpu(cpu_calibration); struct calibration_rendezvous *r = _r; unsigned int total_cpus = cpumask_weight(&r->cpu_calibration_map); @@ -1341,11 +1347,7 @@ static void time_calibration_std_rendezvous(void *_r) mb(); /* receive signal /then/ read r->master_stime */ } - c->local_tsc_stamp = rdtsc_ordered(); - c->stime_local_stamp = get_s_time_fixed(c->local_tsc_stamp); - c->stime_master_stamp = r->master_stime; - - raise_softirq(TIME_CALIBRATE_SOFTIRQ); + time_calibration_rendezvous_tail(r); } static void (*time_calibration_rendezvous_fn)(void *) =