Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp955044pxb; Wed, 3 Mar 2021 22:24:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJwof++lOql7/nWvEPmZBnvSc6cu4/lEXBoJmoB2eSzxSBz9Nbssl4puMhaCuqeGETUo1KRK X-Received: by 2002:a17:906:ada:: with SMTP id z26mr2569048ejf.438.1614839057676; Wed, 03 Mar 2021 22:24:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614839057; cv=none; d=google.com; s=arc-20160816; b=tFjRuMcqv40D5EVXdX94mkeVrQPmntlvPprHbbi8mK0m2oAjqhEYPME8OQuYqVAqMB LbCsjs4v1fny+P0M6TyLVCKJeCGRjEyTQzNtxaM4YpbnT3bRPpwSNvQsSl7u4OHg+DBP p1vbMIfimkdkp4zsnLGIvVfjxNwagqXJX1zB57eJ+ge3eTcDkiXr+Qp4s29EnGRoteth KL/GW3+DNhV4Iyb3IdpXvnRsXYddIdxW4cP6pUPMSdxgt2oTgc9BegWuq0ETV7VT6FFj 0ZsdC6gVqt15KF2YFjZeTu+ec0AA64CjtAMt0NHPsuH6DS1zMjbGMN5p8U5ZkC6RmgbA KkFg== 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=P88OLgbTkZUMP2F6RxCTDa3UqTL0DvJ/H4h2928AGS0=; b=IRQWbmqPR1DmhhugfO0l+pMQX2qoN7/mKOHPtcxEsXFKf5S8V4STApsFLlZoiiznG1 Mr7QNScOIpHTPAFJiS6Vrz0ICZqX8DXPyDljlMM6EyjvsKV+JF4scApP+p+OuutENd0U fsxezEilrGsk3jh76UYSJUqIXUpB0WZxnX1RoZRn9TFGT9cIglKw/ewYf67SBy/HyrBi iRd0KmLYsWpihCULFHW9Wadbu7MP01oF5WnDOzlTkDjvQ1ml/7B6kh3idtmnQ+QS4Ebg UM1xcSVLjybw7C/GdqVbWiIRfPX6W5aDQ9I1wPZHEwo0A/3II7/hnEudG/6EVUrYysSA TaiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cWjTZIrP; 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 cb24si2082963edb.482.2021.03.03.22.23.55; Wed, 03 Mar 2021 22:24:17 -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=cWjTZIrP; 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 S1578567AbhCBPZG (ORCPT + 99 others); Tue, 2 Mar 2021 10:25:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351021AbhCBNCk (ORCPT ); Tue, 2 Mar 2021 08:02:40 -0500 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8490DC061756 for ; Tue, 2 Mar 2021 05:01:27 -0800 (PST) Received: by mail-wr1-x42b.google.com with SMTP id f12so15970478wrx.8 for ; Tue, 02 Mar 2021 05:01:27 -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=P88OLgbTkZUMP2F6RxCTDa3UqTL0DvJ/H4h2928AGS0=; b=cWjTZIrPmgrzCItY3GJ2Ad5+F80d27tfXG3ciPRPzu5yFPVx0DuMOJ37cHpyYZ6hJY bDEVAFAwTwf7RBXKlXP9N39xkM0HBhEDsLYqDtJHJG2P1tVspg4k6Ae4+Pbv5B6Inz5D 0Qzy7aC3jLZtaOhaanSYazYjwRPcpLkbE33gFT6FhRPqhKsIgIeFzEawFp8gn5B775DU jWnUFkFXK8E1HGlAV+DVB4yXG7JKf0PdINk5QN1sBDFRrBmvtg69qPBc0vdxqeeh19IQ cRKtfemz2MsMUmQ0cueUIaghph4L+iiOg/wlhM2WPPOoEeWqh45c0GM6IK+McsGFomTA 2Psg== 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=P88OLgbTkZUMP2F6RxCTDa3UqTL0DvJ/H4h2928AGS0=; b=FXBdmEpJRXxNK08eOsT7kVD8GCSvvhv/mb8grGrSbiC86X6nyDjkHbsuvdak1iHEne y/Xpj20pRxwX0vGw8DY8iOOwGFLCNdoaL4Fvrrj2pvzB2f0wIpcRHBFo38RlStlp5Ry5 dcVptAGe1vwenYlhJ00eRf/2g7N04RotYPHi+7PB3XjzpHbJw1kWJPirozbP3bC8gZvF j/1wl1+wk1LM+WGTYtbTMoXghK0fxpocIAZ5WRCZLCoNhpThkqYR1/Q8HoZpVodHCeXl FbVUIDxyald0OqIBNO5729N7mxPUsC3HrTIQ2KPRc8wIUYC0PFvrOUbkviK731a0S00h QSsA== X-Gm-Message-State: AOAM530jAruZx/196cvOjOUczd/SwzsQUmNT4lxA2tmIheuCf7AZTCdQ zxWuhL6OXQPMNDUfWGTOWZY56A== X-Received: by 2002:adf:eec5:: with SMTP id a5mr6833415wrp.303.1614690086136; Tue, 02 Mar 2021 05:01:26 -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 91sm5782778wrl.20.2021.03.02.05.01.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 02 Mar 2021 05:01:25 -0800 (PST) Subject: Re: [PATCH v2 07/10] clocksource/drivers/hyper-v: Handle vDSO differences inline To: Michael Kelley , Stephen Hemminger , KY Srinivasan , "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> <42dc252a-b09a-afeb-6792-9b77669c16e9@linaro.org> From: Daniel Lezcano Message-ID: Date: Tue, 2 Mar 2021 14:01: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: 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 02:29, Michael Kelley wrote: > From: Daniel Lezcano Sent: Monday, March 1, 2021 4:22 AM >> >> 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/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 >> > > Is there any particular benefit (that I might not be recognizing) > to having the .enable function be NULL vs. a function that > does nothing? I can see the handful of places where the > .enable function is invoked, and there doesn't seem to be > much difference. > > In any case, I have no problem with making the change in > a v3 of the patch set. It is just coding style, it allows to remove a #ifdef in the code. -- Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog