From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751942AbdJCL4W (ORCPT ); Tue, 3 Oct 2017 07:56:22 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:24800 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751874AbdJCL4U (ORCPT ); Tue, 3 Oct 2017 07:56:20 -0400 From: Joao Martins To: linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org Cc: Joao Martins , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, Boris Ostrovsky , Juergen Gross , Andy Lutomirski Subject: [PATCH v6 2/4] x86/xen/time: set pvclock flags on xen_time_init() 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] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(); -- 2.11.0