From patchwork Thu Oct 19 13:39:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joao Martins X-Patchwork-Id: 10016889 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 C49BC60224 for ; Thu, 19 Oct 2017 13:41:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B94C828B4D for ; Thu, 19 Oct 2017 13:41:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ADFBE28D18; Thu, 19 Oct 2017 13:41:44 +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 4854E28B4D for ; Thu, 19 Oct 2017 13:41:43 +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 1e5B3A-0002Yp-1E; Thu, 19 Oct 2017 13:39:52 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e5B38-0002Wm-Pc for xen-devel@lists.xenproject.org; Thu, 19 Oct 2017 13:39:50 +0000 Received: from [85.158.139.211] by server-7.bemta-5.messagelabs.com id 74/BE-01785-62BA8E95; Thu, 19 Oct 2017 13:39:50 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupjkeJIrShJLcpLzFFi42LpnVTnqqu6+kW kwfzZGhbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8abX/OYChq4KqZ2trA3MB7j6GLk4hASmMwk 8ebtckYI5y+jxK4d09kgnA2MEnOud0M53YwSz+Z9Yupi5ORgE9CTaD3/mRnEFhFwkHj5bglYO 7PALiaJU6snAyU4OIQFvCTmnrcHqWERUJW4cngzC0iYV8BO4uhXD5CwhIC8xK62i6wgNqeAvc Si9UvBbCGgkutbO1khaowl2t9eZJvAyLeAkWEVo0ZxalFZapGukaVeUlFmekZJbmJmjq6hgal ebmpxcWJ6ak5iUrFecn7uJkZgqNQzMDDuYLy8xe8QoyQHk5Io78eqF5FCfEn5KZUZicUZ8UWl OanFhxhlODiUJHgPrgTKCRalpqdWpGXmAIMWJi3BwaMkwjsFJM1bXJCYW5yZDpE6xWjMcWzT5 T9MHB037/5hEmLJy89LlRLnvQVSKgBSmlGaBzcIFk2XGGWlhHkZGRgYhHgKUotyM0tQ5V8xin MwKgnz3gWZwpOZVwK37xXQKUxAp7Dbg51SkoiQkmpgdJznmc+Qd5ineV5Nhq73u7I0t64Dk/b vfdnblrZpvYq9XYXAb9YNnWYTrk53crZq3NJ1le9Uq7nDxYl7pD785pBqNcwS2i6t/4wt6d0L bptqL3lJz/Qfs0sTl6WX5kzVK2arS3oxPyjQYZWQ6brfNm8yoryTam37G9/d/G7amMf+1eKU4 WUlluKMREMt5qLiRAAEk39FoQIAAA== X-Env-Sender: joao.m.martins@oracle.com X-Msg-Ref: server-5.tower-206.messagelabs.com!1508420387!106110479!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 41354 invoked from network); 19 Oct 2017 13:39:49 -0000 Received: from aserp1040.oracle.com (HELO aserp1040.oracle.com) (141.146.126.69) by server-5.tower-206.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 19 Oct 2017 13:39:49 -0000 Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v9JDdc60007610 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 Oct 2017 13:39:38 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id v9JDdbGo021053 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 Oct 2017 13:39:38 GMT Received: from abhmp0003.oracle.com (abhmp0003.oracle.com [141.146.116.9]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id v9JDdbKs002563; Thu, 19 Oct 2017 13:39:37 GMT Received: from paddy.uk.oracle.com (/10.175.233.11) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 19 Oct 2017 06:39:37 -0700 From: Joao Martins To: linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org Date: Thu, 19 Oct 2017 14:39:16 +0100 Message-Id: <20171019133918.18367-4-joao.m.martins@oracle.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171019133918.18367-1-joao.m.martins@oracle.com> References: <20171019133918.18367-1-joao.m.martins@oracle.com> X-Source-IP: aserv0022.oracle.com [141.146.126.234] Cc: Juergen Gross , x86@kernel.org, Andy Lutomirski , Ingo Molnar , Thomas Gleixner , "H. Peter Anvin" , Boris Ostrovsky , Joao Martins Subject: [Xen-devel] [PATCH v7 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();