From patchwork Wed Jun 15 10:30:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 9178129 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9D88960776 for ; Wed, 15 Jun 2016 10:31:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8A5B3280E0 for ; Wed, 15 Jun 2016 10:31:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7F6F42821D; Wed, 15 Jun 2016 10:31:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 79381280E0 for ; Wed, 15 Jun 2016 10:31:55 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bD85G-0008Gb-GX; Wed, 15 Jun 2016 10:30:06 +0000 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 Received: from [85.158.143.35] by server-2.bemta-6.messagelabs.com id 6B/55-06230-C2E21675; Wed, 15 Jun 2016 10:30:04 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrDIsWRWlGSWpSXmKPExsXS6fjDS1dbLzH c4GKrksX3LZOZHBg9Dn+4whLAGMWamZeUX5HAmrH78322gr8aFRvu7WRrYJyn3MXIySEkkCex e9l5ZhCbV8BO4lDbakYQW0LAUGLf/FVsIDaLgKrEvMV/mUBsNgF1ibZn21m7GDk4RAQMJM4dT epi5OJgFuhmlNix6SxYjbCAkcTU1S+YIebbSSz/u4UVxOYUsJe4++UhG0gvr4CgxN8dwiBhZq CSOZsXs09g5JmFkJmFJANha0k8/HWLBcLWlli28DUzSDmzgLTE8n8cEGEHiS0n7rJiKvGWuHx KfwEjxypG9eLUorLUIl1jvaSizPSMktzEzBxdQwMzvdzU4uLE9NScxKRiveT83E2MwFBlAIId jB3/nA4xSnIwKYnyesglhgvxJeWnVGYkFmfEF5XmpBYfYpTh4FCS4GXQBcoJFqWmp1akZeYAo wYmLcHBoyTC+0cHKM1bXJCYW5yZDpE6xagoJc77EyQhAJLIKM2Da4NF6iVGWSlhXkagQ4R4Cl KLcjNLUOVfMYpzMCoJ814AmcKTmVcCN/0V0GImoMU20+NBFpckIqSkGhgPOWzc/ZeB506ciGe 64IG1DnWLbfO5/j4Iq5ny26n9wbO5c3Y8jp7vMa+UnT/h/Xz+J3zHVq/ZYfT9juHPFgnxOVad 7xbYBC9t4/Be+afOVPKRutEugxkOHzPKrhokRq/w+LF+QV7lxpkHxHxLA6aG/2WQ/lG6c8knB ieuo/6bthUq1GWonFylxFKckWioxVxUnAgAzCoNBc8CAAA= X-Env-Sender: JBeulich@suse.com X-Msg-Ref: server-3.tower-21.messagelabs.com!1465986601!18519894!1 X-Originating-IP: [137.65.248.74] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.46; banners=-,-,- X-VirusChecked: Checked Received: (qmail 26960 invoked from network); 15 Jun 2016 10:30:03 -0000 Received: from prv-mh.provo.novell.com (HELO prv-mh.provo.novell.com) (137.65.248.74) by server-3.tower-21.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 15 Jun 2016 10:30:03 -0000 Received: from INET-PRV-MTA by prv-mh.provo.novell.com with Novell_GroupWise; Wed, 15 Jun 2016 04:30:01 -0600 Message-Id: <57614A4902000078000F53AD@prv-mh.provo.novell.com> X-Mailer: Novell GroupWise Internet Agent 14.2.0 Date: Wed, 15 Jun 2016 04:30:01 -0600 From: "Jan Beulich" To: "xen-devel" References: <576140F302000078000F52FE@prv-mh.provo.novell.com> In-Reply-To: <576140F302000078000F52FE@prv-mh.provo.novell.com> Mime-Version: 1.0 Cc: Andrew Cooper , Dario Faggioli , Joao Martins Subject: [Xen-devel] [PATCH 7/8] x86/time: fold recurring code X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 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 --- 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_rendezv } } - 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_rendezv 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 *) = Reviewed-by: Andrew Cooper --- 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_rendezv } } - 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_rendezv 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 *) =