From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Jan Beulich" Subject: [PATCH 7/8] x86/time: fold recurring code Date: Wed, 15 Jun 2016 04:30:01 -0600 Message-ID: <57614A4902000078000F53AD@prv-mh.provo.novell.com> References: <576140F302000078000F52FE@prv-mh.provo.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part497F7239.1__=" Return-path: Received: from mail6.bemta6.messagelabs.com ([85.158.143.247]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bD85E-00086I-VX for xen-devel@lists.xenproject.org; Wed, 15 Jun 2016 10:30:05 +0000 In-Reply-To: <576140F302000078000F52FE@prv-mh.provo.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" To: xen-devel Cc: Andrew Cooper , Dario Faggioli , Joao Martins List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part497F7239.1__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline 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 --- a/xen/arch/x86/time.c +++ b/xen/arch/x86/time.c @@ -1263,6 +1263,18 @@ struct calibration_rendezvous { u64 master_tsc_stamp; }; =20 +static void +time_calibration_rendezvous_tail(const struct calibration_rendezvous *r) +{ + struct cpu_calibration *c =3D &this_cpu(cpu_calibration); + + c->local_tsc_stamp =3D rdtsc_ordered(); + c->stime_local_stamp =3D get_s_time_fixed(c->local_tsc_stamp); + c->stime_master_stamp =3D 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 =3D &this_cpu(cpu_calibration); struct calibration_rendezvous *r =3D _r; unsigned int total_cpus =3D cpumask_weight(&r->cpu_calibration_map); =20 @@ -1311,17 +1322,12 @@ static void time_calibration_tsc_rendezv } } =20 - c->local_tsc_stamp =3D rdtsc_ordered(); - c->stime_local_stamp =3D get_s_time_fixed(c->local_tsc_stamp); - c->stime_master_stamp =3D r->master_stime; - - raise_softirq(TIME_CALIBRATE_SOFTIRQ); + time_calibration_rendezvous_tail(r); } =20 /* Ordinary rendezvous function which does not modify TSC values. */ static void time_calibration_std_rendezvous(void *_r) { - struct cpu_calibration *c =3D &this_cpu(cpu_calibration); struct calibration_rendezvous *r =3D _r; unsigned int total_cpus =3D cpumask_weight(&r->cpu_calibration_map); =20 @@ -1341,11 +1347,7 @@ static void time_calibration_std_rendezv mb(); /* receive signal /then/ read r->master_stime */ } =20 - c->local_tsc_stamp =3D rdtsc_ordered(); - c->stime_local_stamp =3D get_s_time_fixed(c->local_tsc_stamp); - c->stime_master_stamp =3D r->master_stime; - - raise_softirq(TIME_CALIBRATE_SOFTIRQ); + time_calibration_rendezvous_tail(r); } =20 static void (*time_calibration_rendezvous_fn)(void *) =3D --=__Part497F7239.1__= Content-Type: text/plain; name="x86-time-calibration-fold.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="x86-time-calibration-fold.patch" x86/time: fold recurring code=0A=0ACommon code between time_calibration_{st= d,tsc}_rendezvous() can better=0Alive in a single place, eliminating the = risk of adjusting one without=0Athe other.=0A=0ASigned-off-by: Jan Beulich = =0A=0A--- a/xen/arch/x86/time.c=0A+++ b/xen/arch/x86/tim= e.c=0A@@ -1263,6 +1263,18 @@ struct calibration_rendezvous {=0A u64 = master_tsc_stamp;=0A };=0A =0A+static void=0A+time_calibration_rendezvous_t= ail(const struct calibration_rendezvous *r)=0A+{=0A+ struct cpu_calibrat= ion *c =3D &this_cpu(cpu_calibration);=0A+=0A+ c->local_tsc_stamp =3D = rdtsc_ordered();=0A+ c->stime_local_stamp =3D get_s_time_fixed(c->local_= tsc_stamp);=0A+ c->stime_master_stamp =3D r->master_stime;=0A+=0A+ = raise_softirq(TIME_CALIBRATE_SOFTIRQ);=0A+}=0A+=0A /*=0A * Keep TSCs in = sync when they run at the same rate, but may stop in=0A * deep-sleep C = states.=0A@@ -1270,7 +1282,6 @@ struct calibration_rendezvous {=0A static = void time_calibration_tsc_rendezvous(void *_r)=0A {=0A int i;=0A- = struct cpu_calibration *c =3D &this_cpu(cpu_calibration);=0A struct = calibration_rendezvous *r =3D _r;=0A unsigned int total_cpus =3D = cpumask_weight(&r->cpu_calibration_map);=0A =0A@@ -1311,17 +1322,12 @@ = static void time_calibration_tsc_rendezv=0A }=0A }=0A =0A- = c->local_tsc_stamp =3D rdtsc_ordered();=0A- c->stime_local_stamp =3D = get_s_time_fixed(c->local_tsc_stamp);=0A- c->stime_master_stamp =3D = r->master_stime;=0A-=0A- raise_softirq(TIME_CALIBRATE_SOFTIRQ);=0A+ = time_calibration_rendezvous_tail(r);=0A }=0A =0A /* Ordinary rendezvous = function which does not modify TSC values. */=0A static void time_calibrati= on_std_rendezvous(void *_r)=0A {=0A- struct cpu_calibration *c =3D = &this_cpu(cpu_calibration);=0A struct calibration_rendezvous *r =3D = _r;=0A unsigned int total_cpus =3D cpumask_weight(&r->cpu_calibration_m= ap);=0A =0A@@ -1341,11 +1347,7 @@ static void time_calibration_std_rendezv= =0A mb(); /* receive signal /then/ read r->master_stime */=0A = }=0A =0A- c->local_tsc_stamp =3D rdtsc_ordered();=0A- c->stime_local_= stamp =3D get_s_time_fixed(c->local_tsc_stamp);=0A- c->stime_master_stam= p =3D r->master_stime;=0A-=0A- raise_softirq(TIME_CALIBRATE_SOFTIRQ);=0A= + time_calibration_rendezvous_tail(r);=0A }=0A =0A static void = (*time_calibration_rendezvous_fn)(void *) =3D=0A --=__Part497F7239.1__= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KWGVuLWRldmVs IG1haWxpbmcgbGlzdApYZW4tZGV2ZWxAbGlzdHMueGVuLm9yZwpodHRwOi8vbGlzdHMueGVuLm9y Zy94ZW4tZGV2ZWwK --=__Part497F7239.1__=--