From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EE27FC433E6 for ; Tue, 2 Mar 2021 23:35:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AD3D464F3E for ; Tue, 2 Mar 2021 23:35:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1448667AbhCBW5W (ORCPT ); Tue, 2 Mar 2021 17:57:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2360110AbhCBWQt (ORCPT ); Tue, 2 Mar 2021 17:16:49 -0500 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A9962C061788 for ; Tue, 2 Mar 2021 14:16:07 -0800 (PST) Received: by mail-wm1-x32b.google.com with SMTP id e23so3496840wmh.3 for ; Tue, 02 Mar 2021 14:16:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=0KoC52/OhyByIZz76tXoXDzs+xfPJOsQW1wOukb2Dr0=; b=K2lY7I0r5hFw8DG5EJd659cbaFGi3SglYroCNRItp8E/06lbc+qlAasYJxwQD8sHVe CvBnAuIHv+P36EnJgWYWRjRH27OjVrWUvP9IABp+Ygt3KW2A+PwMHlTgsM6r+TOPY4KV W74IMOpEQFPtFsnK5+Td4UQTy9UO72izKfBdqzQnCdxUOtqrx3YAFUYTpz85KGQHTGMB iCqkOU/dQ7iTnYHqqSwqyeo7TixnuLN9YF8RIohP45X1z7kog0AqaDZ7rqadS8aa9AQ9 mzM156Fa7oE5slhrysmBts0PwsivyFaJGkS+yq/yLFvHIRCwvaSHBwCfMvfaTVVjGlHO waug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=0KoC52/OhyByIZz76tXoXDzs+xfPJOsQW1wOukb2Dr0=; b=RHCwKX6YUbmC6URGXAl9dZh3BDsQKUCNe3hJiFGog+DqrVqH9Sk1N0q2LyNS8aLV+A 2fkAoFhES8Hex1FWNjgsMuTmRj/rAF2NYZ76u7bBONUXK3C4dAUoF4JwJYzEd8ILpS2V 4P34vIRSeQM08j/d2owM34VCXN6pRlEvTIWf2QjcWHouuLY5e9zLmFCpIfixqXZMsKRZ P+/O1oCG7/SRJBVvPHrg2INBymohxDosWukxhxhVGrWxpt5S56fJKso57wCtVcaDLfUX jDZjDZqdUkcSAt593q0IdSUDbLwLqwvWq4PI/DevNdQsdDo2sI9q7mXyuxdoc2Tf/vmO 5THA== X-Gm-Message-State: AOAM533Cd5O85a1LL9AV1rEVa+DmZqr5BQhh1RQPLjpbnJF5ZOxi1LAA ZT3+ZCpDut9wKJXMwwpaYlRgKnLKZoKpsw== X-Google-Smtp-Source: ABdhPJz10wicz8sO2wh9H482rMWHdf3Ne7aJ3fWg/xXlXOxdwPzqDo/9psXXTFpJcsYWHB6SDSvc6g== X-Received: by 2002:a1c:8041:: with SMTP id b62mr6300509wmd.0.1614723329324; Tue, 02 Mar 2021 14:15:29 -0800 (PST) Received: from [192.168.0.41] (lns-bzn-59-82-252-144-192.adsl.proxad.net. [82.252.144.192]) by smtp.googlemail.com with ESMTPSA id r10sm4943020wmh.45.2021.03.02.14.15.25 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 02 Mar 2021 14:15:26 -0800 (PST) Subject: Re: [PATCH v3 08/10] clocksource/drivers/hyper-v: Handle sched_clock differences inline To: Michael Kelley , sthemmin@microsoft.com, kys@microsoft.com, wei.liu@kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, hpa@zytor.com, arnd@arndb.de, linux-hyperv@vger.kernel.org Cc: linux-kernel@vger.kernel.org, x86@kernel.org, linux-arch@vger.kernel.org References: <1614721102-2241-1-git-send-email-mikelley@microsoft.com> <1614721102-2241-9-git-send-email-mikelley@microsoft.com> From: Daniel Lezcano Message-ID: <85283676-a0aa-6934-116b-98f2c5dece9f@linaro.org> Date: Tue, 2 Mar 2021 23:15:24 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <1614721102-2241-9-git-send-email-mikelley@microsoft.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/03/2021 22:38, Michael Kelley wrote: > While the Hyper-V Reference TSC code is architecture neutral, the > pv_ops.time.sched_clock() function is implemented for x86/x64, but not > for ARM64. Current code calls a utility function under arch/x86 (and > coming, under arch/arm64) to handle the difference. > > Change this approach to handle the difference inline based on whether > GENERIC_SCHED_CLOCK is present. The new approach removes code under > arch/* since the difference is tied more to the specifics of the Linux > implementation than to the architecture. > > No functional change. > > Signed-off-by: Michael Kelley > Reviewed-by: Boqun Feng Acked-by: Daniel Lezcano > --- > arch/x86/include/asm/mshyperv.h | 11 ----------- > drivers/clocksource/hyperv_timer.c | 24 ++++++++++++++++++++++++ > 2 files changed, 24 insertions(+), 11 deletions(-) > > diff --git a/arch/x86/include/asm/mshyperv.h b/arch/x86/include/asm/mshyperv.h > index 4f566db..5433312 100644 > --- a/arch/x86/include/asm/mshyperv.h > +++ b/arch/x86/include/asm/mshyperv.h > @@ -29,17 +29,6 @@ static inline u64 hv_get_register(unsigned int reg) > > #define hv_get_raw_timer() rdtsc_ordered() > > -/* > - * Reference to pv_ops must be inline so objtool > - * detection of noinstr violations can work correctly. > - */ > -static __always_inline void hv_setup_sched_clock(void *sched_clock) > -{ > -#ifdef CONFIG_PARAVIRT > - pv_ops.time.sched_clock = sched_clock; > -#endif > -} > - > void hyperv_vector_handler(struct pt_regs *regs); > > static inline void hv_enable_stimer0_percpu_irq(int irq) {} > diff --git a/drivers/clocksource/hyperv_timer.c b/drivers/clocksource/hyperv_timer.c > index 06984fa..10eb5c6 100644 > --- a/drivers/clocksource/hyperv_timer.c > +++ b/drivers/clocksource/hyperv_timer.c > @@ -423,6 +423,30 @@ static u64 notrace read_hv_sched_clock_msr(void) > .flags = CLOCK_SOURCE_IS_CONTINUOUS, > }; > > +/* > + * Reference to pv_ops must be inline so objtool > + * detection of noinstr violations can work correctly. > + */ > +#ifdef CONFIG_GENERIC_SCHED_CLOCK > +static __always_inline void hv_setup_sched_clock(void *sched_clock) > +{ > + /* > + * We're on an architecture with generic sched clock (not x86/x64). > + * The Hyper-V sched clock read function returns nanoseconds, not > + * the normal 100ns units of the Hyper-V synthetic clock. > + */ > + sched_clock_register(sched_clock, 64, NSEC_PER_SEC); > +} > +#elif defined CONFIG_PARAVIRT > +static __always_inline void hv_setup_sched_clock(void *sched_clock) > +{ > + /* We're on x86/x64 *and* using PV ops */ > + pv_ops.time.sched_clock = sched_clock; > +} > +#else /* !CONFIG_GENERIC_SCHED_CLOCK && !CONFIG_PARAVIRT */ > +static __always_inline void hv_setup_sched_clock(void *sched_clock) {} > +#endif /* CONFIG_GENERIC_SCHED_CLOCK */ > + > static bool __init hv_init_tsc_clocksource(void) > { > u64 tsc_msr; > -- Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog