From patchwork Wed Nov 8 17:19:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joao Martins X-Patchwork-Id: 10048871 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 538AE60247 for ; Wed, 8 Nov 2017 17:23:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3645522380 for ; Wed, 8 Nov 2017 17:23:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2B3232A7B8; Wed, 8 Nov 2017 17:23:01 +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 C10082A71C for ; Wed, 8 Nov 2017 17:23:00 +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 1eCU1g-000733-Ol; Wed, 08 Nov 2017 17:20:32 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eCU1f-00072Y-4G for xen-devel@lists.xenproject.org; Wed, 08 Nov 2017 17:20:31 +0000 Received: from [85.158.139.211] (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256 bits)) by server-10.bemta-5.messagelabs.com id A8/9F-02875-EDC330A5; Wed, 08 Nov 2017 17:20:30 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprKIsWRWlGSWpSXmKPExsUyZ7p8oO5dG+Y ogxeLLSy+b5nM5MDocfjDFZYAxijWzLyk/IoE1ow3v+YxFTRwVUztbGFvYDzG0cXIxSEkMIFJ Yvq+n+xdjJxAzh9GiW8/8iASGxgllq3dzQLhNDJKvLpzEayKTUBPovX8Z2YQW0TAQeLluyWMI EXMAruYJE6tngyWEBbwkph2dxIriM0ioCqx89lVRhCbV8BOYt6x2WCDJATkJXa1XQSr4RSwl2 i+f40R4gw7ib73s5ghagwlPm9cyjyBkW8BI8MqRo3i1KKy1CJdYwO9pKLM9IyS3MTMHF1DA1O 93NTi4sT01JzEpGK95PzcTYzAYKlnYGDcwThhld8hRkkOJiVR3gevmKKE+JLyUyozEosz4otK c1KLDzHKcHAoSfD2WzNHCQkWpaanVqRl5gDDFiYtwcGjJMJrBpLmLS5IzC3OTIdInWK05Di26 fIfJo5nM183MHNMu9raxCzEkpeflyolzssJjA4hAZCGjNI8uHGw2LrEKCslzMvIwMAgxFOQWp SbWYIq/4pRnINRSZj3M8hansy8Eritr4AOYgI6aH8IA8hBJYkIKakGRs04tm6FPzcfv7neu+i oYOa101kCdTOSZ77eHng0Uu7cMrGZK6ed1tDYH/vr45/3T40n3D49Q8H4yHPf5SEuZptbXP9p ffw3b+qjXfnPjdt59D5wRXL1vZh+VbbImas7nyUuZplHTPD/Zicd2V1HSm4Y8Pt3/PHZv//E/ 8SHS+0//RG4tlr++0ElluKMREMt5qLiRAA2TOemqAIAAA== X-Env-Sender: joao.m.martins@oracle.com X-Msg-Ref: server-13.tower-206.messagelabs.com!1510161628!90855620!1 X-Originating-IP: [156.151.31.81] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTU2LjE1MS4zMS44MSA9PiAyODgzMzk=\n X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 8395 invoked from network); 8 Nov 2017 17:20:29 -0000 Received: from userp1040.oracle.com (HELO userp1040.oracle.com) (156.151.31.81) by server-13.tower-206.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 8 Nov 2017 17:20:29 -0000 Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id vA8HKHtp019746 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 8 Nov 2017 17:20:18 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id vA8HKHo0023653 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 8 Nov 2017 17:20:17 GMT Received: from abhmp0019.oracle.com (abhmp0019.oracle.com [141.146.116.25]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id vA8HKHGl001329; Wed, 8 Nov 2017 17:20:17 GMT Received: from paddy.lan (/94.61.137.133) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 08 Nov 2017 09:20:16 -0800 From: Joao Martins To: linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org Date: Wed, 8 Nov 2017 17:19:56 +0000 Message-Id: <20171108171958.23921-4-joao.m.martins@oracle.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171108171958.23921-1-joao.m.martins@oracle.com> References: <20171108171958.23921-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 v8 3/5] 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();