Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp980587pxb; Wed, 3 Mar 2021 23:21:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJxHrzm6DBWxaPxXNNdiK16UgGz3Tp6INMtL5LqXbMJfnAW6gcUP3DV9ulEvhb71jGWoyXo0 X-Received: by 2002:a17:907:9863:: with SMTP id ko3mr2696439ejc.543.1614842508667; Wed, 03 Mar 2021 23:21:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614842508; cv=none; d=google.com; s=arc-20160816; b=RCU2JDHQwF7tVlMxhvocQn7WmQa5bxigpQu88EoJarMGOx1v61NAhHr5FaKYwYUiIL qPyUMVLlYy8qFJ3kXtKBDOp32CzSCXawE4kJkAX2HaiFp02Hr6/luVmFFLtyEhGb3/kr Iq6dUAfYS4R7bBVW8AEiQ3FluzPB9iGVpRXPMyR8m3uuCOkZXVNyoF4K2nkzShukEF7d OHhdkUIVN2DBFMwH2oBRHtmoYVZFa+ND6GygjeiW6161Vh/dhuI4UvcYG6QS+udAqunT 4KXjmGkhh5kzyoBjdUunkS6RWlBMjHK/eQ0ThoFRPP+qbQx363yyX4Kt2pmI7XMEX0UO p1VA== 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=M1/m/gd9FGC+n/OV39jRVRgV/wdTA/bprzwjyOWO+Ik=; b=TAxqo7Xcrc+ubuPI/MV/89QNEukEPSb14GoiPKUHsUKSuw1q/H+Z002f846WB5s8Nk ks8QEH68d1WkMmeu4Oh6UX2PSzAxy49OydKMer8+hPKA0XtPbZ9JNY2QII1tmRefntI8 gcxlGtYkO/RHNfvPUEmHfgptwr19zOCL5ndYhD8TBjVr4xWEIxyOLabhX0DpJyhMoGgM 0/FybDyAxYnm17O2kQtazkBf1LFSfdOlVK5gRts1/XJI8jD3O+pHWNhM6x4pUR9sNkXQ SekR17bVSkItJclwq9pyJzOOEixrLSPLwqh4P7x1zbfjGnxU18lwgFz79Eo+VGF+/CMZ LMUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GIB6d97D; 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 i10si17545457ejd.325.2021.03.03.23.21.26; Wed, 03 Mar 2021 23:21:48 -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=GIB6d97D; 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 S1575079AbhCBWnY (ORCPT + 99 others); Tue, 2 Mar 2021 17:43:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1838059AbhCBWPG (ORCPT ); Tue, 2 Mar 2021 17:15:06 -0500 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D38E0C06178A for ; Tue, 2 Mar 2021 14:14:25 -0800 (PST) Received: by mail-wr1-x435.google.com with SMTP id h98so21487984wrh.11 for ; Tue, 02 Mar 2021 14:14:25 -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=M1/m/gd9FGC+n/OV39jRVRgV/wdTA/bprzwjyOWO+Ik=; b=GIB6d97DF+Qq6qu+TXbhAjQDObZROxJLVp+TdNEZUVGR5T/0NqF53IaOnKWOqHmTzx jnxPItI0hKKRgB/vCEbSfd/cUMPprqejrC7iC9lK81l8NIn8wB6RENHbI1ud8aQ+erFT gVmjOhvKgWI/+5weX60PPb1TYnfj3LvYeAWzaAdjz3R58Nms0DSpCeMtxCkeC2czmt5N Txlh9oAj6HEnXNbKQ0tIHJgGa2zxGlN125wvGgTZf4H/wflFr654dq5J4l6CoSPWu1Dn WmS4oqPEk42C/y9XXuG7dMbEaUzZ8EGRrFusvMRTUYiBEKkRgBrAKmhykdIFiq7iW3b/ 7uBA== 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=M1/m/gd9FGC+n/OV39jRVRgV/wdTA/bprzwjyOWO+Ik=; b=oTcbkLun2ilpy+YvMLaqdyd92HEylzcum7x7MmI22TKXPZOulPA+34NbTQDpMMzcpn pWdtQvoinnfSVReD8hrNUQqs2ZgYnx1a8jPDxYmeg/zziPGhgY5k9EALLRjtFpC+vNBI aSIgKrRMUvKHhYxeyRj+dpgKljei/M2bdbObgPmIZootQcQFascv7mdRLrOvA1dPil1e b/zAK22IYtqewRdFx6UkQndi6VCdBJztBKlTaoYzuWuLv4aPLWfAw8RW7ai5lMKRqGe0 aNoxKmKOE8G/nbyR9phSfCi/KRN7W1fDI1pBgVtW+87H0OCB8f6VUONm63qgTw9BD7oQ nDNg== X-Gm-Message-State: AOAM533FjAkBmVacGTYaQspJcGzIBkypnKx0apJZxd0f4LjikSeHqvWZ 9SsvevMSmeRf8nGvhmZ8BrpbtQ== X-Received: by 2002:adf:e603:: with SMTP id p3mr21234023wrm.360.1614723264090; Tue, 02 Mar 2021 14:14:24 -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 z2sm11707388wrm.0.2021.03.02.14.14.22 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 02 Mar 2021 14:14:23 -0800 (PST) Subject: Re: [PATCH v3 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: <1614721102-2241-1-git-send-email-mikelley@microsoft.com> <1614721102-2241-8-git-send-email-mikelley@microsoft.com> From: Daniel Lezcano Message-ID: <25234414-d905-0f9c-af92-9a9e4cde30c4@linaro.org> Date: Tue, 2 Mar 2021 23:14:22 +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-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 02/03/2021 22:38, 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. > > 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..06984fa 100644 > --- a/drivers/clocksource/hyperv_timer.c > +++ b/drivers/clocksource/hyperv_timer.c > @@ -370,11 +370,13 @@ static void resume_hv_clock_tsc(struct clocksource *arg) > hv_set_register(HV_REGISTER_REFERENCE_TSC, tsc_msr); > } > > +#ifdef VDSO_CLOCKMODE_HVCLOCK > static int hv_cs_enable(struct clocksource *cs) > { > - hv_enable_vdso_clocksource(); > + vclocks_set_used(VDSO_CLOCKMODE_HVCLOCK); > return 0; > } > +#endif We had a confusion here. The suggestion was to remove the #ifdef here and add the __maybe_unused annotation to the function. > static struct clocksource hyperv_cs_tsc = { > .name = "hyperv_clocksource_tsc_page", > @@ -384,7 +386,12 @@ static int hv_cs_enable(struct clocksource *cs) > .flags = CLOCK_SOURCE_IS_CONTINUOUS, > .suspend= suspend_hv_clock_tsc, > .resume = resume_hv_clock_tsc, > +#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