Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp62730pxb; Tue, 2 Mar 2021 19:14:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJyByPyCiZPJR1v86MUUSHHfyq6N4cAdDbU+Mi64u2GTxXn6cfFMeT/b1ujJLQpID1VKfsHn X-Received: by 2002:a17:906:eb89:: with SMTP id mh9mr24195387ejb.122.1614741290799; Tue, 02 Mar 2021 19:14:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614741290; cv=none; d=google.com; s=arc-20160816; b=u63V08iu2EpG4zuJ+Qf/gDnf6bkWK0xEWkB1zkZ7s/TydGdFd8H+puApcAVNYWISym pb1Q1yh4bLfGIr7cYJP4+gju33RkPFtjiAD92O2bxli7qIit8asOxJsYZ7PWnELhX8SN 9kw8Uh00RfupYMh1kGJZs9IcaYx0XXEG8Tl4J5MWNPnPV2AHJpNEGjZLdDLMKTY/tBzK q9QrPA9ejqeoUnUsi46W+NP6Su7i+oMmnEZ8Tbf+ge/cTAFFt/jHaRqrENenH1e9+icQ alrv70TJAhRbKw+kcWd66pRcdhqwnhSnzVN4BdPXMw4UA6cC2qO3WbJQPxmO/4BeaWzX hZkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=Gw7vh21OA2GN+c4vAdueJEzrkOpCd8FahG3FhqVfJSo=; b=MLeQtZIMQyhU9jhH+z2RFuT5XONB/kaBYVQLHcrSnRKkyREQ0oKA2kOxucO78pKa9W 5gzJWZTiryCKP3KS3vOZX0eM0RxOF52eu03gRxNB0ac2kSht8BfXM5LBmjfoPzIm8SzW sD5PaxvoHlMXNuqIoSzeWO8VOtCNcXghPly+zbbEkvS2eviNF/OMfLxtbIOS8cs9RdiE YMthB/jLz/y2XSjS6E9eWhqtQInTGFUtomruuLbJGs7p76tLvOLwdb+IqP2oijWRBQNL WkUjvDgz9ET6/FuYx3P8bfA9x3wYYMtFYsvRCj65xHwxFKBi9pwTnAuT85hzA5Fp9FE1 0AOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QbOaPeYX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bd28si5510362edb.570.2021.03.02.19.14.24; Tue, 02 Mar 2021 19:14:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QbOaPeYX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234897AbhCAMWm (ORCPT + 99 others); Mon, 1 Mar 2021 07:22:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234386AbhCAMWZ (ORCPT ); Mon, 1 Mar 2021 07:22:25 -0500 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 210C5C061788 for ; Mon, 1 Mar 2021 04:21:45 -0800 (PST) Received: by mail-wr1-x432.google.com with SMTP id e10so15686920wro.12 for ; Mon, 01 Mar 2021 04:21:45 -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=Gw7vh21OA2GN+c4vAdueJEzrkOpCd8FahG3FhqVfJSo=; b=QbOaPeYXxavfvWwZm75sM0iJMXhJmsLHuf+hAYClzhVA+k+iWTuWFkSmQpQj4TWhTi 5jJ3v1RCIl0+4sZwAl6Bf3S5eMx133iTAwJjvmiA/wdo7WaBJQzCVKAw5v0r3yOnfkwj z5mDwqKrhyEIBZH2s3WkV0KYfIXD/OCNLAQbyywDzOTqOTi3tU80m2iPq9Mv5URuoM9H IaRpk8Hh2o107WFgw948pOoaDej0ZI40URY5EILj+OZzYHfeOsrFOR6dErzbsbgXeMCg WNUKrV/BkQb9BgGKS5U2NwiYs+i96RrymY6EUGXEGS6Ful4HE/5aoyjHMfndVcn+K/NJ fWyA== 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=Gw7vh21OA2GN+c4vAdueJEzrkOpCd8FahG3FhqVfJSo=; b=AQ017+ZkTrlXNIq50m2jC5tWtKRTIvk3jYoRDvIP/vmKDdAGuJ9oUYoL7CAUN352lG kjuUm04WZceyi/ZY/zOuQhMPPiQJup0bb3q/iLiTN9DMCfnGmyAmlHmQ1K9gobNjlvds SIR6V4USL1cWxnW306bDg6i9MQaL5wbklvNbgHh3zF2Q2FqF3DzzxgzFhH0nv+MJkr6m SSrnwwOfzzthtt1tQTCPw04R6ecablYBPAnP8TwhfahujRM7nm/wBWVpBLJH9zF/SPE1 1tOUD9m7OlJzn+M1SQjqhM3vafVfGIS25I0wEtMVvGng2ES99pXfO/7In4bP6sYz9jxr r3Jg== X-Gm-Message-State: AOAM5303/byUy+tKX2vlueALq2BHUh9nCLY6ZySUwWmy1LegMx3D4f21 tyYIIeF2oNskEOqHg8H61kTwZg== X-Received: by 2002:a05:6000:1545:: with SMTP id 5mr16505065wry.90.1614601303562; Mon, 01 Mar 2021 04:21:43 -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 g202sm3775569wme.20.2021.03.01.04.21.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 01 Mar 2021 04:21:43 -0800 (PST) Subject: Re: [PATCH v2 07/10] clocksource/drivers/hyper-v: Handle vDSO 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: <1614561332-2523-1-git-send-email-mikelley@microsoft.com> <1614561332-2523-8-git-send-email-mikelley@microsoft.com> From: Daniel Lezcano Message-ID: <42dc252a-b09a-afeb-6792-9b77669c16e9@linaro.org> Date: Mon, 1 Mar 2021 13:21:41 +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: <1614561332-2523-8-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 01/03/2021 02:15, Michael Kelley wrote: > While the driver for the Hyper-V Reference TSC and STIMERs is architecture > neutral, vDSO is implemented for x86/x64, but not for ARM64. Current code > calls into utility functions under arch/x86 (and coming, under arch/arm64) > to handle the difference. > > Change this approach to handle the difference inline based on whether > VDSO_CLOCK_MODE_HVCLOCK 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. A suggestion below > Signed-off-by: Michael Kelley > Reviewed-by: Boqun Feng > --- > arch/x86/include/asm/mshyperv.h | 4 ---- > drivers/clocksource/hyperv_timer.c | 10 ++++++++-- > 2 files changed, 8 insertions(+), 6 deletions(-) > > diff --git a/arch/x86/include/asm/mshyperv.h b/arch/x86/include/asm/mshyperv.h > index c10dd1c..4f566db 100644 > --- a/arch/x86/include/asm/mshyperv.h > +++ b/arch/x86/include/asm/mshyperv.h > @@ -27,10 +27,6 @@ static inline u64 hv_get_register(unsigned int reg) > return value; > } > > -#define hv_set_clocksource_vdso(val) \ > - ((val).vdso_clock_mode = VDSO_CLOCKMODE_HVCLOCK) > -#define hv_enable_vdso_clocksource() \ > - vclocks_set_used(VDSO_CLOCKMODE_HVCLOCK); > #define hv_get_raw_timer() rdtsc_ordered() > > /* > diff --git a/drivers/clocksource/hyperv_timer.c b/drivers/clocksource/hyperv_timer.c > index c73c127..5e5e08aa 100644 > --- a/drivers/clocksource/hyperv_timer.c > +++ b/drivers/clocksource/hyperv_timer.c > @@ -372,7 +372,9 @@ static void resume_hv_clock_tsc(struct clocksource *arg) > > static int hv_cs_enable(struct clocksource *cs) static __maybe_unused int hv_cs_enable(struct clocksource *cs) > { > - hv_enable_vdso_clocksource(); > +#ifdef VDSO_CLOCKMODE_HVCLOCK > + vclocks_set_used(VDSO_CLOCKMODE_HVCLOCK); > +#endif > return 0; > } > > @@ -385,6 +387,11 @@ static int hv_cs_enable(struct clocksource *cs) > .suspend= suspend_hv_clock_tsc, > .resume = resume_hv_clock_tsc, > .enable = hv_cs_enable, > +#ifdef VDSO_CLOCKMODE_HVCLOCK > + .vdso_clock_mode = VDSO_CLOCKMODE_HVCLOCK, > +#else > + .vdso_clock_mode = VDSO_CLOCKMODE_NONE, > +#endif #ifdef VDSO_CLOCKMODE_HVCLOCK .enable = hv_cs_enable, .vdso_clock_mode = VDSO_CLOCKMODE_HVCLOCK, #else .vdso_clock_mode = VDSO_CLOCKMODE_NONE, #endif > }; > > static u64 notrace read_hv_clock_msr(void) > @@ -442,7 +449,6 @@ static bool __init hv_init_tsc_clocksource(void) > tsc_msr = tsc_msr | 0x1 | (u64)phys_addr; > hv_set_register(HV_REGISTER_REFERENCE_TSC, tsc_msr); > > - hv_set_clocksource_vdso(hyperv_cs_tsc); > clocksource_register_hz(&hyperv_cs_tsc, NSEC_PER_SEC/100); > > hv_sched_clock_offset = hv_read_reference_counter(); > -- Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog