From patchwork Tue Oct 3 11:55:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joao Martins X-Patchwork-Id: 9982325 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 BB83B6029B for ; Tue, 3 Oct 2017 11:58:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B05BE28848 for ; Tue, 3 Oct 2017 11:58:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A538D288E6; Tue, 3 Oct 2017 11:58:27 +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 39B1A28848 for ; Tue, 3 Oct 2017 11:58:27 +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 1dzLoC-00037V-M1; Tue, 03 Oct 2017 11:56:20 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dzLoB-00036m-Pz for xen-devel@lists.xenproject.org; Tue, 03 Oct 2017 11:56:19 +0000 Received: from [85.158.143.35] by server-3.bemta-6.messagelabs.com id C8/6B-03093-3EA73D95; Tue, 03 Oct 2017 11:56:19 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupjkeJIrShJLcpLzFFi42LpnVTnqnu/6nK kwZ4Xyhbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8abX/OYChq4KqZ2trA3MB7j6GLk4hASmMAk 0Tf1CTuE84dR4s3VW0xdjJxAzgZGia3vsiESjYwSvbPnsIEk2AT0JFrPf2YGsUUEHCRevlvCC FLELLCLSeLU6slgCWEBL4mtl1pYQGwWAVWJ15N3AzVzcPAK2Eks3+YLEpYQkJfY1XaRFcTmFL CXWHPkCjPEYjuJdQ2trBA1hhKnH25jnMDIt4CRYRWjRnFqUVlqka6RkV5SUWZ6RkluYmaOrqG BmV5uanFxYnpqTmJSsV5yfu4mRmCoMADBDsY18wMPMUpyMCmJ8j4pvxwpxJeUn1KZkVicEV9U mpNafIhRhoNDSYL3bCVQTrAoNT21Ii0zBxi0MGkJDh4lEV5nkDRvcUFibnFmOkTqFKMxx7FNl /8wcXTcvPuHSYglLz8vVUqcdyNIqQBIaUZpHtwgWDRdYpSVEuZlBDpNiKcgtSg3swRV/hWjOA ejkjBvHcgUnsy8Erh9r4BOYQI6ZU7XBZBTShIRUlINjCwf9+azXU788Gr93fOPZrJqXJc2zfo WIi118t4XvdeXUluv6RWUTVGMON44tUKz4eWNRlGWM+aXarOttmefeNsp7/T7E+cf6+6dt+5U tc3r+7f714VJj36vntR3mivYd15N/IaIz3fD2iPrcjXlFDfM0FY/L/Dl25LaUwqzVkhW/djTO eP6r11KLMUZiYZazEXFiQAXGyThoQIAAA== X-Env-Sender: joao.m.martins@oracle.com X-Msg-Ref: server-12.tower-21.messagelabs.com!1507031773!85763228!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 14793 invoked from network); 3 Oct 2017 11:56:15 -0000 Received: from aserp1040.oracle.com (HELO aserp1040.oracle.com) (141.146.126.69) by server-12.tower-21.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 3 Oct 2017 11:56:15 -0000 Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v93Bu3ab022904 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 3 Oct 2017 11:56:03 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id v93Bu2cL030570 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 3 Oct 2017 11:56:02 GMT Received: from abhmp0010.oracle.com (abhmp0010.oracle.com [141.146.116.16]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id v93Bu2p6021851; Tue, 3 Oct 2017 11:56:02 GMT Received: from paddy.lan (/94.61.137.133) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 03 Oct 2017 04:56:01 -0700 From: Joao Martins To: linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org Date: Tue, 3 Oct 2017 12:55:29 +0100 Message-Id: <20171003115531.22546-3-joao.m.martins@oracle.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171003115531.22546-1-joao.m.martins@oracle.com> References: <20171003115531.22546-1-joao.m.martins@oracle.com> X-Source-IP: userv0021.oracle.com [156.151.31.71] Cc: Juergen Gross , x86@kernel.org, Andy Lutomirski , Ingo Molnar , Thomas Gleixner , "H. Peter Anvin" , Boris Ostrovsky , Joao Martins Subject: [Xen-devel] [PATCH v6 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 --- Changes since v5: * Add Boris RoB 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();