From patchwork Thu Feb 1 01:04:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Hilber X-Patchwork-Id: 13540528 Received: from refb01.tmes.trendmicro.eu (refb01.tmes.trendmicro.eu [18.185.115.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 068215692 for ; Thu, 1 Feb 2024 01:06:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=18.185.115.53 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706749600; cv=fail; b=d/xCfuAZtIOpeSuGwoz4wcfqwvbrVOU+f1aMja/E0khUjDyYGi4CH8YRj8iMxKAHyO13OQQ57Op/0lICzeYvzjRh/C6Qnt9B6m4aEYQ21AwHRMEu/2zF3aJikMSJyfECHUSrH3UO6WW/4X7cVU6tLja7pjmdomaSG5Wx/WCs26A= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706749600; c=relaxed/simple; bh=VEEICBI9hb85ucOIjDdO+txOgLqKBI+xAIKrGkmsBbI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=EIKINwnkM9wx8oInn2IGhCV6sBNowAS3R0/JsatpEvFFbkrGSQcKhVal28NoVxjWHfoDY57BneYgVx9esPsL8VD7Z55eJe5QviEyPN8u0vTVxW05Z4abbPoiNuqJwAyKoZFswoat46shBx2hUeeONZ83tlZIpYIYuYsukm7zvq0= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=opensynergy.com; spf=pass smtp.mailfrom=opensynergy.com; dkim=pass (2048-bit key) header.d=opensynergy.com header.i=@opensynergy.com header.b=yVBUe2Sq; arc=fail smtp.client-ip=18.185.115.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=opensynergy.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=opensynergy.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=opensynergy.com header.i=@opensynergy.com header.b="yVBUe2Sq" Received: from 104.47.7.168_.trendmicro.com (unknown [172.21.9.43]) by refb01.tmes.trendmicro.eu (Postfix) with ESMTPS id 5FFF710D3A204; Thu, 1 Feb 2024 01:06:31 +0000 (UTC) Received: from 104.47.7.168_.trendmicro.com (unknown [172.21.165.80]) by repost01.tmes.trendmicro.eu (Postfix) with SMTP id B3A7C1000007B; Thu, 1 Feb 2024 01:06:23 +0000 (UTC) X-TM-MAIL-RECEIVED-TIME: 1706749546.249000 X-TM-MAIL-UUID: 83e2df86-fe60-4be2-bc0a-13be3f96a655 Received: from DEU01-BE0-obe.outbound.protection.outlook.com (unknown [104.47.7.168]) by repre01.tmes.trendmicro.eu (Trend Micro Email Security) with ESMTPS id 3D02010004D81; Thu, 1 Feb 2024 01:05:46 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SMez3rGaMDRxG9JWPC/MtVIt4NdDRUvVdAec/6GUE8vsV+g868BfoKNYc30VJEsmvAUtSdgiiz1YYo0QCv1wGderMKe5JgfySakd1X1wL/B3zIIwC30LQZ5DPSZiQM2OMLCw/nmXKnladAA3Myuk7IpiCtKl0bGiOd4+y0B7dx2hU80jblPF5hb2GWa07+wyALhIgLLpneLT903PFfyOIVkEUy2aE/QHQ8s3U6JBZOA18tHqGvcoVYhdydrvHvanJ9T9kT2oDYEXKztZY87ZFe56OloktevPJWaES9nO+OnsyRRmaVxB4khQuzblgfvh/wCP2ajGpKykXijazE6YcA== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=P80BaWCtwU961ML0qd6PJqYYAAwoo7QXKC2rGxLdToo=; b=VNcdtBwsaDa7BrEExG/HoZe0b0cqrbo3TsfnWa2SdW2COkkD52oMFB72SH7wvTxFxHb/YJ5EjcdwIICoI3ASo6vtmF5v0VV3u3prM6aN2QUAxpZm5eFD93my0L9JQDrX/2L3k0ZoyXmEYmhxg/uNP+IMBujP7/7EEVi/rBTbNms7cJS+ayRdGvs+wkxoKlS0ZdqEhCWgzY53Xd3v7UOiHoqjJJSS47ZeHUEuU924kQLeOcuvQtE5JWrXAOnY3S5PoBBI9/4uPTTjRzgNeLq9n3r5NKge9oWBZotrLx8Wlak/td2W5dOaMn+0Qwnh4eRtXvArFJ1CRNTEIjNDcj2DjA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 217.66.60.4) smtp.rcpttodomain=alien8.de smtp.mailfrom=opensynergy.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=opensynergy.com; dkim=none (message not signed); arc=none (0) X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 217.66.60.4) smtp.mailfrom=opensynergy.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=opensynergy.com; Received-SPF: Pass (protection.outlook.com: domain of opensynergy.com designates 217.66.60.4 as permitted sender) receiver=protection.outlook.com; client-ip=217.66.60.4; helo=SR-MAIL-03.open-synergy.com; pr=C From: Peter Hilber To: linux-kernel@vger.kernel.org Cc: Peter Hilber , "D, Lakshmi Sowjanya" , Thomas Gleixner , jstultz@google.com, giometti@enneenne.com, corbet@lwn.net, "Dong, Eddie" , "Hall, Christopher S" , Simon Horman , Andy Shevchenko , Marc Zyngier , linux-arm-kernel@lists.infradead.org, Sean Christopherson , Paolo Bonzini , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Wanpeng Li , Vitaly Kuznetsov , Mark Rutland , Daniel Lezcano , Richard Cochran , kvm@vger.kernel.org, netdev@vger.kernel.org, Stephen Boyd Subject: [PATCH v3 2/8] timekeeping: Add clocksource ID to struct system_counterval_t Date: Thu, 1 Feb 2024 02:04:47 +0100 Message-Id: <20240201010453.2212371-3-peter.hilber@opensynergy.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240201010453.2212371-1-peter.hilber@opensynergy.com> References: <20240201010453.2212371-1-peter.hilber@opensynergy.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB8EUR05FT021:EE_|FRYP281MB0032:EE_ X-MS-Office365-Filtering-Correlation-Id: 1cfb6228-dfca-482c-2d12-08dc22c1ea60 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UJ+33MOJqXy1BUIqjzZao42U6FTXpc6uM6q0Y5jYgacj1BxAR1Ku6fejhtVn89fRbMecP/IR8UWyIq55mQTb7ypblIhJjtbY1udN3Pa4qz38SJMJL3tJhMlOewyPwE5Q/hwAWzU9TF1Rvmx2OCj0CTadCjvdb0jWMdcJTzXkBkAOkL3FsjuAElPL6fFXp2G3eLQa2Gsf/bSVUrLzte03VBsdD+IMarOxtptrdHdhDYTPHA0RNgO3tdD6O1ntverq7fMQ7pQSq9xcIkfduXbwWXutg5YG5+S0hDhF6B60E3LQmpLxuX/ZxUpNJC6bUzST+FYA9JTS/3RP5ZYa3a65ve5f7kC/Y4tpvGenZkiTgvpMDkgi9kDNkMxqkNFIUnxWsv6UUK016EzRQElFOcUvLWAv+ICBogmlepUMIJnKUvZNsUTqAz9zM5EmEEJKyfJuByyaJ7wDdkXOC3xdYd2SyWBMpR1w741Q/h3JclXcX/O/SRuS8JAy+eOUDEgClYNJGU8WVruo43kNn4vJVujycQKoCjYugzcYjHi7zaghhkjxFmpkP7zKXZsTxcSP+PtFwBC4FIFvRa754kIj0IWLQWXIBH1dYvbyZrhYP0PEX7EcxUU/XbdOtSYZkI9x4nizoU7/TDi+RsO1c1nFuOL0EyFZEs/HbwThIJpUYy4SYK1zX5peJlwuUHJbBv8qLWJtCjsH6TXXViuyPbilXm2vIux2ZKnMGgHg76vT9b2GsjM= X-Forefront-Antispam-Report: CIP:217.66.60.4;CTRY:DE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SR-MAIL-03.open-synergy.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(136003)(346002)(376002)(396003)(39840400004)(230922051799003)(451199024)(186009)(1800799012)(64100799003)(82310400011)(46966006)(36840700001)(41300700001)(54906003)(36756003)(47076005)(36860700001)(316002)(1076003)(2616005)(70586007)(70206006)(6916009)(42186006)(966005)(5660300002)(478600001)(7416002)(86362001)(2906002)(8676002)(83380400001)(26005)(8936002)(336012)(4326008)(44832011)(40480700001)(81166007)(36900700001);DIR:OUT;SFP:1102; X-OriginatorOrg: opensynergy.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Feb 2024 01:05:43.4878 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1cfb6228-dfca-482c-2d12-08dc22c1ea60 X-MS-Exchange-CrossTenant-Id: 800fae25-9b1b-4edc-993d-c939c4e84a64 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=800fae25-9b1b-4edc-993d-c939c4e84a64;Ip=[217.66.60.4];Helo=[SR-MAIL-03.open-synergy.com] X-MS-Exchange-CrossTenant-AuthSource: DB8EUR05FT021.eop-eur05.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: FRYP281MB0032 X-TM-AS-ERS: 104.47.7.168-0.0.0.0 X-TMASE-Version: StarCloud-1.3-9.1.1015-28152.007 X-TMASE-Result: 10--1.225700-4.000000 X-TMASE-MatchedRID: I6rpFm0lrcMEZ1mm50iAbgs6eGQ6Ral9EkUS8Erng9pzi8z2Fvgo+kp9 UxJnBl3FHDf9l7U5F7SnyNbHJWoNRbkeKW6KfnZEiu6u4shZ+fHcHWFKCmADc2shUDcgZ8ILoMQ NBr66IpTrLAe8bL+cp6EWqZPwachiifyRQLERY0pCPQBD3xA/3aODSWu0oxbK6gfKtA7Yhlrtmy EvxwC5ZF4L45p2p0pV3+6k97GsyDgqZdHEYvGr9R+AJsLlsQNEJEWB6QUw47pwgry9e+z6K02xv NT0DEAe X-TMASE-XGENCLOUD: 5b6ea32b-704b-42a3-a7c3-7ea9119431c2-0-0-200-0 X-TM-Deliver-Signature: 31549B26C2C12E238FE761D6A9ABD8F8 X-TM-Addin-Auth: ySrecwAZ6T0lqY5ygKpJic7UH9JZ0ONTg5B4LEUWxWxmxrX+NxzTqbuy9T/ B1YOtZV39v3RabXTypwHnahUBDDHv+VX35DBWxkf24fZB6OyGUUSw/PxMvOEAvy8Lv9e8M+ZKDO jBpsIskkODLgPyD+kxnxbAkpqXZGRK8cXaKG7PBFJJcgwgVNTNO1gHkIwShrHK4jNuGCJL5CVgx pRIPNLW4gp6wYLaovr+TFdELhcEfa3rIL/MdnxOnxdAHgtWR47GQgwhOwc0/J8Kdfmh6vsNuVWu qBmXceFOihjAAs2U/tqCUdSL6mv/9Vc/MReA.KDDjpmL4E1kvs5qcC+MdSieM0sfsL3FwnH/oBD tVaCHFlDpgX0PSjZUwqIx6XdLnB60NJRAbT/YOa0CS2Fuooel4jWkh32+eVuvsbQl7YYGMwNneh +7pVeUj28tCQm0KwxQm2KQQQvu3yfLAEthSRVBI5RvkzECC7XqT9EOeZj1iR0u2xGo/rRq9rMUc A9Jg0LkFCAbHtLzmUsfeKO6kgvDhUFS7QCz+TzH5pAe6Xpj8ER8e0tqQYj18N+ahwTvF6bU3KQb 8DopGyCYin6DICZfAOATZzqaP1PX/ZRdRy/fAB/r7TMs/EkydQ9r2tz7YhiHqdUwZh7IS309KcH bjyQ== X-TM-Addin-ProductCode: EMS DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=opensynergy.com; s=TM-DKIM-20210503141657; t=1706749583; bh=VEEICBI9hb85ucOIjDdO+txOgLqKBI+xAIKrGkmsBbI=; l=1732; h=From:To:Date; b=yVBUe2SqPjElDv94s/Rg71vp8wnuw5LF6WDKlMqqCdt+hab6nWGOcT57byD6WKNP1 cWzGJ9G+2IndCT+lUuxAIEtch5gOfm/lZ/uXCQ6sfBgwlq/jCcqHGGQa1nQtTd5eEx o6T3AJd0ryAMy3rwx1y9bDx5he3rtYypPkZtd1hIUwIMvy2Piomov1896bcbD0Fl13 WZ66wqj1nAubKgueqMkq+BG84pt0XDA6DXd+cIlk7B9wHnyv39APn/RJFYOPe0StJI 8PWq2IlR8E1qDKxn9Wt3YJkpQX4B0C3OdlQ8DppPzYVAfhQ5XI9Ih53GedqlTNA+8U S0b+mMa053b5w== Clocksource pointers can be problematic to obtain for drivers which are not clocksource drivers themselves. In particular, the RFC virtio_rtc driver [1] would require a new helper function to obtain a pointer to the Arm Generic Timer clocksource. The ptp_kvm driver also required a similar workaround. Add a clocksource ID member to struct system_counterval_t, which in the future shall identify the clocksource, and which shall replace the struct clocksource * member. By this, get_device_system_crosststamp() callers (such as virtio_rtc and ptp_kvm) will be able to supply easily accessible clocksource ids instead of clocksource pointers. [1] https://lore.kernel.org/lkml/20231218073849.35294-1-peter.hilber@opensynergy.com/ Signed-off-by: Peter Hilber --- Notes: v2: - Refer to clocksource IDs as such in comments (Thomas Gleixner). include/linux/timekeeping.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h index 7c43e98cf211..ca234fa4cc04 100644 --- a/include/linux/timekeeping.h +++ b/include/linux/timekeeping.h @@ -273,10 +273,15 @@ struct system_device_crosststamp { * @cycles: System counter value * @cs: Clocksource corresponding to system counter value. Used by * timekeeping code to verify comparibility of two cycle values + * @cs_id: Clocksource ID corresponding to system counter value. To be + * used instead of cs in the future. + * The default ID, CSID_GENERIC, does not identify a specific + * clocksource. */ struct system_counterval_t { u64 cycles; struct clocksource *cs; + enum clocksource_ids cs_id; }; /* From patchwork Thu Feb 1 01:04:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Hilber X-Patchwork-Id: 13540530 Received: from refb02.tmes.trendmicro.eu (refb02.tmes.trendmicro.eu [18.185.115.60]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D57825231 for ; Thu, 1 Feb 2024 01:07:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=18.185.115.60 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706749660; cv=fail; b=Iu4CJwiVqSd/4kWWXN8ruDhnmWdS0+ibJEzTNrzbTpjw1ffuCr6W08b3/XEB0+YIEw1fqgyBiiHcdGFc6XfiMkaYy0kZgLPU07tAfgAxJP3To7zqrOg7goA3ihBOrId5z7btySU+T5iDEbm3Om4keZCNDi5nFjh00BpW1RvrI8M= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706749660; c=relaxed/simple; bh=kph/GZbUL8v7Z7FSL2xEtj/zUnB/iHPuTCylgtGC1wc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=EQG3946E+Uvtvb3JF/SnvyW2FJRIq0IFEPVsPBWJh6TMzN10bN3wqdxgnbXcOHq+U2pNwU0LSOFDS9KbvTNElc2Gymfh7ifzRM0SotR2w4vU2XW4+nlEwsI6C25zLN6wVGIfX7+TII1XV28AJw3PtWqWQemRqxPcCVkrKddEgIg= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=opensynergy.com; spf=pass smtp.mailfrom=opensynergy.com; dkim=pass (2048-bit key) header.d=opensynergy.com header.i=@opensynergy.com header.b=W1lqbVer; arc=fail smtp.client-ip=18.185.115.60 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=opensynergy.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=opensynergy.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=opensynergy.com header.i=@opensynergy.com header.b="W1lqbVer" Received: from 104.47.11.168_.trendmicro.com (unknown [172.21.10.134]) by refb02.tmes.trendmicro.eu (Postfix) with ESMTPS id 7C13110A7E634 for ; Thu, 1 Feb 2024 01:07:36 +0000 (UTC) Received: from 104.47.11.168_.trendmicro.com (unknown [172.21.199.136]) by repost01.tmes.trendmicro.eu (Postfix) with SMTP id B23011000045E; Thu, 1 Feb 2024 01:07:29 +0000 (UTC) X-TM-MAIL-RECEIVED-TIME: 1706749545.895000 X-TM-MAIL-UUID: 3c71908f-6059-4723-b1c6-9309dd182ff3 Received: from DEU01-FR2-obe.outbound.protection.outlook.com (unknown [104.47.11.168]) by repre01.tmes.trendmicro.eu (Trend Micro Email Security) with ESMTPS id DAA3010006A5E; Thu, 1 Feb 2024 01:05:45 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Eda9osc6SezHsGjdXbSKIH1/GE6+71QDoSKcu3jBUTIdL+urdgCLPH9XM3hSg+8/oyfZMFo0EccgfrmwsO5lZ5b2eZSYrXjgyDa5z/wF6+46Xl6F52JeykdV5Wc+JlGCHmcxRAkbB3Qnb2wLk6Q8uAk2LYJcZWYSILfacj7pYYTZq7QqWhsIMFJycGXZkXQfmQsPTIvptf+RzGWIrSXZSr2U6mygCuu107gmP6AEeLj+hMw+GalKMiFMZxICK8EgEQRimAkNgDQgkzFzWdl3qz/BKarXU2TB+KvxyEhJBsnLCgYUxC60zosbp725e7+I5vxpOUQ62oMAEm2J0tICzw== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=9qi5SeCGD4c/KlJEua7rmHMG+XxuwLmKXWOyIksFBo8=; b=iJJRu87tJ0gH0pHtZddl5c2dSvMNxSK9Ig1iJyisfEHaemdWj2HsCtOjss6VC3WxvOpV4dWoh+uiStFAek/XI3YQOfnBTqs7FJSZCZwAgD4zODUsWrfWfeBfhsQvw5wr7QJj6VnXfaye+83advL+exjRs8WQHrkM29gxLblgKjsH+RNPVhmsg/cmZHJidpEylvf1sC1a+/Czy+28+LBxLyGFhCmzrLf7ZtSCYmG4U51uCNBEMO1ZVDdkukwBtTvBhjxzG8TkcU3PMp5HFF+pDXpXyl1LdAlDV8AW/QfsznvcG744xWNwz1eGkK5E+1Wbg0TKUXXsVkB8bkIKV4g9wg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 217.66.60.4) smtp.rcpttodomain=alien8.de smtp.mailfrom=opensynergy.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=opensynergy.com; dkim=none (message not signed); arc=none (0) X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 217.66.60.4) smtp.mailfrom=opensynergy.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=opensynergy.com; Received-SPF: Pass (protection.outlook.com: domain of opensynergy.com designates 217.66.60.4 as permitted sender) receiver=protection.outlook.com; client-ip=217.66.60.4; helo=SR-MAIL-03.open-synergy.com; pr=C From: Peter Hilber To: linux-kernel@vger.kernel.org Cc: Peter Hilber , "D, Lakshmi Sowjanya" , Thomas Gleixner , jstultz@google.com, giometti@enneenne.com, corbet@lwn.net, "Dong, Eddie" , "Hall, Christopher S" , Simon Horman , Andy Shevchenko , Sean Christopherson , Paolo Bonzini , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Wanpeng Li , Vitaly Kuznetsov , Mark Rutland , Marc Zyngier , Daniel Lezcano , Richard Cochran , kvm@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH v3 3/8] x86/tsc: Add clocksource ID, set system_counterval_t.cs_id Date: Thu, 1 Feb 2024 02:04:48 +0100 Message-Id: <20240201010453.2212371-4-peter.hilber@opensynergy.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240201010453.2212371-1-peter.hilber@opensynergy.com> References: <20240201010453.2212371-1-peter.hilber@opensynergy.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB8EUR05FT010:EE_|FRYP281MB0093:EE_ X-MS-Office365-Filtering-Correlation-Id: cf5fb289-d164-4722-b051-08dc22c1eae7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Q6wV8Ma0AfooY2vBodUQE+9VGdTUFvLwXC/WTekIONIEqZJ6EbLV6J1RC5YMBLRbtkRnmL3rf9YOetjV4nPDg4G2glkyxA3Uqljef16/DGPEATVw6xWo8kN9+KX+1TXXl0VD+gzSrJmqS+6jMFwHLTeytLIzR7V1pz4GPfrTjSHFf/Ax6/PVkd5NCpd7ahspxRCBg2G5X6gRL4gLmLreEA2cTFyxVwhKYtxUEYBYVmesTwCqusDAn+aI2xGj9AOuQ4/Hpf8ewasRuwYOnNYxddqGCWiALWN7O82HOn6zXC3PJp4FTwED+aTDgxU7AWsjC1gEJ+JmF063pVwZN+EtQWQ9aMuL7iu6jJUkKmu2xis/b8bcLhR2IpRlhzqVNUDknsRunloTUXU+TBrvlTwqtkvrLMKKgfgb3CHt07IkvLGu8qRplZT015kqB15k23pBUeCsdGDhz/T6NtEZIwxXbheWQU+DCpvqQ9gEImp6BpzZFY0zLQYbo7e3QZkTIlhUlulikJLUOm3wb19DaETFH6BcNvjeFfjHcMUo49J1AyjZ9lhv3Zs/1buaOXiIwjISZwOosZs0TAAmNV0v6cOkmGRaGcCxP5TdH0krI4VF6B5lP2aYcV1VCYgFHOiM3Bj1SZHJ7sKGJ/tsviVTRpHTePIn3X85b1z9In6WPVppW1Tw13YEfCBq3POyA9ZIWrBmX4fxvqVZe262L+GaLIAooHEoUqI0UMKmx6m+OXOBU8RCSEZCPYNv9qYb6Dx+xNn2+tMNcTwtM9p0suQUCKcm+bPvnGOJJYks9Grk5vZq0a0= X-Forefront-Antispam-Report: CIP:217.66.60.4;CTRY:DE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SR-MAIL-03.open-synergy.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(346002)(376002)(39840400004)(396003)(136003)(230173577357003)(230273577357003)(230922051799003)(451199024)(82310400011)(1800799012)(64100799003)(186009)(46966006)(36840700001)(8676002)(4326008)(8936002)(83380400001)(2616005)(1076003)(70206006)(26005)(70586007)(336012)(41300700001)(86362001)(42186006)(478600001)(6916009)(54906003)(316002)(47076005)(7416002)(5660300002)(44832011)(36756003)(36860700001)(81166007)(2906002)(40480700001)(36900700001);DIR:OUT;SFP:1102; X-OriginatorOrg: opensynergy.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Feb 2024 01:05:44.3759 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cf5fb289-d164-4722-b051-08dc22c1eae7 X-MS-Exchange-CrossTenant-Id: 800fae25-9b1b-4edc-993d-c939c4e84a64 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=800fae25-9b1b-4edc-993d-c939c4e84a64;Ip=[217.66.60.4];Helo=[SR-MAIL-03.open-synergy.com] X-MS-Exchange-CrossTenant-AuthSource: DB8EUR05FT010.eop-eur05.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: FRYP281MB0093 X-TM-AS-ERS: 104.47.11.168-0.0.0.0 X-TMASE-Version: StarCloud-1.3-9.1.1015-28152.007 X-TMASE-Result: 10--14.335400-4.000000 X-TMASE-MatchedRID: DIEPoA0d9jzJ+P2VFrJmrKwODSO9Fuc1zmG9pmg8ncKJFoX8AKzcA1om CW9DDtQZ4hVD9eCRkSzqUb9emYLkvriZvMg1M8zIiu6u4shZ+fGRRM7IbBAoRyhxkKIUBctf+JL cWYHtZNEObBW6/DqoDOUTedInjF4ziRz4gknBIqB0CtK0DggAXqeeBvX7bSdNqWgfIMWloSygxg zwH3l2wulvQEurXogbqQMn/UStEoOovD0wMSGqkmwEEr52PwDFaRrjP4hMuEYY5lMhYxPBYrdG6 qoYZcgziQXeVzaEgj/rEDQC9rvecA+bXnHKG3yVfHZ4iVAbWwx8LgjA4u/K5wLgOGUBLTt6Wjsa YI4lh3XIx3Icp6zuW7dCjoZl+x6LClEFFkJvh3LF0CStGX+q3SX3GjGd8V5p X-TMASE-XGENCLOUD: 8c0870c6-cf32-4942-8371-e6ebefe45c43-0-0-200-0 X-TM-Deliver-Signature: 457A051C3E60FB81FFFA52480F7077B2 X-TM-Addin-Auth: g0H8j/tgeWZt7f3c1doJXElz7fTzMIbUDtS7WFcH9pbnHdsVxqGfKdGaXZy L4lmAWdUeo9oDkEkf0XVKMDlEAR4pstyw4BIvoZiGqOoiDIoV/su5AjUIZzOBA3FKTFrwURhkFS 9Q8yVZ0/Jg9TgwAip0dtGcH0P9PeHGMFfklc/cdvUdMDivvlZfUMbeYL+Gwdr00S5L0Myc4LL+V GwwOs2AXqMlWSuzjVVZVmi2hoHdlySvf05knPxQYOFtYdMNkmb9a41tzJARk/QqLb20kMCr0GzG Pg+D+JJOPXIaWBaRTHEBH5gTTqWg+fbnERLP.oUND6oWJmlwibje0Xwjsx7X5kSfjjAZUXsS293 zutkbiLrdLW2T2/1d7z8gWCY+R+MxSGJe6ujcEWY2t5l9Ex3CLiWpFw4zVz14NVyNe5rHCgEc1D Q0bm0Evd6JYz07IcRL3+irrf2hDggFUgvbE2mfnJqbLSmWYgL7NtpVPss9TZUVo3wu31B4pRlk7 jwDzyIWXufL9T4EU/RiVN7S9QGCfIIr6bgFEtp+i1EgD5Pq7TMrg3DzkpuZ7bQ/555vn4GnIWL+ xL0XD4ImaYDad52moUzFZyqsdvB2Y3xiTAhwcfvT9q5YdAre7a/6LG9bZyg7NqKq6R1HNks+gRP DxYQ== X-TM-Addin-ProductCode: EMS DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=opensynergy.com; s=TM-DKIM-20210503141657; t=1706749649; bh=kph/GZbUL8v7Z7FSL2xEtj/zUnB/iHPuTCylgtGC1wc=; l=4864; h=From:To:Date; b=W1lqbVerDfdnojQVcYq+RUuqiyM8t+YiciIAngWFY9ARIl+XxAKxP9LLu85CchGw/ Gk/3Xg3h45xNYsmACzKrRxjLc+C62wtNTAhwkhWRRCuhdpfi93bVy7lwz94xQsrzYc 7R681xx1Oyh6QEjfsIPm8UH5pHR3b07Sda9b5hZtNZP6OAGyU8HZllX5y972pYM02P nNWt+GYmmjS2+O4oJjVUyQIoqL7qnRC0509wmrORww4WYSN23/jXwlsAVUwQOkfYG5 GdGygZTo5wOVOxCpuwwerejb5iOSSUZm9T0ERrVN1CJjq0JNL+b/3WvhazL4ITkwDv YZZC67DuBfkxw== Add a clocksource ID for TSC and a distinct one for the early TSC. Use distinct IDs for TSC and early TSC, since those also have distinct clocksource structs. This should help to keep existing semantics when comparing clocksources. Also, set the recently added struct system_counterval_t member cs_id to the TSC ID in the cases where the clocksource member is being set to the TSC clocksource. In the future, get_device_system_crosststamp() will compare the clocksource ID in struct system_counterval_t, rather than the clocksource. For the x86 ART related code, system_counterval_t.cs == NULL corresponds to system_counterval_t.cs_id == CSID_GENERIC (0). Signed-off-by: Peter Hilber --- Notes: v3: - Omit redundant clocksource_ids.h include (Andy Shevchenko). - Omit struct system_counterval_t member documentation, to resolve kernel-doc warning pointed out by Simon Horman. v2: - Name clock id according to Thomas Gleixner's mockup. - Refer to clocksource IDs as such in comments (Thomas Gleixner). - Update comments which were still referring to clocksource pointers. arch/x86/kernel/tsc.c | 27 ++++++++++++++++++++------- include/linux/clocksource_ids.h | 2 ++ 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c index 42328f9653c1..9f164aad5e94 100644 --- a/arch/x86/kernel/tsc.c +++ b/arch/x86/kernel/tsc.c @@ -54,6 +54,7 @@ static u32 art_to_tsc_numerator; static u32 art_to_tsc_denominator; static u64 art_to_tsc_offset; static struct clocksource *art_related_clocksource; +static bool have_art; struct cyc2ns { struct cyc2ns_data data[2]; /* 0 + 2*16 = 32 */ @@ -1168,6 +1169,7 @@ static struct clocksource clocksource_tsc_early = { .mask = CLOCKSOURCE_MASK(64), .flags = CLOCK_SOURCE_IS_CONTINUOUS | CLOCK_SOURCE_MUST_VERIFY, + .id = CSID_X86_TSC_EARLY, .vdso_clock_mode = VDSO_CLOCKMODE_TSC, .enable = tsc_cs_enable, .resume = tsc_resume, @@ -1190,6 +1192,7 @@ static struct clocksource clocksource_tsc = { CLOCK_SOURCE_VALID_FOR_HRES | CLOCK_SOURCE_MUST_VERIFY | CLOCK_SOURCE_VERIFY_PERCPU, + .id = CSID_X86_TSC, .vdso_clock_mode = VDSO_CLOCKMODE_TSC, .enable = tsc_cs_enable, .resume = tsc_resume, @@ -1309,8 +1312,11 @@ struct system_counterval_t convert_art_to_tsc(u64 art) do_div(tmp, art_to_tsc_denominator); res += tmp + art_to_tsc_offset; - return (struct system_counterval_t) {.cs = art_related_clocksource, - .cycles = res}; + return (struct system_counterval_t) { + .cs = art_related_clocksource, + .cs_id = have_art ? CSID_X86_TSC : CSID_GENERIC, + .cycles = res + }; } EXPORT_SYMBOL(convert_art_to_tsc); @@ -1327,7 +1333,7 @@ EXPORT_SYMBOL(convert_art_to_tsc); * that this flag is set before conversion to TSC is attempted. * * Return: - * struct system_counterval_t - system counter value with the pointer to the + * struct system_counterval_t - system counter value with the ID of the * corresponding clocksource */ @@ -1343,8 +1349,11 @@ struct system_counterval_t convert_art_ns_to_tsc(u64 art_ns) do_div(tmp, USEC_PER_SEC); res += tmp; - return (struct system_counterval_t) { .cs = art_related_clocksource, - .cycles = res}; + return (struct system_counterval_t) { + .cs = art_related_clocksource, + .cs_id = have_art ? CSID_X86_TSC : CSID_GENERIC, + .cycles = res + }; } EXPORT_SYMBOL(convert_art_ns_to_tsc); @@ -1450,8 +1459,10 @@ static void tsc_refine_calibration_work(struct work_struct *work) if (tsc_unstable) goto unreg; - if (boot_cpu_has(X86_FEATURE_ART)) + if (boot_cpu_has(X86_FEATURE_ART)) { art_related_clocksource = &clocksource_tsc; + have_art = true; + } clocksource_register_khz(&clocksource_tsc, tsc_khz); unreg: clocksource_unregister(&clocksource_tsc_early); @@ -1476,8 +1487,10 @@ static int __init init_tsc_clocksource(void) * the refined calibration and directly register it as a clocksource. */ if (boot_cpu_has(X86_FEATURE_TSC_KNOWN_FREQ)) { - if (boot_cpu_has(X86_FEATURE_ART)) + if (boot_cpu_has(X86_FEATURE_ART)) { art_related_clocksource = &clocksource_tsc; + have_art = true; + } clocksource_register_khz(&clocksource_tsc, tsc_khz); clocksource_unregister(&clocksource_tsc_early); diff --git a/include/linux/clocksource_ids.h b/include/linux/clocksource_ids.h index 16775d7d8f8d..f8467946e9ee 100644 --- a/include/linux/clocksource_ids.h +++ b/include/linux/clocksource_ids.h @@ -6,6 +6,8 @@ enum clocksource_ids { CSID_GENERIC = 0, CSID_ARM_ARCH_COUNTER, + CSID_X86_TSC_EARLY, + CSID_X86_TSC, CSID_MAX, }; From patchwork Thu Feb 1 01:04:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Hilber X-Patchwork-Id: 13540560 X-Patchwork-Delegate: kuba@kernel.org Received: from refb02.tmes.trendmicro.eu (refb02.tmes.trendmicro.eu [18.185.115.60]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 19B35BA42 for ; Thu, 1 Feb 2024 01:13:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=18.185.115.60 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706750021; cv=fail; b=GqNwKoZKIKT4SMwMXxGKLvbS63JukjGlGtJkM3NOWDZiB1xVo8aTXp2TtZm9QRz0TFeD0uOffMCcqm5MCCxWNFv/SrShrg/gTfeV+dM6fJ7VIxpfn7YVnfSDSENNKTtdd6kmS8sL0tQ3DYW4mhK2g1bPeNs+bNdN1gTumkHkvxw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706750021; c=relaxed/simple; bh=5YtK4a4nifkYy7D9GImx5YWZNY7r7bQKqO6G1y6uwu4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=IJct2gogrXR0+VFRXoBxLQJSXmZcDiLUoN7+YE0LJD38M03TC43y/2uZHRRON18wfgRKuRSPH0KD+t8OoxGu7ypea8BzI1PC4MTDjVW1cZm5/t6lRPXeYex2o+PRy2vHZ3hh7s2S9Ov+5ALvNe/nlPx0Aa3yqQP115hEonjCUj0= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=opensynergy.com; spf=pass smtp.mailfrom=opensynergy.com; dkim=pass (2048-bit key) header.d=opensynergy.com header.i=@opensynergy.com header.b=V9n3kxsb; arc=fail smtp.client-ip=18.185.115.60 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=opensynergy.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=opensynergy.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=opensynergy.com header.i=@opensynergy.com header.b="V9n3kxsb" Received: from 104.47.11.169_.trendmicro.com (unknown [172.21.19.81]) by refb02.tmes.trendmicro.eu (Postfix) with ESMTPS id 5BB2A10A7E2DD; Thu, 1 Feb 2024 01:06:31 +0000 (UTC) Received: from 104.47.11.169_.trendmicro.com (unknown [172.21.176.220]) by repost01.tmes.trendmicro.eu (Postfix) with SMTP id CD5F2100004E7; Thu, 1 Feb 2024 01:06:23 +0000 (UTC) X-TM-MAIL-RECEIVED-TIME: 1706749547.193000 X-TM-MAIL-UUID: b05bbf6d-8b4b-42d1-8a10-3a4eb6c9942b Received: from DEU01-FR2-obe.outbound.protection.outlook.com (unknown [104.47.11.169]) by repre01.tmes.trendmicro.eu (Trend Micro Email Security) with ESMTPS id 2F5651000030C; Thu, 1 Feb 2024 01:05:47 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DxAE+zjcXonRvxWcg2KKBiAorb5Ekhpw7TzXJC0ymiBcNT6oQXKU0rKS666Y2qE/h0X6ZKNKQYsNvxkvyvQSkzlXIhaampPoDUgGflZfc2WUacX8g9HhWq7qzE4KFsyX+ApRT2ChQmWntBRdtOSDe4wTturGKlVy2uAlNeeCYmKZ3ECzGB8w/mDViikiY+C5TLxabhG6Fy7Om1crN4KYtq4F+ZgqfxvGVmKqWUnqUHe7/oHWR9tk0m2paXVmXlEnb4UWNlMjWBuM2AggHyY7aa2Ter7Ih0wXYGA1AZxv/6d8Jkcsl0iUp0nLROn1t2O69cJxaG3A+efFcYECdpYhIQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=5KYjWDpJ4m6ElafzQDPfs1wFjYeCwnJ/3eTVK+O6LPg=; b=FitptyKP4tdsDRVInPq3X4mqJSjchbb8jbZ1d8Sz5ovqFlM1EZElcrruVMHReiFu7l4SFxW1D+aYMR4rgjjbjc8/qISV9Qzy2Wgkl1GbGSqI4LLXZyA/e5XWP4M+2U2UsOd5MXm/I+B+hyWeS72MgJkVznDtj0Nsn0RMdWY6LeRbGKGxF21A7XTaNuVCJJO5SAjutMz8y38VGyzMbRbLCprT0pYUiaBIt+st9tiIz5DFZynaaJgedf1zIUBQ77JF59QTmlHfsouBAKXLj461aJ9db15BGKvejpUN5oxsdF12tyKaDduxbcQbENKvaXVPkSt0uechKCpwdlOwCk8TSQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 217.66.60.4) smtp.rcpttodomain=alien8.de smtp.mailfrom=opensynergy.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=opensynergy.com; dkim=none (message not signed); arc=none (0) X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 217.66.60.4) smtp.mailfrom=opensynergy.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=opensynergy.com; Received-SPF: Pass (protection.outlook.com: domain of opensynergy.com designates 217.66.60.4 as permitted sender) receiver=protection.outlook.com; client-ip=217.66.60.4; helo=SR-MAIL-03.open-synergy.com; pr=C From: Peter Hilber To: linux-kernel@vger.kernel.org Cc: Peter Hilber , "D, Lakshmi Sowjanya" , Thomas Gleixner , jstultz@google.com, giometti@enneenne.com, corbet@lwn.net, "Dong, Eddie" , "Hall, Christopher S" , Simon Horman , Andy Shevchenko , Marc Zyngier , linux-arm-kernel@lists.infradead.org, Sean Christopherson , Paolo Bonzini , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Wanpeng Li , Vitaly Kuznetsov , Mark Rutland , Daniel Lezcano , Richard Cochran , kvm@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH v3 4/8] x86/kvm, ptp/kvm: Add clocksource ID, set system_counterval_t.cs_id Date: Thu, 1 Feb 2024 02:04:49 +0100 Message-Id: <20240201010453.2212371-5-peter.hilber@opensynergy.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240201010453.2212371-1-peter.hilber@opensynergy.com> References: <20240201010453.2212371-1-peter.hilber@opensynergy.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1EUR05FT057:EE_|FR6P281MB3654:EE_ X-MS-Office365-Filtering-Correlation-Id: 06b4cafd-189f-4843-05c1-08dc22c1eb45 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CGH93QONNpnotSd5ir1KXFLAKLHO0g6xDMneH3QMhTOtvmUM9U8+75fe0QclloegLnh36K2b0+9GkMh218dHEPwTOlqej7nK1FHgLgkgMydmNpwGzhrvNxLdQLZ1Nn6Z5vwSc5WVowHQ0KT5fQj6QpRmqypHPVrZjyJiwpGh29tSmpwM6KIVX7gwALP8L8iOtfO75362Xa2csMgNu/2/cui8toeX7TFQMrPOuqpgiYYXUBgPIUqxxL+oeXzwXgt6aArK+AG9fCGHG/qXLJ6BH3L/F+cnXcjcvhw0lYyD31/hiH0daSN5nyuMie5eQ1aPKOQYHZc82Owf/+FzddyOW90O3lQ6KfgsY8sjYyBpAvtD8WxZogHSUWHUWzKkaldW1w/Tyj43nHS22QGEmSOAfssVZVUpS0ZcY7lq7dn3JNQ8ONkqwRgnrMNV7ja5U5h2zcx4hPoH+PhWNPNRFTrJkcuB4an+n5ZQ0wk+/irFNrC/pA3RJYOIOj3cZy5CqBJMVADTx6O7upVM1wE5JBoJiBkshVjGqu78Ldmb9dloJBIOCWfy3p8UdvErYIDOPghTHMxU0MELt/N8LOD9ZZ0N5j0aFFrekL1wYeVXkMAAjGf5/RaPByeAklp1dHC/zRBFxTFneYrimBqIwJ5I4HvgBL1ICrkAl/HzQjbXEChmI+cCmr4rpyCiJISprnrYy/jGRyhbOkK3tNIRni2jzsb4QKPHnjiKs26B7aBlmdn+J04cMLIExMRVJ7hiW9XACKL1 X-Forefront-Antispam-Report: CIP:217.66.60.4;CTRY:DE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SR-MAIL-03.open-synergy.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(396003)(136003)(346002)(39840400004)(376002)(230922051799003)(1800799012)(64100799003)(451199024)(82310400011)(186009)(36840700001)(46966006)(336012)(5660300002)(86362001)(41300700001)(36756003)(36860700001)(47076005)(81166007)(316002)(42186006)(8676002)(54906003)(4326008)(70206006)(83380400001)(44832011)(26005)(1076003)(70586007)(8936002)(2616005)(6916009)(478600001)(2906002)(7416002)(40480700001)(36900700001);DIR:OUT;SFP:1102; X-OriginatorOrg: opensynergy.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Feb 2024 01:05:45.0032 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 06b4cafd-189f-4843-05c1-08dc22c1eb45 X-MS-Exchange-CrossTenant-Id: 800fae25-9b1b-4edc-993d-c939c4e84a64 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=800fae25-9b1b-4edc-993d-c939c4e84a64;Ip=[217.66.60.4];Helo=[SR-MAIL-03.open-synergy.com] X-MS-Exchange-CrossTenant-AuthSource: VI1EUR05FT057.eop-eur05.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: FR6P281MB3654 X-TM-AS-ERS: 104.47.11.169-0.0.0.0 X-TMASE-Version: StarCloud-1.3-9.1.1015-28152.007 X-TMASE-Result: 10--1.472000-4.000000 X-TMASE-MatchedRID: SzbEz7SZt2vJ+P2VFrJmrN/Z7q+hZQVeET56SaIP1M+3UJJ8+n/4RSVv z26lmBXMFRlFiUGUwEmxjL2S8+j0lhfJ8eNjkTqdiu6u4shZ+fGDPlWYpnzHzmshUDcgZ8ILoMQ NBr66IpR/Gj7DAMEZmgMX/QeBIae0ez0KPZoFPyh4ZqfDdG89LitlpTPi5tO8MHiMmW0ZUNss3n AY9fdM9dh5c4TN8zbZ7PVkFWMnCn8N5Rk4kJccyL/a0nd+hIFCI/NGWt0UYPCKAhAjcFxLY7vRD AstQV9xnkz5OiQq1jJyAc4P1/IUE6iCvOFGVAUC X-TMASE-XGENCLOUD: 3bef6c72-1ea3-4c1e-8ab3-531d12416ba7-0-0-200-0 X-TM-Deliver-Signature: 5ABE237ED0DAA6C42DFD5D7901FB2AE6 X-TM-Addin-Auth: huWxA5dvdJK+KqvepDjR7IiEWLwW4lQK9IP9AgwcLnrCsaiYx4kbtEyM7wy i8lvS2sosGbZTMJc8ieC8Uy8FPJq16GO82Rq3GAqNqxQZ0I68KFqRe2OQBp1V6xVWBwukPEM3AV Ef3S5GqZ8EZI17/Wu4yNE2dmvCVLAfLL2OygIrHMcf+rWTKav4AJd12GtX7xM0AM2LQNQ13LVSA ldeqaFiVOhP8fvcRwKtYZDYqP8nji9/RyCu8CfaN2zgZXMPEvNflR+KvybAXGfCzybHLUl5joEr VsOv8qJG/cAFm9CgJLJQF6HzgK14h9fLzh5D.nUEaiXUYV3LXvv8D13L4zaL2ak37HWTRFbaP5H Xon0z/ZVS+oIlGFsTpOAlLXImfzg+mJ10khzOHr8wmR0ro5+1qEtgx5BNTZQ1zLlqRQjX5wu103 bajCMyp2q1oIonqd0T3pvLMDnGmaxHIqyck6MrCePjlTZeOntY4xpSDsu9djzuiA2mOUi5yP45J LawTUxWfPvODDOhlhYxZPwoDwyyDWp3qs+vgsg9kvV988PUkMZLIa7ZXqi42KtIkc1zY2F+yhtt pwu6ItBTzByfSeascdwKcSMrFDexJY2YLiY2ulPlRyzc+3Qp+8CM38xX58P/Pvh7po+zyLSnghF LHXA== X-TM-Addin-ProductCode: EMS DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=opensynergy.com; s=TM-DKIM-20210503141657; t=1706749583; bh=5YtK4a4nifkYy7D9GImx5YWZNY7r7bQKqO6G1y6uwu4=; l=2271; h=From:To:Date; b=V9n3kxsbJbVA2nqHpwcOsdkmRaoBWe18noGWcY36Li4sjYA1hWj2vt4imy7oy2Z3m Zxbufu3tJC5nFbhRtCyVJEkuOb+lFQf1cDY/R1iQXD8PLfcF2FivwJMdtWx5Sx+Snm 7MNLDGhImuhCH24fXpyyFeyBoXtKXG9toTDQgiiMTzQGOxxskgyt2p/j+pZY1t9YHA l/xFvynl8ylj2XIMWMp1SZGlP/Gf64IHJVnOi9x4XL2LT3pgKJ1t+YzmeSqjWEPJJ9 CHAUuY+zv6PpgDpTPC1lTg8LobLpXanwxYC0ADwVTWgU7RT2U1KX70R161d2qiRMTV GRaMfusW7cvcg== X-Patchwork-Delegate: kuba@kernel.org Add a clocksource ID for the x86 kvmclock. Also, for ptp_kvm, set the recently added struct system_counterval_t member cs_id to the clocksource ID (x86 kvmclock or Arm Generic Timer). In the future, get_device_system_crosststamp() will compare the clocksource ID in struct system_counterval_t, rather than the clocksource. For now, to avoid touching too many subsystems at once, extract the clocksource ID from the clocksource. The clocksource dereference will be removed in the following. Signed-off-by: Peter Hilber --- Notes: v3: - Omit redundant clocksource_ids.h include (Andy Shevchenko). v2: - Name clock id according to Thomas Gleixner's mockup. arch/x86/kernel/kvmclock.c | 1 + drivers/ptp/ptp_kvm_common.c | 2 ++ include/linux/clocksource_ids.h | 1 + 3 files changed, 4 insertions(+) diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c index 5bb395551c44..2f1bbf730f45 100644 --- a/arch/x86/kernel/kvmclock.c +++ b/arch/x86/kernel/kvmclock.c @@ -160,6 +160,7 @@ struct clocksource kvm_clock = { .rating = 400, .mask = CLOCKSOURCE_MASK(64), .flags = CLOCK_SOURCE_IS_CONTINUOUS, + .id = CSID_X86_KVM_CLK, .enable = kvm_cs_enable, }; EXPORT_SYMBOL_GPL(kvm_clock); diff --git a/drivers/ptp/ptp_kvm_common.c b/drivers/ptp/ptp_kvm_common.c index 2418977989be..b0b36f135347 100644 --- a/drivers/ptp/ptp_kvm_common.c +++ b/drivers/ptp/ptp_kvm_common.c @@ -4,6 +4,7 @@ * * Copyright (C) 2017 Red Hat Inc. */ +#include #include #include #include @@ -47,6 +48,7 @@ static int ptp_kvm_get_time_fn(ktime_t *device_time, system_counter->cycles = cycle; system_counter->cs = cs; + system_counter->cs_id = cs->id; *device_time = timespec64_to_ktime(tspec); diff --git a/include/linux/clocksource_ids.h b/include/linux/clocksource_ids.h index f8467946e9ee..a4fa3436940c 100644 --- a/include/linux/clocksource_ids.h +++ b/include/linux/clocksource_ids.h @@ -8,6 +8,7 @@ enum clocksource_ids { CSID_ARM_ARCH_COUNTER, CSID_X86_TSC_EARLY, CSID_X86_TSC, + CSID_X86_KVM_CLK, CSID_MAX, }; From patchwork Thu Feb 1 01:04:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Hilber X-Patchwork-Id: 13540529 X-Patchwork-Delegate: kuba@kernel.org Received: from refb01.tmes.trendmicro.eu (refb01.tmes.trendmicro.eu [18.185.115.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2B8B92B9CF for ; Thu, 1 Feb 2024 01:06:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=18.185.115.54 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706749606; cv=fail; b=RerA+v37ClOQzLYktSNyyWulX6MXwgqd03opqaVwpisHdHU7wvqcvG+1GZBLElf6mh91N/UHZSf1SV0b5AI913LrU7m66dOLB3bHOztS6m2sBZmZIIe/AiUxFVNQ11iSmXNFSLGfDMfAbuvnWM/adCMPXmCAJOxWpZ7DmxJmhjM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706749606; c=relaxed/simple; bh=D57pOeABfamN98NGLpRroVr6iGToMt3H85oc0X/wUSE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=rZXbYvJcbJT+9SKGO4EZL1DYhvjncQMrCVjzFeoGMHVyKnC2FQ9o08omBM2bhjzLhh/i/dB7vsbrTsuuGcN48OPYOiyPkiHKddbhN9iHTw1xnxlbSI/RPZp9gNwnhomqto0y8LtoFZBuPwA11ZBRLNMi7ypp7403vesD1BXIQGk= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=opensynergy.com; spf=pass smtp.mailfrom=opensynergy.com; dkim=pass (2048-bit key) header.d=opensynergy.com header.i=@opensynergy.com header.b=AkFHexsJ; arc=fail smtp.client-ip=18.185.115.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=opensynergy.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=opensynergy.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=opensynergy.com header.i=@opensynergy.com header.b="AkFHexsJ" Received: from 104.47.11.169_.trendmicro.com (unknown [172.21.19.72]) by refb01.tmes.trendmicro.eu (Postfix) with ESMTPS id 6DC5210D3A1F7; Thu, 1 Feb 2024 01:06:37 +0000 (UTC) Received: from 104.47.11.169_.trendmicro.com (unknown [172.21.176.220]) by repost01.tmes.trendmicro.eu (Postfix) with SMTP id AE869100004D3; Thu, 1 Feb 2024 01:06:29 +0000 (UTC) X-TM-MAIL-RECEIVED-TIME: 1706749547.736000 X-TM-MAIL-UUID: 5c9397da-eb9e-42f7-9e74-f7ce1151010d Received: from DEU01-FR2-obe.outbound.protection.outlook.com (unknown [104.47.11.169]) by repre01.tmes.trendmicro.eu (Trend Micro Email Security) with ESMTPS id B3E8F10006A5E; Thu, 1 Feb 2024 01:05:47 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CBQb9aXSmWIXZ5e3sAVvBwCaEuWpTiBSxy5zKGOn/TXCGahXbUijIOvoJ6FLkApl4W6WxN4PglFmo5hpdG6cKbAPa1Bs+NgDnP6Gg07GJ3t7o6PMEhLlwYMGVb3FMBQpZqE9zvnOqC1BDPB3F/kNGXCcyhEs4Uy/krRqZbtvMaQDuBiLEXYhL6ZlRk8RYXA3m+a/PSfxt9d2l1jEEhngf7nQc3DSF3hOF1O0ILvfP/lIGo8IOj8EX73a+WqFc8E9TiqclCt1e/9ZNejAaVULIQvme+upk7VxSu5csHljZaklgfpQj48rEX34b2ky6hEQNqt7U+zT35uHF0XVEok34w== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=JhgN1hN5nDXN/Fou+ALZ0OcVA9vQ13ILRQYwQOvZUNw=; b=HB7O83FYqcEKRkcKv520CrrzYKjD5vPAZx4SyZe+RlWTafIhsfjhSkqidNHzfU6kd0bCYV5e3NigoNzfiQDXTMBglrJe9DaR5F1NKB1j0hQ7OH8yNK73hGxmYSBMMxy1W0fTLNEmM+uwW8O1m2Kq73QttWm5DzugYqdv4v82SfaiiW2sOgB09LAZRRpaXLm9p4BUrbzosZe4yfWT+7f2DFF5zIVV/eeBtc+rhdcctEaekJKzXjsUNA3oYTDomQqg0E4An3h/zXCvM6+6lXDun1vmj3V7W8cthW293jkO8h7NJg/WiNTsrzpBQch4XKJnh2CLQem2JTLIlU5ZMkVMZA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 217.66.60.4) smtp.rcpttodomain=alien8.de smtp.mailfrom=opensynergy.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=opensynergy.com; dkim=none (message not signed); arc=none (0) X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 217.66.60.4) smtp.mailfrom=opensynergy.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=opensynergy.com; Received-SPF: Pass (protection.outlook.com: domain of opensynergy.com designates 217.66.60.4 as permitted sender) receiver=protection.outlook.com; client-ip=217.66.60.4; helo=SR-MAIL-03.open-synergy.com; pr=C From: Peter Hilber To: linux-kernel@vger.kernel.org Cc: Peter Hilber , "D, Lakshmi Sowjanya" , Thomas Gleixner , jstultz@google.com, giometti@enneenne.com, corbet@lwn.net, "Dong, Eddie" , "Hall, Christopher S" , Simon Horman , Andy Shevchenko , Marc Zyngier , linux-arm-kernel@lists.infradead.org, Sean Christopherson , Paolo Bonzini , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Wanpeng Li , Vitaly Kuznetsov , Mark Rutland , Daniel Lezcano , Richard Cochran , kvm@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH v3 5/8] ptp/kvm, arm_arch_timer: Set system_counterval_t.cs_id to constant Date: Thu, 1 Feb 2024 02:04:50 +0100 Message-Id: <20240201010453.2212371-6-peter.hilber@opensynergy.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240201010453.2212371-1-peter.hilber@opensynergy.com> References: <20240201010453.2212371-1-peter.hilber@opensynergy.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB8EUR05FT029:EE_|FR2P281MB0107:EE_ X-MS-Office365-Filtering-Correlation-Id: dd7e9af6-3249-4a0e-c64b-08dc22c1ebd6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: j//xz2/FI7LgQ7uhT1Y84nILqDRR6bYPSjAlv+0eWOzFVSi8tDilxUVImkG4ngHcgS/s+DJ7TJzTy8506LUOJWM1btQVxp6UTzSPEUL4U0UUVKiA8jhCBzNwlwqLa0cCJ+3S+yCwdKIRJ3NdOeI2A+Nd+K+loO0tup5dm5NpzRzEtXgf98N3hVPmDDvIZEJkyb4H6qwsdMWb/d5fcVtiBjK4RhIOjV2OW5XkDHZ5+GgdgrBP+lGxu+BQp0klpIDJV+T4xQJwyvwvA5M7bJ20omQY9zKZM7kwIuljfuKhcJOr/HjNjlEcbnV2Yq+kEQGUTrrT68dZexreikRhM7bc9dDl5sLphWvxGcmSRfKEdL7NodVOkzAscDmx53Glje0S4zCnwKnpaDZJTJIErsyj9cxiRSXsPXK08AhvpOvNf054HUQdNxM2ENKvOQqO+fL195s0noEexBmqA3GrLCDbCFX1mUti2RaxXvHA38h5edCDIex7VBbdLWubTNArj3BdTLSq9ODOm+0dAISChUxjmjeWZ30gBu2v/TngOH0LwWKKP1ZDKMSK3wqWWnVCCX8YJRMAaIHQoIu616GP1b48Zt/bgigVqKoHXvUY00WOMBWdbXjnx7p9RFQMIYcX13RJDE94eUJGHdfaKfZhXk7sWi+yy4w4sfhsipXNrOuneVhUOqUClyyyHZk1AreNIP+TptFlfMRWxKfXN9wRkk20M0+HJwyHliRs6mFdTUHPDBC5xd502r1Cg1/LHvRwL+0F X-Forefront-Antispam-Report: CIP:217.66.60.4;CTRY:DE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SR-MAIL-03.open-synergy.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(396003)(376002)(136003)(39840400004)(346002)(230922051799003)(1800799012)(64100799003)(82310400011)(186009)(451199024)(46966006)(36840700001)(40480700001)(83380400001)(41300700001)(86362001)(36756003)(81166007)(36860700001)(47076005)(336012)(2616005)(26005)(1076003)(2906002)(478600001)(6916009)(70586007)(70206006)(316002)(54906003)(42186006)(44832011)(5660300002)(7416002)(8676002)(8936002)(4326008)(36900700001);DIR:OUT;SFP:1102; X-OriginatorOrg: opensynergy.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Feb 2024 01:05:45.9427 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: dd7e9af6-3249-4a0e-c64b-08dc22c1ebd6 X-MS-Exchange-CrossTenant-Id: 800fae25-9b1b-4edc-993d-c939c4e84a64 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=800fae25-9b1b-4edc-993d-c939c4e84a64;Ip=[217.66.60.4];Helo=[SR-MAIL-03.open-synergy.com] X-MS-Exchange-CrossTenant-AuthSource: DB8EUR05FT029.eop-eur05.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: FR2P281MB0107 X-TM-AS-ERS: 104.47.11.169-0.0.0.0 X-TMASE-Version: StarCloud-1.3-9.1.1015-28152.007 X-TMASE-Result: 10-1.458100-4.000000 X-TMASE-MatchedRID: bjwz5Y9VyUDCCiFlDvprp7r2u0KWqQKNSDS3MUO7D/TIRhEhdkLWEovP iBq/iW91MpPx8OFzfY0wNyuTxfRm8ShARHtTtMpxhi2C7dlNKWrn0oaU6WM++5zYnFsPfA8XUMf 79vayL5ANuimYslhyE2tNUNGl1uzREfinJ3N6jMzFTQGAKRxj5No+48giqZwnEgg3cwDHl/0S3W M79W3o4ma3xca03R6M/utaD2GffWo0zI7+eiZZ8F5CD/hq6siqFEqAM28vQO1Q6z0JFJrmFnhEE wH9X4REQE1Xqh2tz4E= X-TMASE-XGENCLOUD: 94638120-ac67-4978-93c3-0cd2902ecd73-0-0-200-0 X-TM-Deliver-Signature: B373ADE2DED4ADB7679BF271BCAA9316 X-TM-Addin-Auth: 8XTTJSTfCuDKwe9AtHmgxezWSnJkKdKsUymwIVnx6WSdfhq4RiAhPIVgF7B HjuXLGJUfaidfVcwF0dz9meo/dg7OzUGLqfndiWAP6lunKNHVjmPkSVhkyvj8iE44qJOVGHMuZG ruTUQm5PM/dJLRv06dV3tnoEODN+V98FUDIC447mOOkIL3ofFGuh9qCO2i6BYK7Yhfu6oBRRVIM Sm2f3jt5i+nZQnH8OrQZiaj+sv5h8WaiLuV1iWvsNZ1yQBuD0sq/dASCpdLZ96dJoHUbovZjGOY DDHzqHVo+/pemfGlvsM46A5Id6L4t/WIozEu.pxOrUYIredW6WK5u3i8RWDdo9ZxGzitekXngfs 5S4rjzOn6m5a/K3VJXYh/5f7gK8kD6Aq5WBbexVChp6M4SjVKyXdH/WpB7upkSSFgY1MydhpzZf GhNqrptC1Z6/5FarD4U1AP6QqP0Ou0vg1loJPZihrFsJYgd5XfkE8rv4bc0ayXWly5vix5c/83h t4spgTpvm8QC/g8jWpS1g51T7x70ROQOLg9qXyG/tWcaInkZb0z8+j+ABbAdbui0lh/QT2h3DFr 0Bk9NplUry5QbI3/nunLmy0R+knYJwwh3s4/l1RPe0uFX04zaubvyfWmKX/b3w1fhYPD6QcHMyP xQ6w== X-TM-Addin-ProductCode: EMS DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=opensynergy.com; s=TM-DKIM-20210503141657; t=1706749589; bh=D57pOeABfamN98NGLpRroVr6iGToMt3H85oc0X/wUSE=; l=4724; h=From:To:Date; b=AkFHexsJyiiioD/6hJQl8fT+d4yVX/CIpU2UIXVNhWItDjjxfsIG/HITheyeh8U+8 psOofcEjsvIC9UnnhLYWuY1ARPzvlhT3wShy3GWUYLbTTUjWaBUOiZtObIPosDv1Xc EJda/tp4lkxTTLdjSD1OEF353i9ZQ71V+RjnIKiqtiz4logvUH1p5WbFBINeTRXl/h ucoFLm6nYrDgQbOcZX9KY/TnW3BOPTepIIFhEmMhfeVPTKVK680zBnVvlwc8cGqZZN Fgjral0NWJHmp29GjNconaUokkSB5f9m38sheEpzvB6mWhKm8B6k4wtC+xazH/yKrL Rxf+80P5uBEpw== X-Patchwork-Delegate: kuba@kernel.org Identify the clocksources used by ptp_kvm by setting clocksource ID enum constants. This avoids dereferencing struct clocksource. Once the system_counterval_t.cs member will be removed, this will also avoid the need to obtain clocksource pointers from kvm_arch_ptp_get_crosststamp(). The clocksource IDs are associated to timestamps requested from the KVM hypervisor, so the proper clocksource ID is known at the ptp_kvm request site. While at it, also rectify the ptp_kvm_get_time_fn() ret type. Signed-off-by: Peter Hilber --- Notes: v2: Added in v2. drivers/clocksource/arm_arch_timer.c | 5 ++++- drivers/ptp/ptp_kvm_arm.c | 2 +- drivers/ptp/ptp_kvm_common.c | 10 +++++----- drivers/ptp/ptp_kvm_x86.c | 4 +++- include/linux/ptp_kvm.h | 4 +++- 5 files changed, 16 insertions(+), 9 deletions(-) diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c index e054de92de91..45a02872669e 100644 --- a/drivers/clocksource/arm_arch_timer.c +++ b/drivers/clocksource/arm_arch_timer.c @@ -1807,7 +1807,8 @@ TIMER_ACPI_DECLARE(arch_timer, ACPI_SIG_GTDT, arch_timer_acpi_init); #endif int kvm_arch_ptp_get_crosststamp(u64 *cycle, struct timespec64 *ts, - struct clocksource **cs) + struct clocksource **cs, + enum clocksource_ids *cs_id) { struct arm_smccc_res hvc_res; u32 ptp_counter; @@ -1833,6 +1834,8 @@ int kvm_arch_ptp_get_crosststamp(u64 *cycle, struct timespec64 *ts, *cycle = (u64)hvc_res.a2 << 32 | hvc_res.a3; if (cs) *cs = &clocksource_counter; + if (cs_id) + *cs_id = CSID_ARM_ARCH_COUNTER; return 0; } diff --git a/drivers/ptp/ptp_kvm_arm.c b/drivers/ptp/ptp_kvm_arm.c index e68e6943167b..017bb5f03b14 100644 --- a/drivers/ptp/ptp_kvm_arm.c +++ b/drivers/ptp/ptp_kvm_arm.c @@ -28,5 +28,5 @@ void kvm_arch_ptp_exit(void) int kvm_arch_ptp_get_clock(struct timespec64 *ts) { - return kvm_arch_ptp_get_crosststamp(NULL, ts, NULL); + return kvm_arch_ptp_get_crosststamp(NULL, ts, NULL, NULL); } diff --git a/drivers/ptp/ptp_kvm_common.c b/drivers/ptp/ptp_kvm_common.c index b0b36f135347..f6683ba0ab3c 100644 --- a/drivers/ptp/ptp_kvm_common.c +++ b/drivers/ptp/ptp_kvm_common.c @@ -4,7 +4,6 @@ * * Copyright (C) 2017 Red Hat Inc. */ -#include #include #include #include @@ -29,15 +28,16 @@ static int ptp_kvm_get_time_fn(ktime_t *device_time, struct system_counterval_t *system_counter, void *ctx) { - long ret; - u64 cycle; + enum clocksource_ids cs_id; struct timespec64 tspec; struct clocksource *cs; + u64 cycle; + int ret; spin_lock(&kvm_ptp_lock); preempt_disable_notrace(); - ret = kvm_arch_ptp_get_crosststamp(&cycle, &tspec, &cs); + ret = kvm_arch_ptp_get_crosststamp(&cycle, &tspec, &cs, &cs_id); if (ret) { spin_unlock(&kvm_ptp_lock); preempt_enable_notrace(); @@ -48,7 +48,7 @@ static int ptp_kvm_get_time_fn(ktime_t *device_time, system_counter->cycles = cycle; system_counter->cs = cs; - system_counter->cs_id = cs->id; + system_counter->cs_id = cs_id; *device_time = timespec64_to_ktime(tspec); diff --git a/drivers/ptp/ptp_kvm_x86.c b/drivers/ptp/ptp_kvm_x86.c index 902844cc1a17..2782442922cb 100644 --- a/drivers/ptp/ptp_kvm_x86.c +++ b/drivers/ptp/ptp_kvm_x86.c @@ -93,7 +93,8 @@ int kvm_arch_ptp_get_clock(struct timespec64 *ts) } int kvm_arch_ptp_get_crosststamp(u64 *cycle, struct timespec64 *tspec, - struct clocksource **cs) + struct clocksource **cs, + enum clocksource_ids *cs_id) { struct pvclock_vcpu_time_info *src; unsigned int version; @@ -124,6 +125,7 @@ int kvm_arch_ptp_get_crosststamp(u64 *cycle, struct timespec64 *tspec, } while (pvclock_read_retry(src, version)); *cs = &kvm_clock; + *cs_id = CSID_X86_KVM_CLK; return 0; } diff --git a/include/linux/ptp_kvm.h b/include/linux/ptp_kvm.h index 746fd67c3480..95b3d4d0d7dd 100644 --- a/include/linux/ptp_kvm.h +++ b/include/linux/ptp_kvm.h @@ -8,6 +8,7 @@ #ifndef _PTP_KVM_H_ #define _PTP_KVM_H_ +#include #include struct timespec64; @@ -17,6 +18,7 @@ int kvm_arch_ptp_init(void); void kvm_arch_ptp_exit(void); int kvm_arch_ptp_get_clock(struct timespec64 *ts); int kvm_arch_ptp_get_crosststamp(u64 *cycle, - struct timespec64 *tspec, struct clocksource **cs); + struct timespec64 *tspec, struct clocksource **cs, + enum clocksource_ids *cs_id); #endif /* _PTP_KVM_H_ */ From patchwork Thu Feb 1 01:04:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Hilber X-Patchwork-Id: 13540525 Received: from refb01.tmes.trendmicro.eu (refb01.tmes.trendmicro.eu [18.185.115.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 36A433FE1 for ; Thu, 1 Feb 2024 01:06:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=18.185.115.53 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706749595; cv=fail; b=fH0rvjO2We17Ab7LPmFW89BejX0ccRyvA0v30wXgHzwSryUem+RXU2ybWICxPTFUyu52gf4H08LApUTzk2j888AzPq6yvZxBsipW2GJ39U92+N1kxBaGCgigfc4yWtCrYNK1ojP4G7Pl7VW1AkR7aXx7DZm30uwKAJoD7EeTA5A= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706749595; c=relaxed/simple; bh=GD3Um5Fk9KYt8CWRDZT+Iu5Qq0xNhOzbOrimElkMX08=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=SW/qMksPgLiC/9WLDEQTxCrmq0etPOS5Lrf8eitlj/PFtzy9MYlEwL2gX07EsD2cFWcVryJHjihhanFte7DJotAc+9MUmmpp8tAknGWB/WzyUNSPJinhoqfAjH5E0TdB4LgQs1yRG+zK7u96zN2z1Wa3GezhL1UAexOjCqkgH/E= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=opensynergy.com; spf=pass smtp.mailfrom=opensynergy.com; dkim=pass (2048-bit key) header.d=opensynergy.com header.i=@opensynergy.com header.b=Rd+6oYlw; arc=fail smtp.client-ip=18.185.115.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=opensynergy.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=opensynergy.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=opensynergy.com header.i=@opensynergy.com header.b="Rd+6oYlw" Received: from 104.47.7.169_.trendmicro.com (unknown [172.21.9.37]) by refb01.tmes.trendmicro.eu (Postfix) with ESMTPS id 4E98310D399D0 for ; Thu, 1 Feb 2024 01:06:25 +0000 (UTC) Received: from 104.47.7.169_.trendmicro.com (unknown [172.21.176.220]) by repost01.tmes.trendmicro.eu (Postfix) with SMTP id 9666E10000E36; Thu, 1 Feb 2024 01:06:17 +0000 (UTC) X-TM-MAIL-RECEIVED-TIME: 1706749549.127000 X-TM-MAIL-UUID: 709e3cc4-757f-4404-9af5-e56d9b0a6509 Received: from DEU01-BE0-obe.outbound.protection.outlook.com (unknown [104.47.7.169]) by repre01.tmes.trendmicro.eu (Trend Micro Email Security) with ESMTPS id 1F23C10000E27; Thu, 1 Feb 2024 01:05:49 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Zknp6agk+5MT2WVkC1kU8vBXclZZnhsjEAdXme5JAuPR+tkvaWwisgw8R1Iv3liuFMbCTaNqtqAz5HTs+S9/XC0oMgzzBHIJVpkP1G12UR2E395ArK4lIm5RKb9Ws7MjLUy7eT8IdfcA99t1SubH8sLpd46X8vrUvaJBmY+oA6SdWym+9UeH4ak3L4agMVTD6kcORjA3Jox+E9o2g53SJ9HTFWr7JRy+Cy/9R1HBsiWprVoAndEynM9P5DrcKiK6kvNpGPIPaoiNQ8ITwuIh+KN7hesKr+eqm166rNdBLOQRI/kQpBocq/lp7J3gOYUefkFxligxX8JNoofDdX70Ag== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=19V5f5v4K31vf5r1k2uGbWqScSaz2MU+qssn/Nacn4w=; b=b9yZ6yK75RQUi/YqMqz9i4Aee9bK5CqkjYQq5kylpZGU+Fo9Sk7sqEiglON3vlN0Nu1s4nMC0ynQO1+Tqy2hORkgVlthzdexTWNLXZI5t4A/Fgk/hFgyca/VbWY2mEnbICFPKJ+ZEmUppl0FYp+UORJ94F6LkPeQeDL7hlbo2P7L1h6exfoM8nd2scqEVU5FQd8KkaiEz/VKYxat6WiikbEp36nNxkyp55zIRrCLSa21sxSyNVxfrEaUUv7HiMJIhU9DtkOE/gpZkgdMgwiNMtia+nv0ym8IjvcqdJys1vvVttdrjx7aH/2rLpNy6wBAsnMqd1PDBP40VRfXjgr7Yg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 217.66.60.4) smtp.rcpttodomain=alien8.de smtp.mailfrom=opensynergy.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=opensynergy.com; dkim=none (message not signed); arc=none (0) X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 217.66.60.4) smtp.mailfrom=opensynergy.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=opensynergy.com; Received-SPF: Pass (protection.outlook.com: domain of opensynergy.com designates 217.66.60.4 as permitted sender) receiver=protection.outlook.com; client-ip=217.66.60.4; helo=SR-MAIL-03.open-synergy.com; pr=C From: Peter Hilber To: linux-kernel@vger.kernel.org Cc: Peter Hilber , "D, Lakshmi Sowjanya" , Thomas Gleixner , jstultz@google.com, giometti@enneenne.com, corbet@lwn.net, "Dong, Eddie" , "Hall, Christopher S" , Simon Horman , Andy Shevchenko , Marc Zyngier , linux-arm-kernel@lists.infradead.org, Sean Christopherson , Paolo Bonzini , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Wanpeng Li , Vitaly Kuznetsov , Mark Rutland , Daniel Lezcano , Richard Cochran , kvm@vger.kernel.org, netdev@vger.kernel.org, Stephen Boyd Subject: [PATCH v3 6/8] timekeeping: Evaluate system_counterval_t.cs_id instead of .cs Date: Thu, 1 Feb 2024 02:04:51 +0100 Message-Id: <20240201010453.2212371-7-peter.hilber@opensynergy.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240201010453.2212371-1-peter.hilber@opensynergy.com> References: <20240201010453.2212371-1-peter.hilber@opensynergy.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB8EUR05FT053:EE_|BEVP281MB3522:EE_ X-MS-Office365-Filtering-Correlation-Id: 68e8df3a-ccf8-4dc0-f8de-08dc22c1ec77 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SMPn4YTEVAuru0q6PEGjScR9cb4/cXYPn25yAmfn1n2RnNTtLvMDwXPiToRJ82YnOhnlYYm1DlLzCMZuXSsOBzxh1i0zrW3CvHARxfYejvUkMZ56alcVtS8Aj1Iuj+zpXG7uHRYi/u9cnRIndVovAO1KWo2yu53PAAJ024q6dZAwyt1rXdi35nkx+A9lyIHeAlU7WZmAdZXTBacP1PbcXG/1Zm8yUuwc00KsDSE/aiWzZHHNq86Oy2Kewph4zn3taHLDx+Ws00PDXEvPWMMwnCKqY3oz8VEmXgpy9rnbMVyEO6lvDcXYo5cLus+RhYTH3fce2aIUeK98aqhsWe/D0UvsBt1toW7zFgb4EjFicwwXtJDeiw9B5MTuOYajxbMDg09N+IxZGP0hYll4GzBuHHPmpEv3MEI15nBds1b8BOSRyryo29kHm2Kjyy4TSZemQilz+04L75tdjyR2gWpNB6X55BTsd/4zSBGAy2TA9wo9pKeti25RV81KF5WNWLMTGcCzzph5/UUnbrqAcAsVLJIS7UhoD0Q8qJ2OBN+8FB0juwuF/IgOE/Ix2Me7Il1uSmxlu4yzk7y+eApzyDpFXRTBuyz5piMgCc6/xbgZee7Gg8N9YpoQDT4wxswW/11iDf00pjqHaevZ97B1q+MUIxuq2uH2UixjTnS5lN7q8Z/41yBzLvRveplJgs4GB4rWQAFg6v0u6kDXC8pHCtKhuea5bxW8oXAqtwnKrHsMtVHDxZAcYJ+DKw58gtRw4Xgj X-Forefront-Antispam-Report: CIP:217.66.60.4;CTRY:DE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SR-MAIL-03.open-synergy.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(136003)(39840400004)(346002)(376002)(396003)(230922051799003)(451199024)(1800799012)(82310400011)(186009)(64100799003)(36840700001)(46966006)(41300700001)(83380400001)(47076005)(1076003)(2616005)(336012)(26005)(81166007)(36860700001)(4326008)(44832011)(8676002)(8936002)(5660300002)(7416002)(2906002)(478600001)(966005)(42186006)(54906003)(70586007)(70206006)(6916009)(316002)(86362001)(36756003)(40480700001)(142923001)(36900700001);DIR:OUT;SFP:1102; X-OriginatorOrg: opensynergy.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Feb 2024 01:05:46.9992 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 68e8df3a-ccf8-4dc0-f8de-08dc22c1ec77 X-MS-Exchange-CrossTenant-Id: 800fae25-9b1b-4edc-993d-c939c4e84a64 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=800fae25-9b1b-4edc-993d-c939c4e84a64;Ip=[217.66.60.4];Helo=[SR-MAIL-03.open-synergy.com] X-MS-Exchange-CrossTenant-AuthSource: DB8EUR05FT053.eop-eur05.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BEVP281MB3522 X-TM-AS-ERS: 104.47.7.169-0.0.0.0 X-TMASE-Version: StarCloud-1.3-9.1.1015-28152.007 X-TMASE-Result: 10--4.043200-4.000000 X-TMASE-MatchedRID: xPvPRJicGCRt/9ulvM0QMd/Z7q+hZQVe6wJlKkXfZVkJ5yiKyAQmigHW HoYGrPh+C2QDPheido9iBl6ePEpdZVlsdSBrk49aju2XlcEx9HRelLFkoMPMWOI/qZVAgf06Vif 9o7rSV9vm9Tc/GgfFJwFtWueZlMH0t5KZ74QYwoxVSWOKG8Va/NVTzaAe7ACyygHdGJDPWm8TJ/ T+Ssc4ZVqoLahcwH4L6xA0Ava73nAPm15xyht8lXx2eIlQG1sMfC4IwOLvyucC4DhlAS07elo7G mCOJYd1+Tf0tcxKuLqp1o3scZXZMKi/idDT83QQLnekw6JLry5x/K7fMpYywQ== X-TMASE-XGENCLOUD: bd19414a-342d-4838-91df-7f66a485cb9a-0-0-200-0 X-TM-Deliver-Signature: 2BA278FB04BECBAC442E7F811F5E5EF9 X-TM-Addin-Auth: KNGNGy7t/AMGYYoPNJK33ihSH7nZOlcO1ENE9vIJullXy940AcoaOTWa2EH CaJ6tWJPN/O3nktQf4U8z82TJnXEPnNin+3JoCVAHtJJS52G5DRKQm5kOdWRlMM5E+RLfJXjcMs PSSGY8C6UENKzGxp/+F69UGZoV1GwNw3+rxSV9eQ5WwxvJLauAlgDfZYcRwtUivqlPJf3SLVzQ9 GnFCoAa692daYx/wOu86WSacyFs8K5UWgW07fnOgzh9mt8wMHLfWeVzUkBLPZuHZoR22RZps4xR T2JwLeXP3oHXap5LIrWC5xK3X/e4m8oenkz4.dzBdD0ueEzIDCZ2p1juT/CU3dycpZ3O8MSXgnj e/cu5MlnrLULYa7fhzKgDw2NBlrFuvRXSE7OPgyhF6XTPbcNlYa+H30FOzK0YJBymT9ZuQ7LVaw rOMdn/QKgcJgIjXx1AjjZGjsalneCBHi7+U73LyV2AE/ouKwcMBBhJeCmPE4z17kxgOKmr4DBWZ GL0HmtJXfBLWR304+8BqiXl/BMdGsmFx167jGXMXOJl6le/59k6hnjC5xMiI7JeK8vlTi+4y64L MlwAIzSmOh3HxyBr2mWFIQ8XT48PUxwz0S3CQzZ4zzQQ/GDfkN6LQ9qSD3PChPWr9rVU2Dd4qb4 3yWg== X-TM-Addin-ProductCode: EMS DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=opensynergy.com; s=TM-DKIM-20210503141657; t=1706749577; bh=GD3Um5Fk9KYt8CWRDZT+Iu5Qq0xNhOzbOrimElkMX08=; l=3419; h=From:To:Date; b=Rd+6oYlw0e5i5m/oaOaELqxRPwIeG1mlIQovq3Yvw72ixqAZDaxVS9qRblcqx1kdv XkCyQ5QbF3iMch+YLL2ARfcEB9RTh4IXINOZDGOKAxRIsBP94wTNfGKZt7f9X2x3tq JXH/pICCc7AfoXB/vAaG1V9gf5r64hmQ5oGwNLtRgeosCAXiBRb4BbqggKzBtPzB8e wBw37E42Uce7SUy+17En+9gBVtHgogYStStsLKosCVDryexFvyqfrjgM20s/f2S8Rr ZiTTg7HKGDtAI1PoIuLKbGVJLZ/e/bNkh9PZaRW1AHX8/JxtcFsDFUJ4wWuyOGLbQ9 +3BagxUPjpgCA== Clocksource pointers can be problematic to obtain for drivers which are not clocksource drivers themselves. In particular, the RFC virtio_rtc driver [1] would require a new helper function to obtain a pointer to the Arm Generic Timer clocksource. The ptp_kvm driver also required a similar workaround. Address this by evaluating the clocksource ID, rather than the clocksource pointer, of struct system_counterval_t. By this, setting the clocksource pointer becomes unneeded, and it will be dropped from struct system_counterval_t in the future. By this, get_device_system_crosststamp() callers (such as virtio_rtc and ptp_kvm) will no longer need to supply clocksource pointers. This change should not alter any behavior, as the struct system_counterval_t clocksource ID is already being set wherever the clocksource pointer is set. get_device_system_crosststamp() will now fail if the clocksource has ID CSID_GENERIC, but all currently relevant clocksources have a custom clocksource ID. [1] https://lore.kernel.org/lkml/20231218073849.35294-1-peter.hilber@opensynergy.com/ Signed-off-by: Peter Hilber --- Notes: v2: - Refer to clocksource IDs as such in comments (Thomas Gleixner). - Update comments which were still referring to clocksource pointers. include/linux/timekeeping.h | 10 +++++----- kernel/time/timekeeping.c | 9 +++++---- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h index ca234fa4cc04..3538c5bdf9ee 100644 --- a/include/linux/timekeeping.h +++ b/include/linux/timekeeping.h @@ -268,13 +268,13 @@ struct system_device_crosststamp { }; /** - * struct system_counterval_t - system counter value with the pointer to the + * struct system_counterval_t - system counter value with the ID of the * corresponding clocksource * @cycles: System counter value - * @cs: Clocksource corresponding to system counter value. Used by - * timekeeping code to verify comparibility of two cycle values - * @cs_id: Clocksource ID corresponding to system counter value. To be - * used instead of cs in the future. + * @cs: Clocksource corresponding to system counter value. Timekeeping + * code now evaluates cs_id instead. + * @cs_id: Clocksource ID corresponding to system counter value. Used by + * timekeeping code to verify comparability of two cycle values. * The default ID, CSID_GENERIC, does not identify a specific * clocksource. */ diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index 266d02809dbb..0ff065c5d25b 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -1232,11 +1232,12 @@ int get_device_system_crosststamp(int (*get_time_fn) return ret; /* - * Verify that the clocksource associated with the captured - * system counter value is the same as the currently installed - * timekeeper clocksource + * Verify that the clocksource ID associated with the captured + * system counter value is the same as for the currently + * installed timekeeper clocksource */ - if (tk->tkr_mono.clock != system_counterval.cs) + if (system_counterval.cs_id == CSID_GENERIC || + tk->tkr_mono.clock->id != system_counterval.cs_id) return -ENODEV; cycles = system_counterval.cycles; From patchwork Thu Feb 1 01:04:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Hilber X-Patchwork-Id: 13540527 X-Patchwork-Delegate: kuba@kernel.org Received: from refb02.tmes.trendmicro.eu (refb02.tmes.trendmicro.eu [18.185.115.60]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B1BA84403 for ; Thu, 1 Feb 2024 01:06:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=18.185.115.60 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706749595; cv=fail; b=NVb2kuEio97FJN0Z6bm9U1k920X8PnOznGjzHMXBmptniOPuB150Eje5UGGeXcD/eLbUw+kFFzgTtSbq2xfq1cblPa2hi3ydQKv8WE4GV9miV/0E4+ONYkAv3M5gAu/KlvA/f8rcqWUMafzow6XBq3g3CyP5AYISq8Yr9+Mukno= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706749595; c=relaxed/simple; bh=j3ZK0LDs+hrr9tdazQ5dmRy2Y1/jm40trOZjBU8ltrU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=IFpCFXacssfPoJkPBWe20R73qj3TUvPxS4HSmR4kOnhxma73ukN765cUR7v5nWMGTw9aMs6xJj4eDDLwPohYPjkPe1WiILelcx8bvmUH7TLqVB6/y3FiDrwYn1I+ZC44R1AGtypT4+9eI57rL1gfq/xc6yJ/Qv4j3GQF1Iybd4E= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=opensynergy.com; spf=pass smtp.mailfrom=opensynergy.com; dkim=pass (2048-bit key) header.d=opensynergy.com header.i=@opensynergy.com header.b=XWj5mJP3; arc=fail smtp.client-ip=18.185.115.60 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=opensynergy.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=opensynergy.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=opensynergy.com header.i=@opensynergy.com header.b="XWj5mJP3" Received: from 104.47.7.168_.trendmicro.com (unknown [172.21.19.113]) by refb02.tmes.trendmicro.eu (Postfix) with ESMTPS id 53EDF10A7E627 for ; Thu, 1 Feb 2024 01:06:32 +0000 (UTC) Received: from 104.47.7.168_.trendmicro.com (unknown [172.21.176.220]) by repost01.tmes.trendmicro.eu (Postfix) with SMTP id 8AFDB100004D0; Thu, 1 Feb 2024 01:06:25 +0000 (UTC) X-TM-MAIL-RECEIVED-TIME: 1706749549.349000 X-TM-MAIL-UUID: 57a7349a-401c-46dd-a091-502461c475aa Received: from DEU01-BE0-obe.outbound.protection.outlook.com (unknown [104.47.7.168]) by repre01.tmes.trendmicro.eu (Trend Micro Email Security) with ESMTPS id 5580710006A5E; Thu, 1 Feb 2024 01:05:49 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GKhyu1JIeZwB9nOdO9yB4NN5zgsl1eKp2kxic9vkp1DOl3zR2PLwPFLOeLTDfdN24qjaorlw0uvUj+lJhmGrm8C9Wpj1jp9qgOIBH0X+QiOIvImLOgvZgry00ly7RS389iUSXp4o5//uY1LW8xRogIyUgQCGR5vaXsS6q6lBz3SPgQhjfwf/ojUa+VWVGK7VS/i0OrcJ4sFFh2qd90DN7K5gl/77hRVkmv4BA/CEVAIAQng2r+2WAqPFj3VJIn8ak7MxLb1ASixnIeA4aNY9zJCcctZ8BvOCsMR6lt+/VdyuBoR6YzWQTWKfNn36PQfFGGECY6qtZLVO3n1SXIZPfQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=LsyIsJZULVmOyBWJOur/9/jVP+yb1X6rnbgwdmk3TFE=; b=KRGUgomn33oerqrVwRfUHTGUzle56lVaaDZfDYUTwY2sgPMzqXO6/KA/Njz7GFyrgOSA1yvC5B/rGA2Fhaa6n7kxpvZCC0FFVqvvotQFE0rLLmAYIw7Uo9ZtTSSLM6G8gLR+l3NcXcRWfXVircIF/tERHyjdzAjqPTh51nnqxmZnEqqCycGEqK66+iiXRRVOQ7Hxr5/wBRny8glvjlyZUE/sOateCWr5HsTBXn2xkucUom7Wi4iqTu+NaygyGz2+4MdvZxJOHYZQdgoPv3SCrgqEw3XZFxb5pT5WK8VWwWxcJQvOphJEXe8nLDqqBCl8NuNxCKVcH6I+/4L/MmCZzw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 217.66.60.4) smtp.rcpttodomain=alien8.de smtp.mailfrom=opensynergy.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=opensynergy.com; dkim=none (message not signed); arc=none (0) X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 217.66.60.4) smtp.mailfrom=opensynergy.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=opensynergy.com; Received-SPF: Pass (protection.outlook.com: domain of opensynergy.com designates 217.66.60.4 as permitted sender) receiver=protection.outlook.com; client-ip=217.66.60.4; helo=SR-MAIL-03.open-synergy.com; pr=C From: Peter Hilber To: linux-kernel@vger.kernel.org Cc: Peter Hilber , "D, Lakshmi Sowjanya" , Thomas Gleixner , jstultz@google.com, giometti@enneenne.com, corbet@lwn.net, "Dong, Eddie" , "Hall, Christopher S" , Simon Horman , Andy Shevchenko , Marc Zyngier , linux-arm-kernel@lists.infradead.org, Sean Christopherson , Paolo Bonzini , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Wanpeng Li , Vitaly Kuznetsov , Mark Rutland , Daniel Lezcano , Richard Cochran , kvm@vger.kernel.org, netdev@vger.kernel.org, Stephen Boyd Subject: [PATCH v3 7/8] treewide: Remove system_counterval_t.cs, which is never read Date: Thu, 1 Feb 2024 02:04:52 +0100 Message-Id: <20240201010453.2212371-8-peter.hilber@opensynergy.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240201010453.2212371-1-peter.hilber@opensynergy.com> References: <20240201010453.2212371-1-peter.hilber@opensynergy.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1EUR05FT008:EE_|FRYP281MB0272:EE_ X-MS-Office365-Filtering-Correlation-Id: 81d7bb6c-a1ec-4d74-9208-08dc22c1ecfe X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: s5p/bEfW1RcHnaUVG/vPSD45EAcSRtlIOej782H1Qr4bexPXN78iDHu2/3sLAOKBHi119bqIVep+/rMO5VyE8j2xgSiuVZBPhiHrLO+ahZ6FV47rCbjbi0hMdnXX4e80HKVeeMspKZ5zgByY9ll03N2BshqGdXtoDXfc7N/hAprTJAMacD3NluZJfLFl/FuujB6B/HXNcpsWMSajjDsQ1+tcC4V2yFTqandyCqeVJ2cyKlUvmRSPKdk9EhUswVRVtpJR+stEiAaRbrFnjrf2mVT5tFIEk+hH4Az6zG1T7SNK/2zBIldYuZTvfqoniTt4uKmhS+1Xi7f0uLgzKK2znsUgbpgE+wZ+yMFhjuvnXUPwucyF8L1UInGpTYeAyeBYlUD6fMD2z+wJd23N6auQyJ2zyjM44R9VJVa0Bt6n8mEpjEztB545+vZVqJ+Y2iLJr5a85PGyxmWmOd5InNlMJ/h/Ayfp6dPHaLwb5ICeWepqgo3kAESx08OQKPB5CeUlSvGpNCK1YeAWgNOLbVn9Fp111sFCrR4UpwuYTfWvcU36exn9QG2j96UhZjP9w8UV3VLb+dalqliYE0dif9uv/RZ0MA2XX20IyhqTfs0FieJUuUc0RnnwKqJ7+8Oq2pEMZKxkYybBxTrL1los1W/z3MoWLeTyeXlR9D/a9hccfZvsP/lJYYhwPwdJeCwW6xV97upuTGDxwYxyNKWRP7c7KVyUYrnxXQ+WbmhXX8CE7jhTLzYLIqzZTsJyALjjUtr2 X-Forefront-Antispam-Report: CIP:217.66.60.4;CTRY:DE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SR-MAIL-03.open-synergy.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(39840400004)(346002)(376002)(136003)(396003)(230922051799003)(1800799012)(82310400011)(186009)(451199024)(64100799003)(36840700001)(46966006)(316002)(47076005)(70206006)(70586007)(42186006)(6916009)(54906003)(36756003)(7416002)(36860700001)(8936002)(4326008)(44832011)(8676002)(86362001)(5660300002)(41300700001)(81166007)(2616005)(40480700001)(336012)(1076003)(478600001)(26005)(2906002)(83380400001)(36900700001);DIR:OUT;SFP:1102; X-OriginatorOrg: opensynergy.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Feb 2024 01:05:47.8969 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 81d7bb6c-a1ec-4d74-9208-08dc22c1ecfe X-MS-Exchange-CrossTenant-Id: 800fae25-9b1b-4edc-993d-c939c4e84a64 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=800fae25-9b1b-4edc-993d-c939c4e84a64;Ip=[217.66.60.4];Helo=[SR-MAIL-03.open-synergy.com] X-MS-Exchange-CrossTenant-AuthSource: VI1EUR05FT008.eop-eur05.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: FRYP281MB0272 X-TM-AS-ERS: 104.47.7.168-0.0.0.0 X-TMASE-Version: StarCloud-1.3-9.1.1015-28152.007 X-TMASE-Result: 10-0.836900-4.000000 X-TMASE-MatchedRID: 2GwetqJOyZxrxBLbo6y0d4ruruLIWfnxgz5VmKZ8x85rIVA3IGfCC6DE DQa+uiKUfxo+wwDBGZpKfWS2EzGP5o/GIRjw2D78dArStA4IAF4SRRLwSueD2tEOKD7Vsunkj6Q WX061FFJ3hNro2zkthd9gyvNyzxXy0bKbAkjZTQt4lyF1lyvUrTUfXwpl5znYB/H9q/pEjfECt0 I5Tjuo2dlhzrOwI51bKRbMLPl3awjb3dppi+rLrXzV+KRRiDItcnxszfxH2Ckmx8kl1Wnd+q+eC SMeOiOkfZ9uentPYeaJcb4M4L3rfi1QF7giu85XOwBXM346/+wUiV4IE4MuxRTbXVdulhu/g7hE xeK2mZMPR11w2j/xz8m6mrJkmFv1 X-TMASE-XGENCLOUD: 5c2e2e76-2709-4d52-874d-66c1ac854c9f-0-0-200-0 X-TM-Deliver-Signature: AA2270AE4D693477B76D0B655674B1B2 X-TM-Addin-Auth: 0Q/emdNT/sNhsg4VmkEqA2bu2nwRc6yHrwfyDG7IMJ+dbBHMyMPaixZ8R0s 1wC8mhCCB/0wymKGMmNx4IT3OCTtdT7hnm6lTJv7lcK9G9hJ5spUPD3r10QrlYYdgFEYN6EvIjx Lr+Tsxz4GRDIGFCvs9woZNEVmzBWfZc5RBSd8ThjUYM/W8iFS6enWL0K62k+3l5GYHkccduG6/d //yHM5obD7hm34tudjbXV8RTxcodJRXRE2Bb13sHMl4Z7nWvgH01QT3Kt9/IOGJQyB8pxeCgepL ljKkzZfq83uwBuCFyA5Imyvj1VmqfVYh3n02.JPyoV/T2r1tAEv1U2pH2m/h5Kz2zbcSCHDbYHT XxvHJK7bu8RSaskkqGRoRWblNYdOGwapk478mbCBWwHFs+qRIkG9JO5xEPCTG+lqkIlB9BuOMd9 X1mVvf/iDTJASysGBQbHn9jd+SwCdNSgg+nuGvDBrTAlH9n7vrpbDalc/HMxm3sJUcfFVXnCShI 0MITdgDSFqtUdrGpefVMRv+b97DTpRxpITAw6fFbR+knLuvFp1s12x5aSjlhs9ORt80AyrJck+b G4gs2L4Yt7Tqc3szU3dC4/sLGqJCZvwJGLvihk52vxB2MnyhBxZ109ISF5BLO4N0UyQOzHa6Ln8 BS6w== X-TM-Addin-ProductCode: EMS DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=opensynergy.com; s=TM-DKIM-20210503141657; t=1706749585; bh=j3ZK0LDs+hrr9tdazQ5dmRy2Y1/jm40trOZjBU8ltrU=; l=6724; h=From:To:Date; b=XWj5mJP31O4E221jcObYKFA0r/yq0fZlOLcoTqw2C0JCSLwZJy7RN+GMHteSyjY86 skqvyIe0/+D1muE+/Z0lOqRrxzWOM3xPs2/PZEmLoYqE06uO+lyP0VIayPFJq28/2M zxpXlUOjkjJYCa0V/d3NBBfgTIOGbdURsQTaBMCfRlX2bx9J/7FNrsQOTM2TD4TvLM OOKPZk6Ofi5cm6Ny3tTVofh3bB//FGmLuYKQ+ZRFL8Qafbw1xEBh2L9MvCjpfabOuo EBrovfjDD9vNPsg3xG8/VCGGji6LIuM0JnuzE99bRNJHfUfbfTdG0WJRBhahR8ADxp CHnoSMuKwURTw== X-Patchwork-Delegate: kuba@kernel.org The clocksource pointer in struct system_counterval_t is not evaluated any more. Remove the code setting the member, and the member itself. Signed-off-by: Peter Hilber --- arch/x86/kernel/tsc.c | 11 ++--------- drivers/clocksource/arm_arch_timer.c | 3 --- drivers/ptp/ptp_kvm_arm.c | 2 +- drivers/ptp/ptp_kvm_common.c | 4 +--- drivers/ptp/ptp_kvm_x86.c | 2 -- include/linux/ptp_kvm.h | 4 +--- include/linux/timekeeping.h | 3 --- 7 files changed, 5 insertions(+), 24 deletions(-) diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c index 9f164aad5e94..693148adca22 100644 --- a/arch/x86/kernel/tsc.c +++ b/arch/x86/kernel/tsc.c @@ -53,7 +53,6 @@ static int __read_mostly tsc_force_recalibrate; static u32 art_to_tsc_numerator; static u32 art_to_tsc_denominator; static u64 art_to_tsc_offset; -static struct clocksource *art_related_clocksource; static bool have_art; struct cyc2ns { @@ -1313,7 +1312,6 @@ struct system_counterval_t convert_art_to_tsc(u64 art) res += tmp + art_to_tsc_offset; return (struct system_counterval_t) { - .cs = art_related_clocksource, .cs_id = have_art ? CSID_X86_TSC : CSID_GENERIC, .cycles = res }; @@ -1350,7 +1348,6 @@ struct system_counterval_t convert_art_ns_to_tsc(u64 art_ns) res += tmp; return (struct system_counterval_t) { - .cs = art_related_clocksource, .cs_id = have_art ? CSID_X86_TSC : CSID_GENERIC, .cycles = res }; @@ -1459,10 +1456,8 @@ static void tsc_refine_calibration_work(struct work_struct *work) if (tsc_unstable) goto unreg; - if (boot_cpu_has(X86_FEATURE_ART)) { - art_related_clocksource = &clocksource_tsc; + if (boot_cpu_has(X86_FEATURE_ART)) have_art = true; - } clocksource_register_khz(&clocksource_tsc, tsc_khz); unreg: clocksource_unregister(&clocksource_tsc_early); @@ -1487,10 +1482,8 @@ static int __init init_tsc_clocksource(void) * the refined calibration and directly register it as a clocksource. */ if (boot_cpu_has(X86_FEATURE_TSC_KNOWN_FREQ)) { - if (boot_cpu_has(X86_FEATURE_ART)) { - art_related_clocksource = &clocksource_tsc; + if (boot_cpu_has(X86_FEATURE_ART)) have_art = true; - } clocksource_register_khz(&clocksource_tsc, tsc_khz); clocksource_unregister(&clocksource_tsc_early); diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c index 45a02872669e..8d4a52056684 100644 --- a/drivers/clocksource/arm_arch_timer.c +++ b/drivers/clocksource/arm_arch_timer.c @@ -1807,7 +1807,6 @@ TIMER_ACPI_DECLARE(arch_timer, ACPI_SIG_GTDT, arch_timer_acpi_init); #endif int kvm_arch_ptp_get_crosststamp(u64 *cycle, struct timespec64 *ts, - struct clocksource **cs, enum clocksource_ids *cs_id) { struct arm_smccc_res hvc_res; @@ -1832,8 +1831,6 @@ int kvm_arch_ptp_get_crosststamp(u64 *cycle, struct timespec64 *ts, *ts = ktime_to_timespec64(ktime); if (cycle) *cycle = (u64)hvc_res.a2 << 32 | hvc_res.a3; - if (cs) - *cs = &clocksource_counter; if (cs_id) *cs_id = CSID_ARM_ARCH_COUNTER; diff --git a/drivers/ptp/ptp_kvm_arm.c b/drivers/ptp/ptp_kvm_arm.c index 017bb5f03b14..e68e6943167b 100644 --- a/drivers/ptp/ptp_kvm_arm.c +++ b/drivers/ptp/ptp_kvm_arm.c @@ -28,5 +28,5 @@ void kvm_arch_ptp_exit(void) int kvm_arch_ptp_get_clock(struct timespec64 *ts) { - return kvm_arch_ptp_get_crosststamp(NULL, ts, NULL, NULL); + return kvm_arch_ptp_get_crosststamp(NULL, ts, NULL); } diff --git a/drivers/ptp/ptp_kvm_common.c b/drivers/ptp/ptp_kvm_common.c index f6683ba0ab3c..15ccb7dd2ed0 100644 --- a/drivers/ptp/ptp_kvm_common.c +++ b/drivers/ptp/ptp_kvm_common.c @@ -30,14 +30,13 @@ static int ptp_kvm_get_time_fn(ktime_t *device_time, { enum clocksource_ids cs_id; struct timespec64 tspec; - struct clocksource *cs; u64 cycle; int ret; spin_lock(&kvm_ptp_lock); preempt_disable_notrace(); - ret = kvm_arch_ptp_get_crosststamp(&cycle, &tspec, &cs, &cs_id); + ret = kvm_arch_ptp_get_crosststamp(&cycle, &tspec, &cs_id); if (ret) { spin_unlock(&kvm_ptp_lock); preempt_enable_notrace(); @@ -47,7 +46,6 @@ static int ptp_kvm_get_time_fn(ktime_t *device_time, preempt_enable_notrace(); system_counter->cycles = cycle; - system_counter->cs = cs; system_counter->cs_id = cs_id; *device_time = timespec64_to_ktime(tspec); diff --git a/drivers/ptp/ptp_kvm_x86.c b/drivers/ptp/ptp_kvm_x86.c index 2782442922cb..617c8d6706d3 100644 --- a/drivers/ptp/ptp_kvm_x86.c +++ b/drivers/ptp/ptp_kvm_x86.c @@ -93,7 +93,6 @@ int kvm_arch_ptp_get_clock(struct timespec64 *ts) } int kvm_arch_ptp_get_crosststamp(u64 *cycle, struct timespec64 *tspec, - struct clocksource **cs, enum clocksource_ids *cs_id) { struct pvclock_vcpu_time_info *src; @@ -124,7 +123,6 @@ int kvm_arch_ptp_get_crosststamp(u64 *cycle, struct timespec64 *tspec, *cycle = __pvclock_read_cycles(src, clock_pair->tsc); } while (pvclock_read_retry(src, version)); - *cs = &kvm_clock; *cs_id = CSID_X86_KVM_CLK; return 0; diff --git a/include/linux/ptp_kvm.h b/include/linux/ptp_kvm.h index 95b3d4d0d7dd..e8c74fa3f455 100644 --- a/include/linux/ptp_kvm.h +++ b/include/linux/ptp_kvm.h @@ -12,13 +12,11 @@ #include struct timespec64; -struct clocksource; int kvm_arch_ptp_init(void); void kvm_arch_ptp_exit(void); int kvm_arch_ptp_get_clock(struct timespec64 *ts); int kvm_arch_ptp_get_crosststamp(u64 *cycle, - struct timespec64 *tspec, struct clocksource **cs, - enum clocksource_ids *cs_id); + struct timespec64 *tspec, enum clocksource_ids *cs_id); #endif /* _PTP_KVM_H_ */ diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h index 3538c5bdf9ee..7e50cbd97f86 100644 --- a/include/linux/timekeeping.h +++ b/include/linux/timekeeping.h @@ -271,8 +271,6 @@ struct system_device_crosststamp { * struct system_counterval_t - system counter value with the ID of the * corresponding clocksource * @cycles: System counter value - * @cs: Clocksource corresponding to system counter value. Timekeeping - * code now evaluates cs_id instead. * @cs_id: Clocksource ID corresponding to system counter value. Used by * timekeeping code to verify comparability of two cycle values. * The default ID, CSID_GENERIC, does not identify a specific @@ -280,7 +278,6 @@ struct system_device_crosststamp { */ struct system_counterval_t { u64 cycles; - struct clocksource *cs; enum clocksource_ids cs_id; }; From patchwork Thu Feb 1 01:04:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Hilber X-Patchwork-Id: 13540526 Received: from refb01.tmes.trendmicro.eu (refb01.tmes.trendmicro.eu [18.185.115.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7921F3FF4 for ; Thu, 1 Feb 2024 01:06:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=18.185.115.53 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706749595; cv=fail; b=Tj3NWa9yBbIlLkMhpYkChebWZt0+jF2YRsRfTRkUp7i2KKKhkn9Rvvexn1jq1t+PVFEzoKGWh4jWWSz9Ubq2o95YX8Nbhulrk2cV2cxB2WT6DJd+DoBcPmkAtAbG3P0SRNktwPXgN5aIEEilluxmzceEcrRvmd/Z35N4X81mW9U= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706749595; c=relaxed/simple; bh=zk85uvIQqp/ot0OdT5DejcghRs82+xu4izURtMvuhQE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=XzZ5DZXQw8r5hOVom0E9Lain9UCLM90+nFp8lbq5N2WbZBzxQN82mraBBpgiY3LGPaA4/TeryJXJaCie5O102LVju8PrW/95UtkWdPNwbevhwyzMX6XIDr5wMikFSxsnWYzcVFPb1mV4yNbzVS9X+/TUfngsdqMqcnlBGRnQt5Q= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=opensynergy.com; spf=pass smtp.mailfrom=opensynergy.com; dkim=pass (2048-bit key) header.d=opensynergy.com header.i=@opensynergy.com header.b=S2xv7JtR; arc=fail smtp.client-ip=18.185.115.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=opensynergy.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=opensynergy.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=opensynergy.com header.i=@opensynergy.com header.b="S2xv7JtR" Received: from 104.47.11.169_.trendmicro.com (unknown [172.21.10.213]) by refb01.tmes.trendmicro.eu (Postfix) with ESMTPS id 39B8F10D3A1F4 for ; Thu, 1 Feb 2024 01:06:31 +0000 (UTC) Received: from 104.47.11.169_.trendmicro.com (unknown [172.21.181.221]) by repost01.tmes.trendmicro.eu (Postfix) with SMTP id 5F0CD10000467; Thu, 1 Feb 2024 01:06:24 +0000 (UTC) X-TM-MAIL-RECEIVED-TIME: 1706749551.393000 X-TM-MAIL-UUID: c251587e-0784-4822-aaaa-ce694d2446bc Received: from DEU01-FR2-obe.outbound.protection.outlook.com (unknown [104.47.11.169]) by repre01.tmes.trendmicro.eu (Trend Micro Email Security) with ESMTPS id 601041000006C; Thu, 1 Feb 2024 01:05:51 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VMAXjbBwdTirr7a8YVsKo/UCwcvyFH6AW6aW5ynzOXvHCA8O0CwXwj06tAU7KlrqyIJ89+bKCjdkYrZ7spjBHce4VdNn3QCrimq69a3GYIWGIcebQl5V1ZSFcq6EepnIV+/mSFZ11izRzWUWO6enGJC6p6aJicUbLMo0DA6CjkUph5HrO2xmkhX0RH+j2+naiuD1sjpFFDFZJILQLyTiDggcSl3Hom44XOj7+jqLOIsbwSLmS1gheiLBCWIa0RKJeAHayfy6wbOycLnaA9NkMl9liz5grU4lJhEz1kHtQ5bVtO7atMe7DYmWU+4cP+nd4oRpMIaAAB18/8DLYtJYeg== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=68UszWC6u1kb+YBX2FtVzcNWjvSlFHvLWP68hbFsEfk=; b=cP1HvY+x1Ecki6ol0Cq5gvttjDeDOahAaGdCMaPzqPv1vAqCzmdKf5cbbgiyGseUAZV4aFkBV0KbbmDHhXRRdofigspsQbv1OlWyN5yEZiHx4TWvSnpJ2K/MsKy338iWknjtim1EFpz+heq5XYtcpFL/2E51fgq78FRzN/x+7AuQVd9t9BG9HnNNkPZXUBc6qEadmJCAN190/KC34Qnx+eLACdGe75FkxuPe238N1QBcLvYvWHSWbLVWvQSzSF3+298P27iv5ULUUKxRQHsev6kC7kQo+hkM7fGWwsOuay/lxlaEkXHftfWg42Rq8DUUSiEMZPc9XncCuZjsA5Zv3A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 217.66.60.4) smtp.rcpttodomain=alien8.de smtp.mailfrom=opensynergy.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=opensynergy.com; dkim=none (message not signed); arc=none (0) X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 217.66.60.4) smtp.mailfrom=opensynergy.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=opensynergy.com; Received-SPF: Pass (protection.outlook.com: domain of opensynergy.com designates 217.66.60.4 as permitted sender) receiver=protection.outlook.com; client-ip=217.66.60.4; helo=SR-MAIL-03.open-synergy.com; pr=C From: Peter Hilber To: linux-kernel@vger.kernel.org Cc: Peter Hilber , "D, Lakshmi Sowjanya" , Thomas Gleixner , jstultz@google.com, giometti@enneenne.com, corbet@lwn.net, "Dong, Eddie" , "Hall, Christopher S" , Simon Horman , Andy Shevchenko , Sean Christopherson , Paolo Bonzini , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Wanpeng Li , Vitaly Kuznetsov , Mark Rutland , Marc Zyngier , Daniel Lezcano , Richard Cochran , kvm@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH v3 8/8] kvmclock: Unexport kvmclock clocksource Date: Thu, 1 Feb 2024 02:04:53 +0100 Message-Id: <20240201010453.2212371-9-peter.hilber@opensynergy.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240201010453.2212371-1-peter.hilber@opensynergy.com> References: <20240201010453.2212371-1-peter.hilber@opensynergy.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB8EUR05FT032:EE_|FR0P281MB1772:EE_ X-MS-Office365-Filtering-Correlation-Id: c14f677c-f065-4500-e808-08dc22c1ed98 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pEBVQBoI7ER14sO37xJWJ1AOU6PqRSWdL5pil9aOxK4Ii4WV90SPDMcI5loyElujHD6B1CuDnhgTgWPRWZB0Blru+VeWrHkkRmVVqQzEKAOvqBBAWCceMZ6RovcjqrYzNGOITFZeS43mXI3yS1HPbD6qocDM7uCkcYutShu2hUJ2O6kHo/6jchbhyWQ7M+nnsFxU0B3IGHMa+CTFUt8hE6E3BLaAEtNDrjvaHWMEtyXrtMAE/wpuPMMkgyRzGdFub+BtNBSq/2+2k6mQPFSjFAKmZIQpgbvzbgMGVIhmKLYlswufmbibbzPIDXYMrW/ZlVrRzLDy1i8xn1cS3rMw0P3CleoifZcOUOcSYMZp0wOewLQSIaiZWAOX5ANlrt+r3ordhi6+X4iRzxxEiqhujCE40VQLirsdRWTynt3gZQHxsTVJ2f1Oa6K0nHj9RIvhBvqcVfG2kx9oYs6IleU2Dvq9dp0yoLduvAan3e8REDvuIbFZejZP8HiR+vFe4ZtsKlLEmyhntgszMHl/xor0rjUgAFJe5R9hJWqOels0xmx/aRzCtjEGa578NMY8pXi8m1vxthXGe6KJkyda8bGxnkcWL+gqDJpyKzA3hEzxqI3904LP/0i3agQut6Qp3NXZE6RgjDHCpveHvuzQZfnXW82FOQBEkHnzqBKeqh4lkckh7uU67JcXWFH/hcWDAmVa9XaYmgIOezPgcfK0llXWQiyGqwzMrcnyrBmPOmr0to1W+wdvqJR4mcZh12usu5DR X-Forefront-Antispam-Report: CIP:217.66.60.4;CTRY:DE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SR-MAIL-03.open-synergy.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(39850400004)(396003)(346002)(136003)(376002)(230922051799003)(1800799012)(186009)(64100799003)(451199024)(82310400011)(36840700001)(46966006)(478600001)(70586007)(2616005)(82740400003)(5660300002)(7416002)(44832011)(81166007)(41300700001)(2906002)(54906003)(336012)(36860700001)(1076003)(86362001)(8676002)(4326008)(83380400001)(36756003)(8936002)(6916009)(26005)(47076005)(70206006)(42186006)(316002)(40480700001)(36900700001);DIR:OUT;SFP:1102; X-OriginatorOrg: opensynergy.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Feb 2024 01:05:48.8771 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c14f677c-f065-4500-e808-08dc22c1ed98 X-MS-Exchange-CrossTenant-Id: 800fae25-9b1b-4edc-993d-c939c4e84a64 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=800fae25-9b1b-4edc-993d-c939c4e84a64;Ip=[217.66.60.4];Helo=[SR-MAIL-03.open-synergy.com] X-MS-Exchange-CrossTenant-AuthSource: DB8EUR05FT032.eop-eur05.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: FR0P281MB1772 X-TM-AS-ERS: 104.47.11.169-0.0.0.0 X-TMASE-Version: StarCloud-1.3-9.1.1015-28152.007 X-TMASE-Result: 10--1.575700-4.000000 X-TMASE-MatchedRID: BoYRaA2j95x5JK6VZ/y/JZIdC0Q5JDAc3O2+pOfl+vcwLJ9PZUBQhdqK Kei3fK/BwLkzWLqYXGIPTxis+8SzNY5D3dtciD32DnyoB5C0LDMhB2S/EqeA6zB4jJltGVDbLN5 wGPX3TPXYeXOEzfM22ez1ZBVjJwp/DeUZOJCXHMgCZpI9UgJMHqJYuGaIjh0/fiAqrjYtFiT3az xU5+I+Ep2+6DCWmW4Hr44iRWuVPqIG9pdpHgJL8H7cGd19dSFd X-TMASE-XGENCLOUD: eea5c0c0-86de-44e7-8521-2a9364c6a452-0-0-200-0 X-TM-Deliver-Signature: D157937CD86D805F530F564B2F0A321C X-TM-Addin-Auth: Vaa7inNIa4Kf4UMh99Ebri8D1i4dm2eKOqZvseVqXrsbZRwjQtOM6PzGMjy 5TzBaknLnNz2cEimtzDRWvv+xmBLR7CIQxUum61DMqJjBKpCxGcGedulQR4ZQN92yynXa1fij0k vocD1ZklCfanlgFUWZoGujN7kM9xxIMcHITRdpIeXWaJ+0IGXdBa40PLZrApm7SJm3027CvkRLw daHR9vhYEjL7bQPfpAAgBuFOkRDsCp1FHNdj6IrfheLVrgJcJN2Q3oCTSZjoU6xVgOgxRnuZ95e ZGeuH+QD/J3r8YfCPDiblMMps/PTTTKuxE6J.xsND+Adgvd/qzlxtk+lr0WvcLsnJnV9xKdIYB4 UODIVl5rF+BU3zHE1zlQGJ4AUrqv7+PoYYZCF24E8WXB8VDiqDT7p5pqj2V2fzz4OQbNyGOShai UV1UqTeE37GWz8iQyvF519L9EOQRtX0m3pMj7iA7cRN4sjgULtSYUkfDzqYaJEvseeq62BPBNIp l4CJ5IgbN0zYQh6SV6ouGdvpHCMBu4o0EwQkgXPSQ+pfseli4u6yaSY9sCu/r4c2HDY+tZDvFcH WIqurLcLuVUY1PpGuZe5lA/bCy9LZYW+rhbBy4nAQZQMzVVffABSLRKCJ6k6nWoEMoR/nWVszgj BOUQ== X-TM-Addin-ProductCode: EMS DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=opensynergy.com; s=TM-DKIM-20210503141657; t=1706749584; bh=zk85uvIQqp/ot0OdT5DejcghRs82+xu4izURtMvuhQE=; l=1545; h=From:To:Date; b=S2xv7JtRyCjSV3LgQnsvmudC0BquLZmiEPO1HPmtnQDWiQ8e5yaPb6n4GKpLGAZ9e b80FpCZ0mAmkA4H7kSCEYB+mhcC9X+SRs25BpFkUpisgSfGojMoci2akybUQp5O9VV g2m1Fndfe+mtWJ5sjFnnvO227iR/4XnBW5nMO3QEEeYELLlQLKG5XmMGwDCUjmTOCP gHNvUg6pnjOpufemFLgnhk354vpF9cVCwGV/rF/UAKNO6zdc++dKrVHAZYY4bGRyqF qSXXExP/Q5MQDPkYp3s/xKcR6KnZsv1gEd/tgFbVAZPohrOgdMtoGwRgQ3qE3YDRfK hjVuuMFshAZ4A== The KVM PTP driver now refers to the clocksource ID CSID_X86_KVM_CLK, not to the clocksource itself any more. There are no remaining users of the clocksource export. Therefore, make the clocksource static again. Signed-off-by: Peter Hilber --- Notes: v2: Added in v2. arch/x86/include/asm/kvmclock.h | 2 -- arch/x86/kernel/kvmclock.c | 3 +-- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/arch/x86/include/asm/kvmclock.h b/arch/x86/include/asm/kvmclock.h index 511b35069187..f163176d6f7f 100644 --- a/arch/x86/include/asm/kvmclock.h +++ b/arch/x86/include/asm/kvmclock.h @@ -4,8 +4,6 @@ #include -extern struct clocksource kvm_clock; - DECLARE_PER_CPU(struct pvclock_vsyscall_time_info *, hv_clock_per_cpu); static __always_inline struct pvclock_vcpu_time_info *this_cpu_pvti(void) diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c index 2f1bbf730f45..5b2c15214a6b 100644 --- a/arch/x86/kernel/kvmclock.c +++ b/arch/x86/kernel/kvmclock.c @@ -154,7 +154,7 @@ static int kvm_cs_enable(struct clocksource *cs) return 0; } -struct clocksource kvm_clock = { +static struct clocksource kvm_clock = { .name = "kvm-clock", .read = kvm_clock_get_cycles, .rating = 400, @@ -163,7 +163,6 @@ struct clocksource kvm_clock = { .id = CSID_X86_KVM_CLK, .enable = kvm_cs_enable, }; -EXPORT_SYMBOL_GPL(kvm_clock); static void kvm_register_clock(char *txt) {