Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp988328pxb; Wed, 3 Mar 2021 23:39:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJzCn4be4sKLuy00pY3JWGUezd+19Ddvgch9XdTgOqGpeqHzfJ19CKHUZ9dn6SN9och8JnMA X-Received: by 2002:a05:6402:c0f:: with SMTP id co15mr2817935edb.373.1614843580593; Wed, 03 Mar 2021 23:39:40 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1614843580; cv=pass; d=google.com; s=arc-20160816; b=h2ExyBZyKaBQHO77YkLfGPVb5OG4IQWrxvr4CZBQyXSZ8ZEWPuE0kwNV6pArZHwg9g EEo5bsO6FTsDGimrPBf4Z1t5Ti0qUPYWTVgxj8UPaEeNJf7C2unAHB/fX+YPePZNbnjZ zdvUMq/VBz9VAU0j7cuQKwLfEDdlqVEzUzr70FeFo3Iw2Dc98V20K/AGTuu0aHxUMMF8 k0L63Ihvcuy5Rq7QJetXqv+UDF6QCxmi6UH/P/ewcCLJ/uHqaFUBggCLxGWSHCBzPcJe n7VekHnQ868tq6lajBA/aa+23YlOyfMEGHiNChbMOHk2wc8BkL4G1Kc6sTVBXWOxAgXP +rkw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :msip_labels:content-language:accept-language:in-reply-to:references :message-id:date:thread-index:thread-topic:subject:cc:to:from :dkim-signature; bh=hHAYMM1NHv6c1BK52afcNb0BTehwHnfaDDz5sld0uRA=; b=M99HMgzoGWnQCVoYUMawHVtboDDgncrdjAHdr/nBB2nYXKc9AyjgcKu1PpgqoAQjta fzfA3YjqNWT4W6xO7rsr5y6vudex05JxEDvdJOEwR0f+k8Hx2RjEfX67A8GVCRhHuDSp po+p+pSBiSlb68HkVDeYfq2RHXBNY6qNMg69OOA1gTj7OlekiUuwHFODphJo/Ta5NK5a hobUOQTY85dpXGSjUH0tt9XYSc/MsSa/h7lkFMb63Q+sDpRyo8bd/EPd5wbX/3Iokvod rn9dQQ+bMbLH1JHK+usCan3dqPr+WdNBDPiUpeRI9W6FkVdte5s0Qa6AuThPgDQaho5T aiyA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector2 header.b=jCtzKZm2; arc=pass (i=1 spf=pass spfdomain=microsoft.com dkim=pass dkdomain=microsoft.com dmarc=pass fromdomain=microsoft.com); 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=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h19si1837462ejg.578.2021.03.03.23.39.18; Wed, 03 Mar 2021 23:39:40 -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=@microsoft.com header.s=selector2 header.b=jCtzKZm2; arc=pass (i=1 spf=pass spfdomain=microsoft.com dkim=pass dkdomain=microsoft.com dmarc=pass fromdomain=microsoft.com); 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=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356511AbhCCKrh (ORCPT + 99 others); Wed, 3 Mar 2021 05:47:37 -0500 Received: from mail-co1nam11on2099.outbound.protection.outlook.com ([40.107.220.99]:49344 "EHLO NAM11-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1840150AbhCBXHv (ORCPT ); Tue, 2 Mar 2021 18:07:51 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LfjGAkq1m+BH5qtWhvHnbV0hNDdPFr+RD9OXtTJKlikUWXFAsN5a7pjSYi7J09FhHdWXrTWXu+ThNWvQ4VkwNudOQbSjNuiJeGGgKeDo+M7XnJG1mRxktJ9/DRcLt0GZnYRLlgN6Trbe/y7CkcGLJWQq0jlo/xHUaYzs0SMn+fhr4jxZZxlLQKvDFb9Pwjk3WSJytY4XNNe+vtE1zCOgtjWjhBu15GyfJy7ptCw8cRbgbJWjV9uPdNwFsRU6UDetQIGCLIutqa5YPO3uodIa0n4sbI+mjEu2dSA3twA0ICUmMxm8E3WCEHoaGbKqJ80n+7nHxtp383Gy8XwIdLXn2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hHAYMM1NHv6c1BK52afcNb0BTehwHnfaDDz5sld0uRA=; b=JfDFbZbhNnt20if1XojP6kmAx7pM6g08Y29N921pcmL3Yq/BorfW1mY9NqAWTsj4PpH3HN8r1kuyitksWT4dAqfgAwhzVS5qGNwos/3sp9j8/tYHFZKb8Cw/1ET/BkBtmT17FIsMYMckbh6EIlA3hn1UwMMGkaYgWkdiHaIMMRR3wyF0BvtOhUocYn7EM5b2GNy8nUl0bBjNL5F/TMmbcm1QJOiKEQas4aVm+wYOBsA+2co1OUVZYqliKDyxXlckA5vrXuUqwpQ/if9x2gPHKtCpQUX2dp0j/JYvz9OXyodH+rJ+pdCTUT/re3/b5E0qm2LmBZOJDFeP2rSyDNIllQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microsoft.com; dmarc=pass action=none header.from=microsoft.com; dkim=pass header.d=microsoft.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hHAYMM1NHv6c1BK52afcNb0BTehwHnfaDDz5sld0uRA=; b=jCtzKZm2kxTD+chsvuxv+q2QNSFKszNzoo3jjb0FFKrHTsIhTHeVDVH9/kfztBBcyurdPbrT+oip/Zcpt4Izs8hiX1eX0ELb8YcYgCL3MwcpOPcmE+v7jCwPsmjHgFkMmhR4y0vB2DbPDWLqun1+sVc9ts3565Kk099OwpDlEWE= Received: from MWHPR21MB1593.namprd21.prod.outlook.com (2603:10b6:301:7c::11) by MW4PR21MB1970.namprd21.prod.outlook.com (2603:10b6:303:70::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3933.8; Tue, 2 Mar 2021 23:06:51 +0000 Received: from MWHPR21MB1593.namprd21.prod.outlook.com ([fe80::9c8:94c9:faf1:17c2]) by MWHPR21MB1593.namprd21.prod.outlook.com ([fe80::9c8:94c9:faf1:17c2%9]) with mapi id 15.20.3912.016; Tue, 2 Mar 2021 23:06:51 +0000 From: Michael Kelley To: Daniel Lezcano , 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" Subject: RE: [PATCH v3 07/10] clocksource/drivers/hyper-v: Handle vDSO differences inline Thread-Topic: [PATCH v3 07/10] clocksource/drivers/hyper-v: Handle vDSO differences inline Thread-Index: AQHXD6x01LY7XmpNTEG5OPuJxVWUH6pxQ3IAgAANFHA= Date: Tue, 2 Mar 2021 23:06:50 +0000 Message-ID: References: <1614721102-2241-1-git-send-email-mikelley@microsoft.com> <1614721102-2241-8-git-send-email-mikelley@microsoft.com> <25234414-d905-0f9c-af92-9a9e4cde30c4@linaro.org> In-Reply-To: <25234414-d905-0f9c-af92-9a9e4cde30c4@linaro.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Enabled=true; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SetDate=2021-03-02T23:06:48Z; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Method=Standard; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Name=Internal; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SiteId=72f988bf-86f1-41af-91ab-2d7cd011db47; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ActionId=a699e977-03e3-4a5c-9be1-4d75c48ddc00; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ContentBits=0 authentication-results: linaro.org; dkim=none (message not signed) header.d=none;linaro.org; dmarc=none action=none header.from=microsoft.com; x-originating-ip: [24.22.167.197] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 1e83b580-bb79-4628-f2f9-08d8ddcfdd23 x-ms-traffictypediagnostic: MW4PR21MB1970: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6790; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: UvNUQxdNNPi39hFH/3qge2VUOCJq6qz3DJwsyo9dRSe99pvqXOvfW7X6G+s4DnqEYlfyvDHEOfTTiBXssfkO3bCHODhGfgqp5rJrQJSdGkllcVcdqOVsS6ZRQCsqrRLaYRnLfqvJ2SFbCRrPyzmHr6irFJgY8cA2myeeskd2iVmnOJpA7TriWUUcx2c4rUcGHGb+1EZM6WhiGNxjrM+RoCwdwXA7pgRGs2gF8QEpULrsKN5E6YV9YVTkWTVAslGV7BqsIDv1h7bqqQaFsOK7H4U73xT9ZS1JXWcA03WZCPRGRgsEXfZCdr5Q6Eefilr48D1/3Q9/ZWa/XnwMg7Sr3JX16ReelOXo95E4DnWoRTFmz3q87F0JnNLKaMIKwVMICcjuh9CfQoeO27PcLfeuFEqwoPxFC97yjt396vCSxsSPjrAxNa3LduUET57qiJNw/TxSEffpYT2S2f27ZYT5YJ9btsVJyaT4wROFnjLy6E3SnjtbB9bQ9nC57yTW1gqTfKcGKeFlbjeDCKAsLcQid4vWUEKFihIBbYKasW55SEQdNDXJ3O7EUMsNV4Asa/hnBCvp8s90g2YEFLCXZ7eAPU5Arydwla7pxV4vOSxqMJ4= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR21MB1593.namprd21.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(376002)(39860400002)(366004)(346002)(396003)(136003)(9686003)(7696005)(55016002)(71200400001)(2906002)(76116006)(5660300002)(110136005)(54906003)(66946007)(53546011)(4326008)(10290500003)(921005)(82960400001)(82950400001)(8936002)(52536014)(6506007)(26005)(66476007)(64756008)(86362001)(7416002)(66446008)(478600001)(83380400001)(33656002)(186003)(8676002)(8990500004)(316002)(66556008);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?VpgITsOqgIgxEyi63bR5q1EA3w+CtdpwLGxXninH1du8dQQFclg2QjcerXLT?= =?us-ascii?Q?a9HJOzr1H1NdmCP2PWjXbUTO39Fhmy69q6azGRn2VnyNUWgeBGEtnhnSTt11?= =?us-ascii?Q?SScKg0EYVacsWFd0dhXjRfOa8QU6FHmGpi+k2JXhEVEjWaLnet+rTumljyDD?= =?us-ascii?Q?RzsYHlHFZmU1KzN3j8xCUHsKFR/dLCDFZMPqHktPwqgPZZQEN2bSyoXsyQpp?= =?us-ascii?Q?bXaSI3JCb9YJAkY6rGw2cZ3s9Z2QBealDRcj0CuReQ5hbCf64Tijjz3rS3sC?= =?us-ascii?Q?XOwdYM4/xLmsSXfdgD5QAzCaYP5agLKjl5GdXWnRLdFqPk9RFvo8QmPknVYU?= =?us-ascii?Q?+9Tt3UKNJikwQtcS1IiVBv2ddW2AMe46hwyPiY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UK3RIxUWFeKMA+hEIf3K+csTXDJb/XFMUMaivhR0wCVNUKpMSYO6B?= =?us-ascii?Q?c9vX7nX36dQNbJnXW4QYbMew?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MWHPR21MB1593.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1e83b580-bb79-4628-f2f9-08d8ddcfdd23 X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Mar 2021 23:06:50.9485 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: QoAM0Si3l2+aQaArwWqbkh/nh8j8+AxDQzNM6FLTMkVUpQxf5LexB0NcPqWhPbCsMrIzu23LgBhav0GTt49yD3vfNOEiOKMQOy0Cgu0vnSs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR21MB1970 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Daniel Lezcano Sent: Tuesday, March 2, 20= 21 2:14 PM >=20 > On 02/03/2021 22:38, Michael Kelley wrote: > > While the driver for the Hyper-V Reference TSC and STIMERs is architect= ure > > neutral, vDSO is implemented for x86/x64, but not for ARM64. Current c= ode > > calls into utility functions under arch/x86 (and coming, under arch/arm= 64) > > 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 unde= r > > 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/msh= yperv.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 =3D 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/h= yperv_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 clocksourc= e *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 >=20 > We had a confusion here. The suggestion was to remove the #ifdef here > and add the __maybe_unused annotation to the function. I wondered if maybe that's what you were getting at with your most recent comments. But the code doesn't compile on ARM64 with __maybe_unused instead of the #ifdef because VDSO_CLOCKMODE_HVCLOCK is undefined. Michael >=20 > > static struct clocksource hyperv_cs_tsc =3D { > > .name =3D "hyperv_clocksource_tsc_page", > > @@ -384,7 +386,12 @@ static int hv_cs_enable(struct clocksource *cs) > > .flags =3D CLOCK_SOURCE_IS_CONTINUOUS, > > .suspend=3D suspend_hv_clock_tsc, > > .resume =3D resume_hv_clock_tsc, > > +#ifdef VDSO_CLOCKMODE_HVCLOCK > > .enable =3D hv_cs_enable, > > + .vdso_clock_mode =3D VDSO_CLOCKMODE_HVCLOCK, > > +#else > > + .vdso_clock_mode =3D VDSO_CLOCKMODE_NONE, > > +#endif > > }; > >