From patchwork Mon Oct 2 18:31:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joao Martins X-Patchwork-Id: 9981147 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 57B5C6029B for ; Mon, 2 Oct 2017 18:34:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 46FEA287F8 for ; Mon, 2 Oct 2017 18:34:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3B4C128806; Mon, 2 Oct 2017 18:34:10 +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, UNPARSEABLE_RELAY 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 C1BB4287F8 for ; Mon, 2 Oct 2017 18:34:09 +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 1dz5Vb-0001Ab-KD; Mon, 02 Oct 2017 18:32:03 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dz5VZ-00019c-SX for xen-devel@lists.xenproject.org; Mon, 02 Oct 2017 18:32:01 +0000 Received: from [85.158.143.35] by server-5.bemta-6.messagelabs.com id 3C/27-03454-12682D95; Mon, 02 Oct 2017 18:32:01 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupnkeJIrShJLcpLzFFi42LpnVTnqqvQdin S4P4WRYvvWyYzOTB6HP5whSWAMYo1My8pvyKBNePlt+MsBYs4K179WsHYwPiVvYuRi0NIYAKT xMa/31kgnF+MEi/uv2eGcNYzSly4cB0q08gosfrAf9YuRk4ONgE9idbzn5lBbBEBB4mX75Ywg hQxC+xikji1ejJYQljAS+L30i4wm0VAVWL9/ZlgzbwCthI/j19kB7ElBOQldrVdBItzCthJnP 7TywhiCwHVbDh9mQ2ixlDi88alzBMY+RYwMqxiVC9OLSpLLdI110sqykzPKMlNzMzRNTQw08t NLS5OTE/NSUwq1kvOz93ECAwWBiDYwTjzsv8hRkkOJiVR3pctlyKF+JLyUyozEosz4otKc1KL DzHKcHAoSfDqtQLlBItS01Mr0jJzgGELk5bg4FES4T3RDJTmLS5IzC3OTIdInWI05ji26fIfJ o6Om3f/MAmx5OXnpUqJ854H2SIAUppRmgc3CBZPlxhlpYR5GYFOE+IpSC3KzSxBlX/FKM7BqC TMOx9kCk9mXgncvldApzABnTKn6wLIKSWJCCmpBkajlXcYLFslHhz8fHlD0aWHU/dIe4cU7Ne Ib+v4fvhIWBxvg/ROl1Pb1tpevv+aKfcyo8TrZz6XYoPtTAsFnKRyn8q+v/ziSdSBO70eCcdZ 71kenWhr1/9s7uVbWp+fp2qfncXUt/EDp+xakb+3Jn4tXlPDdW6CVHSZ0/LvdyZUqKyKO6win /hbiaU4I9FQi7moOBEADw5/gaICAAA= X-Env-Sender: joao.m.martins@oracle.com X-Msg-Ref: server-14.tower-21.messagelabs.com!1506969118!79015145!1 X-Originating-IP: [141.146.126.69] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTQxLjE0Ni4xMjYuNjkgPT4gMjc3MjE4\n X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 64227 invoked from network); 2 Oct 2017 18:32:00 -0000 Received: from aserp1040.oracle.com (HELO aserp1040.oracle.com) (141.146.126.69) by server-14.tower-21.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 2 Oct 2017 18:32:00 -0000 Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v92IVmFO028303 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 2 Oct 2017 18:31:48 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id v92IVmsR028083 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 2 Oct 2017 18:31:48 GMT Received: from abhmp0001.oracle.com (abhmp0001.oracle.com [141.146.116.7]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id v92IVlEt020959; Mon, 2 Oct 2017 18:31:47 GMT Received: from paddy.lan (/94.61.137.133) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 02 Oct 2017 11:31:46 -0700 From: Joao Martins To: linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org Date: Mon, 2 Oct 2017 19:31:20 +0100 Message-Id: <20171002183122.3961-3-joao.m.martins@oracle.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171002183122.3961-1-joao.m.martins@oracle.com> References: <20171002183122.3961-1-joao.m.martins@oracle.com> X-Source-IP: userv0022.oracle.com [156.151.31.74] Cc: Juergen Gross , x86@kernel.org, Andy Lutomirski , Ingo Molnar , Thomas Gleixner , "H. Peter Anvin" , Boris Ostrovsky , Joao Martins Subject: [Xen-devel] [PATCH v5 2/4] x86/xen/time: set pvclock flags on xen_time_init() 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: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Boris Ostrovsky --- New in v5 --- arch/x86/xen/time.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c index 1ecb05db3632..fc0148d3a70d 100644 --- a/arch/x86/xen/time.c +++ b/arch/x86/xen/time.c @@ -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; @@ -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();