From patchwork Fri Dec 15 22:06:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Hilber X-Patchwork-Id: 179636 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp9621869dys; Fri, 15 Dec 2023 14:43:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IG21Cd1KNE4AsU0uZDEvLHf8tqLq2VAkSdWvSUbsGaK/Q7DynEIGw1+qoHvslW+SZBUrc/i X-Received: by 2002:a05:6a00:21c1:b0:6ce:56da:62d3 with SMTP id t1-20020a056a0021c100b006ce56da62d3mr13263161pfj.25.1702680182952; Fri, 15 Dec 2023 14:43:02 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1702680182; cv=pass; d=google.com; s=arc-20160816; b=HzRP3OVLSc7OX31PzO5wUkTeM4hFqgKa9AQCNN6jQT7zq2gDbFlXjPGOJcZ+OHEeim acgdneADOTRGyzHmKZYMxfgwEP+O6YcycNcqn05afroUV2lur2vm/gLArRHsWGkVbufp 2PRLRMUwJZXGFMB/vXnl6rrQaCPBSkb5CCLctmYt6QaieblEBJSZyzl1B7rK1LCQyIzm Z5Ed8JDMn7HRi7Ni9J+vBCPo2so/0NYVACnbokrNj57qzb8y4Wubgpm7NbVlSx97YvcL bfhtKEptG8jgIOZbZkLPbaaomJ9z6tH3veeqKolx3sg0K+Phr96EWbSd/Kx3FGQV8LmS aAJg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=dkim-signature:content-transfer-encoding:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :in-reply-to:message-id:date:subject:cc:to:from; bh=zRtFNCAr1Ds5fKMUJ17PxiUdSGKCZ1/180VbstTHU9s=; fh=/cn+e5IASEkptmcs3w8RuKlSFgqeb9LhpePaFBhn/QI=; b=PrKC+fPaJAL1ne72gzdVf7s+tomLbYkqRObSVWt6SXlNQr7DFQTywELpkRRBhYdS/W +VG9Yk/lC6sKd4jRk0AL4N65WzuPvzsPFBvgBDKg/Wj1BUOLkpZmL4fvEsG+TnGZFsPH 8m5ZEdrYzbXM0HVr/oav4xUVjm1ZNWiXOAMKQgdqC9O1Pu/gXCdVdTx/I651G5RkNCub 3ihBBSUDXyTgYcgoCg3hePtED6+0WxhMNrjPyHSwVq6x6LlvrbFbOfQM/sRB18DVBMeK z/zLkUx9i6txRNoHRh9OldVHWxRQX/0YuoeZVgVYIIIuRkbX1QwyaGWPqflQf4HsLjwT dIiQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@opensynergy.com header.s=TM-DKIM-20210503141657 header.b=P9TsXwVm; arc=pass (i=1 spf=pass spfdomain=opensynergy.com dmarc=pass fromdomain=opensynergy.com); spf=pass (google.com: domain of linux-kernel+bounces-1775-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1775-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=opensynergy.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id f19-20020a056a00239300b006ce5ba4300esi13697590pfc.219.2023.12.15.14.43.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 14:43:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-1775-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@opensynergy.com header.s=TM-DKIM-20210503141657 header.b=P9TsXwVm; arc=pass (i=1 spf=pass spfdomain=opensynergy.com dmarc=pass fromdomain=opensynergy.com); spf=pass (google.com: domain of linux-kernel+bounces-1775-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1775-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=opensynergy.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 5D94FB21C8C for ; Fri, 15 Dec 2023 22:38:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4957318ED8; Fri, 15 Dec 2023 22:37:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=opensynergy.com header.i=@opensynergy.com header.b="P9TsXwVm" X-Original-To: linux-kernel@vger.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 1B7FD49F7E for ; Fri, 15 Dec 2023 22:37:37 +0000 (UTC) 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 Received: from 104.47.11.168_.trendmicro.com (unknown [172.21.19.113]) by refb02.tmes.trendmicro.eu (Postfix) with ESMTPS id 73FC610A4CC95; Fri, 15 Dec 2023 22:06:42 +0000 (UTC) Received: from 104.47.11.168_.trendmicro.com (unknown [172.21.165.80]) by repost01.tmes.trendmicro.eu (Postfix) with SMTP id D08B810000624; Fri, 15 Dec 2023 22:06:34 +0000 (UTC) X-TM-MAIL-RECEIVED-TIME: 1702677994.297000 X-TM-MAIL-UUID: 88af4850-7668-41a2-a00c-fc0043bae284 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 48A65100012B2; Fri, 15 Dec 2023 22:06:34 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WrvoYLGxDx8rz70NuCQanFGKRLwQfT3gPjd4Vzvi0jcG0WYOSXpO1r1nHZbAGkZMwYm5qP1yN0CvTh+9Wpca6dzC7PqOgTtzJIWdji2c6NGaludtaWSpxPFt1fIh2HS2hR8Kkrm7+z/G9wd9MMCiGTXfUmu2B0pOvFAtdy3+gD7fCQdvC4SquWIH82VbGg4uQf+JiVRYwI52T6JC1Xqk9S+g3trDTbwfU+9xpOSBhv5RRcFY0a/rmxvX4EJy7DEkylKeiezpwYpLrut88VSE5xQQ7gFysALC0FqQrXjKCJ3qjs1N0/6cyNi0V+JqmWjCWfNpDMW7uhK/UPMzGGKGDg== 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=zRtFNCAr1Ds5fKMUJ17PxiUdSGKCZ1/180VbstTHU9s=; b=idnXn3uq1p7EaIx7MEDjGvYX5wFZyFFe0IF1nd0TQuVhZU3nRB4Y9vZhlnPyRWHUDKbqO4w6HigrruKsl2RLx5PVb9yqwYj/v+yu1TbGfcByHxetpYi9KCwOd/pwbbzb+n4YsJpUGpsSkONVT8gG48347Z1DmZQfUmGT3A+GClZlSQNWNexirmR7Zg2gW2r5qY7e3EwggWgBIUo+nwNyHFfakMq64AzyomKh3qU/FX6WxZ/JnBQEb3eNNOMjrrvgkTKyfP4Y28ZGQ4OTgNJ6VAaNtkOt5ye4eGk1yzSXC+nBxI7ZQfoq3HUsZdrZCVEmCmaJcF7ZfMLSLg65+x4C9Q== 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, andriy.shevchenko@linux.intel.com, "Dong, Eddie" , "Hall, Christopher S" , 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: [RFC PATCH v2 2/7] x86/tsc: Add clocksource ID, set system_counterval_t.cs_id Date: Fri, 15 Dec 2023 23:06:07 +0100 Message-Id: <20231215220612.173603-3-peter.hilber@opensynergy.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231215220612.173603-1-peter.hilber@opensynergy.com> References: <20231215220612.173603-1-peter.hilber@opensynergy.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6EUR05FT033:EE_|FR2P281MB1818:EE_ X-MS-Office365-Filtering-Correlation-Id: 61ae0900-d40d-4128-bc8d-08dbfdba18e7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: EtmwNUPBPq2KEPELYx7NUUL5GqMpS8TgXfuiOcqIthhH8YPMdCDaIBhOiPMu+yUtB5Bk3UakBYMclo+rF9MTH3F8sb2NrKVFrACtXBrtYyikbX9mv36KfxHSFW6RxmMXqbGcUZj2OXjATTFaySFVGLK28f/uGJ45/tRcni8Cm1wnCDjFFsxv2J2mRWy3PydaqKZzx5lN/DuAq2qOrgayyliE/XXDHL6wgO4DAtwiqQzgZ17isvE/y4EPL4w2ZX8zdOLVMCV+Uc0vQAy/q/gzWlQkOFjTBxhCXwfGmx98sBlOCr75hrp41rxZriSH25blRZB561rZwagK1pBMcluu6nMTJKDtd+WFfuPALsfSqiOW9maZaD6ykbBPXcwpPmmMpq9p9qmS/xnAslDxescihVKyJsqxXKs9ByG+crHA6p8lo/+CgmTn9ku4apIAvwuji1r+1tXtf3Db+gAqXyUIaJqC10UQe8o38p+oOdVT0xGUbZhGD34Anxgr/EIyqc3VkQ+fgGQ37NU6HuAukBQW2DS4mkvN9ra0h9KAqdFGU6PSrr4lH3zR1hsx/sG28gNKCEO7jk1p8oxqRmd0O2XW9PerUEqKzvQFNl8NXaOw2NBeuRHoynMAfd+YrnjKD0UM/b1qkF3JxEnwkiglpKra3Iy7uHGjE6G/W3VgKQdTOaybS9jCWKTmnpU1I4m4XUvauN0WAwzL3gHZBuKQz0QCj5bbPe6Iv1444slZpqnMf671N5pXmru0h7oxO9ZcTxdvpOi+f9Hz/nzEwe+q+bN9zU2hJrcDwodsINxDv5Jy/50= 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)(39830400003)(396003)(376002)(346002)(136003)(230922051799003)(1800799012)(186009)(64100799003)(82310400011)(451199024)(46966006)(36840700001)(40480700001)(36860700001)(47076005)(81166007)(2906002)(7416002)(36756003)(5660300002)(83380400001)(336012)(1076003)(26005)(2616005)(478600001)(6916009)(54906003)(70206006)(70586007)(41300700001)(86362001)(4326008)(8676002)(8936002)(42186006)(316002)(44832011)(36900700001);DIR:OUT;SFP:1102; X-OriginatorOrg: opensynergy.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2023 22:06:32.5860 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 61ae0900-d40d-4128-bc8d-08dbfdba18e7 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: AM6EUR05FT033.eop-eur05.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: FR2P281MB1818 X-TM-AS-ERS: 104.47.11.168-0.0.0.0 X-TMASE-Version: StarCloud-1.3-9.1.1015-28060.002 X-TMASE-Result: 10--15.306600-4.000000 X-TMASE-MatchedRID: DIEPoA0d9jzJ+P2VFrJmrKwODSO9Fuc1zmG9pmg8ncKJFoX8AKzcA1om CW9DDtQZ4hVD9eCRkSzqUb9emYLkvhfJ8eNjkTqdDH4m2ujwCttelLFkoMPMWMhGESF2QtYSi8+ IGr+Jb3Uyk/Hw4XN9jfnGisRnvgFZd5ZQIOSj8/NgFLgE7TxyQ5Fx8VBGp0H2/2e2Gew+JKSNm3 Cs2pKS6xeVNYbNufufJ+HonzWLENa7Ky1CjgAnYWwEEr52PwDFaRrjP4hMuEYY5lMhYxPBYrdG6 qoYZcgziQXeVzaEgj/rEDQC9rvecA+bXnHKG3yVfHZ4iVAbWwx8LgjA4u/K5wLgOGUBLTt6Wjsa YI4lh3W+IjsEEOIzYopRhpdokeNoQh7AYbodFKriEn0i32rZrz9rrDnRhlmw X-TMASE-XGENCLOUD: c483d876-081e-4ae2-8aa7-2fd9f78d3f0f-0-0-200-0 X-TM-Deliver-Signature: 06DA4D6566C336DA0B9D250AF27F248C X-TM-Addin-Auth: rDHOMPXkU5q4l4Kj2AGctaQDGNncex0Rh+Ce67ArPJyZ+/WzH0J0oOpH6/E NanLrYKL8reYaAFrlrVn/FF6vh1EQsdtuZkGvp131ehc3g6fkOgHQHABNiX1G1ojMZwQsX8X3zK NAd3XMdbOX2j9x3CcXiHj0+v1P6E/Fu3A4+tGHamsaduqbBnStO3v/bPQT65t3Cc6J5Y2yiWbCM SAZcPAItHcEPbnllKnddWJaaNcNpDSyUSjX8rBrixDGYBkIvdmBbwBUhKXCJNk5rlTWnd8suDvs NgsPasGYRSTIFPg=.Zxa1Sjv5U70bbTSZLQa39wPe4UMZqzpZ85L62/vjY4hAxoI9ZsGh03O/it 8ptsPyUQMucW1MQrf4umLPgNZp1sw5XVZsaexhe3icj9cgDhplbgnFM9wUAd0OEm/7H4rhzCd05 7LJyvoyf+tiYCIK0SW8qnn0aGzPEVq1srLiCcA+5+yx64e3G85VYWZq0MauzvEziwyKmcp9hyDQ /ZWekuJn9Yo/RpCiVI6P1/IkasFjnnCM7yUmyr4Fcy1TA6RovwAZlr+FV0VzGOkNCc6dG/30+y9 Rodt1lLubqgh0MtFpb2W66K95PEfgcHv0FoFerqpyVHGY1ftUwMDTwuo5zQ== X-TM-Addin-ProductCode: EMS DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=opensynergy.com; s=TM-DKIM-20210503141657; t=1702677994; bh=xEWCo0i3CVcG9U7bBjQMZXzIReSqMOlFd1TAhHuIl7k=; l=5309; h=From:To:Date; b=P9TsXwVmJ0G8nDTtUxP0YLVC5LwZdOmscfvxFVdPTfD09pHAZFbwfiAA3zo0AcjJx 6h+H5opIW1Xh1vHhj5Q+7uJcozk9pMqpV/ZsTEeGKO6bMX2vLuaTMTrUYQIt4D7g2O RyPX2tPCRgaa7Cg3g1iI3CIiLQCAgpwFToNS0TDmmhMdhS1HfSg5d7ELothvU5+kO+ wy6DPjrHBfOFLkfhHd8MrOYuWxI514Bo9/FXOrswJBp4NLGYlRBk9snnH61QzKPQWk 8HoY59VEAqZ61verzdCqIl+Chp9L+RjL+uSig30F5TlV6Pomzfwa2w9YyCASBOYtD4 aynqd/T9MRvCg== X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785389575498627766 X-GMAIL-MSGID: 1785389575498627766 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, this will keep get_device_system_crosststamp() working, when it 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: 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 | 31 ++++++++++++++++++++++++------- include/linux/clocksource_ids.h | 2 ++ 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c index 15f97c0abc9d..9367174f7920 100644 --- a/arch/x86/kernel/tsc.c +++ b/arch/x86/kernel/tsc.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -54,6 +55,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 +1170,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 +1193,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 +1313,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,12 +1334,15 @@ 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 * @cycles: System counter value * @cs: Clocksource corresponding to system counter value. Used * by timekeeping code to verify comparability of two cycle * values. + * @cs_id: Clocksource ID corresponding to system counter value. + * Used by timekeeping code to verify comparability of two + * cycle values. */ struct system_counterval_t convert_art_ns_to_tsc(u64 art_ns) @@ -1347,8 +1357,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); @@ -1454,8 +1467,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); @@ -1480,8 +1495,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 Fri Dec 15 22:06:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Hilber X-Patchwork-Id: 179600 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp9611588dys; Fri, 15 Dec 2023 14:18:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IHmMbCT5m1tArCWyNbx5bPRWEg/ME6y4Zb8K+WvVWL1KyNVw4Sg05ZMiT8UoB6X2xJLabLR X-Received: by 2002:a05:6a20:6881:b0:18f:9c4:d34d with SMTP id n1-20020a056a20688100b0018f09c4d34dmr13210865pzj.61.1702678717160; Fri, 15 Dec 2023 14:18:37 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1702678717; cv=pass; d=google.com; s=arc-20160816; b=J5OnCPI3/1SBtGxyuEB/30ki+0VNe8hQ7e+pBIbXKK3X3eMd/FSLZdcssgf/Fhpdy+ Y9KlCfiwjMhrh/59b3zch0jnaL56UUUg5mQ+ybEc8dh98a9gGxLYX7HGsSoqLpgIlYVu WrZ90DfKsWF7Q0Mn20xyJB57X8c1z0Bz/pHWMGGQXORPa/z0vEpFH8/EVNcFQ8D/PYPX tO20UcXeBQxZUagXXJBBnScQVffjmBHgNVQ5RXdDEmaenklym1aYnVKdPJBvrbka+3Qu zNePQeRdzlcM5W/08RAbz1BczW0ZJi9WUxvC5+Rw43ykAGOhxJBoaIaS/C0cKl55oz9l DLWQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=dkim-signature:content-transfer-encoding:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :in-reply-to:message-id:date:subject:cc:to:from; bh=5Sd5IEkoUPoeW7OZTn5GtmVq/OgfU7MvXexTI6z7ujI=; fh=ju8AeqZQObxcdoB/WMTx4XPWz6nnGkboZLp+SQ5IQoI=; b=vXmdbb+TGm2ffT4yjHe0pg3ce2qnoyC9NzE9REM3RkZrA2c3QuQPtvRZXCmXP/i5ks 1JmaljukzuwMbyZ575f5JWq11WM25ZuKiS4VDN3R7tIAaYy0ec2rAEICZ0fWqknttjhM dmtCNlHyqCxSOL47y8VRXH6UbrZJKG5Smgr/itFt8zzIEf/lIXzMr8Q+kcKEeGNzHHZt P35ARlIXSk8HvNtv81MK0Nxbx+UwB9mNN8cKk9Z/Al8d5nLGzF6bIAC4Lyc1v5mLVf0m 7td1r2T7oLUwWqYRSpLnYqnM0gi6lFacKBerQUcLZR1NSKw1N/uQOl5b7hRlKQgYNVMo g+cg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@opensynergy.com header.s=TM-DKIM-20210503141657 header.b="csE/8rhP"; arc=pass (i=1 spf=pass spfdomain=opensynergy.com dmarc=pass fromdomain=opensynergy.com); spf=pass (google.com: domain of linux-kernel+bounces-1729-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1729-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=opensynergy.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id q24-20020a63e958000000b005c6b4091c32si13550015pgj.385.2023.12.15.14.18.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 14:18:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-1729-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@opensynergy.com header.s=TM-DKIM-20210503141657 header.b="csE/8rhP"; arc=pass (i=1 spf=pass spfdomain=opensynergy.com dmarc=pass fromdomain=opensynergy.com); spf=pass (google.com: domain of linux-kernel+bounces-1729-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1729-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=opensynergy.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 998DAB25C0C for ; Fri, 15 Dec 2023 22:10:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 919F513B12C; Fri, 15 Dec 2023 22:06:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=opensynergy.com header.i=@opensynergy.com header.b="csE/8rhP" X-Original-To: linux-kernel@vger.kernel.org Received: from repost01.tmes.trendmicro.eu (repost01.tmes.trendmicro.eu [18.185.115.30]) (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 DF7796979D; Fri, 15 Dec 2023 22:06:37 +0000 (UTC) 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 Received: from 104.47.7.168_.trendmicro.com (unknown [172.21.199.136]) by repost01.tmes.trendmicro.eu (Postfix) with SMTP id BEAB210000081; Fri, 15 Dec 2023 22:06:35 +0000 (UTC) X-TM-MAIL-RECEIVED-TIME: 1702677995.018000 X-TM-MAIL-UUID: e195d0a4-074e-42bc-8b38-5418a9ed923e 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 048BC100012B2; Fri, 15 Dec 2023 22:06:35 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QsAIxYSW4RuBGDTyAvojo97WrVQNAdh8eReV1VjCgS3+/JmkK7mYBMCXxjuAocVdnKf56lLuImQgsnsmvY5U43qZs4Y3IbqhPE+HvdFyv9fv0vJXSNN7OP872EkSSKtxdDGaMA/7SWOdxge5+vrUSD0wElM4ZpySK4w+j7tQTmCCtZzXL3iakwDnTyTNwS42/FI92QaYlzv4I0bLw945ilEuRDfAbOXYyT0GTZ09WwnAtCHP5y/3MBOFquYPwq8U7EVAUMlG9RIRxZatz4MhCsYPhlBPeDQRlyH+Ru6VzXFOlTYKwbMaJKC/KK/vjbTl1VLXAxE6UPEoWj8hTw4IxQ== 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=5Sd5IEkoUPoeW7OZTn5GtmVq/OgfU7MvXexTI6z7ujI=; b=I1lY1+OVaSD9h9t188HZpYu8nvgNo1WzOaG/jOLrXv+rQ0iIb5Q+fFhP0XvzR1BSfmVwwSopBGHxXRI7TFeOBitY1skhLUwPBlBXqCAo/XMlAq5aQWpiTDkv9NvPviMreiJGZBkcSQZcRa2JGJbailKuzyP0pK+iNXjm/7o1b0b0ZPDt10bKv2s5HcujNOYut5sftbqO5DUFakzHyoZcG+Mkwtv+vVOX7YjZMmYSY4MMbj8tO64mGXGflg17n1/vSwfDfsMMBBgmqO1S+7EroQZm5c3SEaHKi1uazp4hbEdERpMoOcZgEwt9amsqxPTPwf3KldK+WYiRday5Bzn6vA== 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, andriy.shevchenko@linux.intel.com, "Dong, Eddie" , "Hall, Christopher S" , 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: [RFC PATCH v2 3/7] x86/kvm, ptp/kvm: Add clocksource ID, set system_counterval_t.cs_id Date: Fri, 15 Dec 2023 23:06:08 +0100 Message-Id: <20231215220612.173603-4-peter.hilber@opensynergy.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231215220612.173603-1-peter.hilber@opensynergy.com> References: <20231215220612.173603-1-peter.hilber@opensynergy.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6EUR05FT045:EE_|FR3P281MB3357:EE_ X-MS-Office365-Filtering-Correlation-Id: 1be1649b-47ca-46d6-5f1e-08dbfdba1963 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dxBJ1YWW7MJZ+OYqQD1XhEXh22Ax1ZjwGMdmFpjYolHusm9t+mgKs2Kvf5mcvofB2PaC2KB97Jl84ylnJKv/K8Gd5y7tFP0ugKFlRID9FTe5AUdQzPebFJ3ki8Dz04xxZlRvpddolQLxGHJpRscSiFVFfewVv6B0mZt6iykh2Tn3PlnubtAHDYi1j3wsD7Rjmdit6Z0asmoLrdDCiqvHoYlMdx67nFBayamMfE0mlVX9RGfvFIqRXFohra+NojTMltICxGCrt2xgwHvVO+aYod5ACHdgaJSgkAxX02yIq0+dinP0pAQaiMxvl0xnIWiCf+dfk5X1hGImpNbt5lFxvqZ6EO1kubdMuHnRQHijbgvW9+Mm2tPWHuqxnaV02WGuBZ8LTa3hpvqEiZLunZXG9bpQuJ//adBb+4zblMAPI2CGM3+MSn9oElk8Dwm4zlQTR8NpzDkDsigSQaOviShJ0wzhxxt5kZ8hBfFtR6l/JSYgD4AnLYDXrE5De67T3Ga3ivyW04azx8C+HKt+xO5CD2GsgInuA63wTOjZzX68QekCO7GqcEE+2MgYJQiyXn/lMjvax2L1d6tgXWZlqFRpJDaWDu4hcNt5mt2pOH//ot73FB1qKeDO6a1vSwTBgxjex07Aktp2ELSFGXHxijhGZvKSapv18ZINwbERPxxq0q2Ha5yamc7zdo2bzgA0hBhrH3NOGumvL2n0RNa7Ptay39NbU91gTdZojKg1utdd1lPGAbfjUr/T4HoHKO3hpepKiPWsszoK6lftuLQBR1upFSHi5ecCjqRowGPexvfJFOA= 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)(376002)(346002)(396003)(136003)(39840400004)(230922051799003)(64100799003)(82310400011)(451199024)(1800799012)(186009)(36840700001)(46966006)(26005)(336012)(2616005)(1076003)(83380400001)(478600001)(44832011)(40480700001)(5660300002)(41300700001)(8936002)(8676002)(4326008)(86362001)(47076005)(36860700001)(36756003)(2906002)(7416002)(81166007)(6916009)(70586007)(70206006)(54906003)(316002)(42186006)(36900700001);DIR:OUT;SFP:1102; X-OriginatorOrg: opensynergy.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2023 22:06:33.3963 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1be1649b-47ca-46d6-5f1e-08dbfdba1963 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: AM6EUR05FT045.eop-eur05.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: FR3P281MB3357 X-TM-AS-ERS: 104.47.7.168-0.0.0.0 X-TMASE-Version: StarCloud-1.3-9.1.1015-28060.002 X-TMASE-Result: 10--1.344000-4.000000 X-TMASE-MatchedRID: a3KJLn6RIiLJ+P2VFrJmrN/Z7q+hZQVeET56SaIP1M8cZzGOQm4bA4m5 ne5dZEv4w9jS+jgSrFWUIXVq5Qbu8VVPepzs4BLj+wgn0U2OrUhelLFkoMPMWMhGESF2QtYSi8+ IGr+Jb3Uyk/Hw4XN9jV1yiVrPdbQVm3S8hE6lHm2TlNTCzR+UCIUS0zu7U8m3qa5aeVMSQixPQF Fk0j5jBsA2iDfbpfy+AVpeDm8nJoLwnQHFZbUP3moEkqixPwVYOfEmq6feyfNuRXh7bFKB7pL2m I2fvuQKGSRm1o84EoGgf2pYMhSRCAw9lCLgQXXbvuvB6gAgryg= X-TMASE-XGENCLOUD: 39f7415f-b65b-4af8-98a4-8e0e810d2320-0-0-200-0 X-TM-Deliver-Signature: 9981ACC6710F36E7AE444A7FBB5B2F75 X-TM-Addin-Auth: e5O++ZGxWzX11OOFF/fMTxIjpFbFRb6LU0G74PTperWeB71cyvJjw1LumU3 vEFisFzhe7t8iSg1fIWdG0yJrgpj2AzNzKRPDnXBxYb7PXETFqS2+0DOtPXadwQ7fZHePPFREC5 L1w4HyXEcJaPmk51IjR/cSEWkjvOkHkRGb897sXQVwu5bwYQvE0gtgM0dZg1G26d7HqqS1OfJX0 bLekgQzekcl54v0CwdJhfbroUCVVWQ63+sPOhW87FRPOOBvKA6VpJBDPtoN43zGCS3CtuPiaNBV +ADe1XZP8k0UV6Q=.Zd/Vxvy+bWecvQV6pAZDouJtopdxZcPhom+RHNpRQGV7YAjHFTj8hKJj+p TonVdPm3dtaSfgmWxtiuPl2HP28taMN1VDhuGlnm0JbSVW9js+fv/ZZJgqTOUaBYSoR7qyXrs2I zbxLxBEODMqv1Nj2n5eMPExFb08MML9BKmqxUO9MCA+t/vYUIlIB42ioUwR+2djK9C5Bhk95OOW xER25/p90K2gPuWmcqOrcZAHMWfqt5YA67i2sEaleXoMHqLJvnZ7nZNU/URUPx3BqcNJEk1mxwq 5MCrzRXDrDcYsBYFdWZ3QT4Tsuu4f7fNMKsdBgkvRQzZSPB65KwVyrOZCQA== X-TM-Addin-ProductCode: EMS DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=opensynergy.com; s=TM-DKIM-20210503141657; t=1702677995; bh=gkS2CFdT/6ybIKM4BHtmApR0TjJcIGt+eMfoV/Wrp7s=; l=2392; h=From:To:Date; b=csE/8rhPF/WBV6ofOsmdvZzR8aDbAAgYUoar3EGxQM8oeGi4rQsZ/VqufiuXZswAi VrquGJR/ZFZEcaaSdWVIJ6KPiqlNDXd0lquvBXNlzIstNRMLCVd3njIeT9Wc5mCMEi FczcCIpAt5ByCGGYZa6iwfh1lFQ+0ij0jdKXTC5QaJlvZC9gmNIvzAkfUB64gAjudi ixuB0cieQkG8bPmvPcWqEqLt8zbATHMyOGOlQEv3IGzPAGKR7WCU0n81MQXeOtUefF OEffS557QTgtQJU8Rz67/iG64+PhsS8zB+YDL82I6ZLN5OCxOBfJ94GYiIQOdbnYJ2 4h5j+K51VDj6A== X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785388038633974110 X-GMAIL-MSGID: 1785388038633974110 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, this will keep get_device_system_crosststamp() working, when it 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: v2: - Name clock id according to Thomas Gleixner's mockup. arch/x86/kernel/kvmclock.c | 2 ++ drivers/ptp/ptp_kvm_common.c | 2 ++ include/linux/clocksource_ids.h | 1 + 3 files changed, 5 insertions(+) diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c index fb8f52149be9..25d6bf743b03 100644 --- a/arch/x86/kernel/kvmclock.c +++ b/arch/x86/kernel/kvmclock.c @@ -4,6 +4,7 @@ */ #include +#include #include #include #include @@ -160,6 +161,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 Fri Dec 15 22:06:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Hilber X-Patchwork-Id: 179614 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp9615809dys; Fri, 15 Dec 2023 14:28:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IFdRoVEIDsSKr5QpHb1sG+CkPmRRkqF+F36qUz4I7cljcYVCi9LeNuNSCC3Cl6/zb+P85S1 X-Received: by 2002:a05:6a00:179e:b0:6ce:2731:c243 with SMTP id s30-20020a056a00179e00b006ce2731c243mr7795734pfg.50.1702679302263; Fri, 15 Dec 2023 14:28:22 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1702679302; cv=pass; d=google.com; s=arc-20160816; b=yINu7VNioY/3i9ODT1uCkTRUVi8Lfs9kA6mTHs2feIsWLa1+acwQr55hStMjgcaitw +hrUyxQ5nIKINtTk6aHp0euZCFab68CTvdKOSkJawT7q4oXrKAtb/q9IPX4j+9fAo5Q1 5BpcRDr4fGTFnvsVXrOBnox0j1Qg5lXi+U0u3aYUEb58OPFemcPURsk4GNQmxbnlulVq 6NosEiNQWwXsQjPoCrwZCz5yyPpDvu5Hnz8WwmpqhNyCB1ZYDrFrZQLke7XdEVkRF0J7 ITvtiz4wR8XAifNb3lQ6PcMnZluiYMLF3TrPeqdRpVGAXs5M4GXjx4lKo8mzo98FSGYF niRA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=dkim-signature:content-transfer-encoding:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :in-reply-to:message-id:date:subject:cc:to:from; bh=JhgN1hN5nDXN/Fou+ALZ0OcVA9vQ13ILRQYwQOvZUNw=; fh=ju8AeqZQObxcdoB/WMTx4XPWz6nnGkboZLp+SQ5IQoI=; b=rzCkL39LkB0aBe2kdr1atO1Amtb9BT2SIX9a3GHnfSe+hGTQb2u9mkDAxMnsneV8H2 c4s67PRom64lnYeg9gj2G2fqbFT+iPmfKzA5eXLSAKq9imyFApNLmvL6kxmdi9EnHrJp 7nNRdnK9qjXi5kmuji0M6b9M+0+CY3DcVJpkt2npeA7OcTNemCJ8P2wrLr+dTocVOsRB HV8pMA6t6/6yTGzfG5QhcAQtzF+rY31Tz2oY4pnIKs3AsC0R5G+D4A4e7uMEQvJf+GeT /f5UlvbKTzpjQalN6jQkHdbXQ84+YjHi9G3k68bQu+wCzGiwMo3cJRcaXJuq5+xMmxGN R+oA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@opensynergy.com header.s=TM-DKIM-20210503141657 header.b="mviW8a/I"; arc=pass (i=1 spf=pass spfdomain=opensynergy.com dmarc=pass fromdomain=opensynergy.com); spf=pass (google.com: domain of linux-kernel+bounces-1744-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1744-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=opensynergy.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id 20-20020a630f54000000b005ca4684b4ddsi5402027pgp.498.2023.12.15.14.28.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 14:28:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-1744-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@opensynergy.com header.s=TM-DKIM-20210503141657 header.b="mviW8a/I"; arc=pass (i=1 spf=pass spfdomain=opensynergy.com dmarc=pass fromdomain=opensynergy.com); spf=pass (google.com: domain of linux-kernel+bounces-1744-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1744-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=opensynergy.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 5BF65B2483A for ; Fri, 15 Dec 2023 22:21:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 898E218EC6; Fri, 15 Dec 2023 22:21:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=opensynergy.com header.i=@opensynergy.com header.b="mviW8a/I" X-Original-To: linux-kernel@vger.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 8D30418EAC for ; Fri, 15 Dec 2023 22:21:04 +0000 (UTC) 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 Received: from 104.47.7.168_.trendmicro.com (unknown [172.21.19.58]) by refb02.tmes.trendmicro.eu (Postfix) with ESMTPS id 6780910A4F4A2; Fri, 15 Dec 2023 22:06:44 +0000 (UTC) Received: from 104.47.7.168_.trendmicro.com (unknown [172.21.190.17]) by repost01.tmes.trendmicro.eu (Postfix) with SMTP id 0447D100017B7; Fri, 15 Dec 2023 22:06:37 +0000 (UTC) X-TM-MAIL-RECEIVED-TIME: 1702677996.575000 X-TM-MAIL-UUID: 3cf0ae40-e021-4181-887a-bfd49b216fe5 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 8CA2E100012B8; Fri, 15 Dec 2023 22:06:36 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=D4Jn66wI/Lm3/qbC3LNinLdH+HuVJQl8PYcQyX0fEuUZW5Mxwou1utglcNvJ6iNI5yuz+gMqy5SWxkfgyFfU4TVixWXAa4VmOeJYoz+0no/JfoqyxFdJFqDKNy7y0+SEOhYyRJqKES3Uzbef4flhPI+kagwiHMtjEfB9MzLOy1+F7WZaYQF1vnBmjTAYsnCR8OeUMSLD4yivL8jd7Q8MOBVpBjCaiHG2gg9Xh3VcngX1leaI/sSCbWF+4D9zpS3jRBG7zSBQcgEJxYSs2XROtGmtz41g6Hx2itKLjFtXcuI7kJt4tV2PkBjaDlOyj8FWDosb2M4F07Qe1M6/EW/4xQ== 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=BqZ42nXmzQnDA2NctbcIaoKFj1BcCCfbSo6WxL/sVOojt+z2PGvR9EAeeDf4chduqoRXg2vzxrcxBDKYlMcNA0iL00YQkS0FPoCcUl6rVsuKg32cvi/RB17u3ShJBNIsv2AzwT1wxEJR2CQHX5w0igbvXaF26FkkWp11pQO1VZ/oKEbI/em0w65t+qeotsFteBrqhroqcIHnoDDyG+HdmYHPYZO8EV8kWRax8FjlORrfo/t5ntK6GVPu1yzRJjWdwrJuyZbLX47tA0gXX4wju/n9fOYl0JOzGM/6CSm9jj9CYj2sGViCCaGHbMR8LA5zximRyqttCa9r0hnkhRHECw== 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, andriy.shevchenko@linux.intel.com, "Dong, Eddie" , "Hall, Christopher S" , 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: [RFC PATCH v2 4/7] ptp/kvm, arm_arch_timer: Set system_counterval_t.cs_id to constant Date: Fri, 15 Dec 2023 23:06:09 +0100 Message-Id: <20231215220612.173603-5-peter.hilber@opensynergy.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231215220612.173603-1-peter.hilber@opensynergy.com> References: <20231215220612.173603-1-peter.hilber@opensynergy.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB8EUR05FT012:EE_|BE1P281MB2932:EE_ X-MS-Office365-Filtering-Correlation-Id: 282d9463-953e-4fa8-2bba-08dbfdba19f9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8yYfvD9Hm4D60NL5mPXiHSSAAb5rEjKzsa9XmiaCfSkMKKJuQxpGofiNBVS6ZYdu2nE4XO14juGnkprupnHbDc/Fmele74gNyBPPuaeSzbBmf3qLU9bRHTK8bUcIC3+iEgcmd1N1PyMq4VazlYphbYcD+n1sq0r8u8mrR8Fr8Y/nXBA6aGb1roOKCMl1Up4Q9ijDDB5BJ2cAHbYqdy4FCKg3Ak53W0gf8aX7l5L+03snHQTApw2gfEBLGflmgyhEeyFhuFAl5T7vwZHCCrtFYWxHpOugMRIAsLSGu+waSXCbaZufOV8DPaXTXbTHaJGvsAmkDJJUtlqh6GUi+bSk6+GCungCI6cm2tFc04u1AxGFFRONJ8TeHPumn79AmMhwPGcMyziU0XpjMIRrEbNglHDOaFviD+kX46zXXJkBiFMgIIo2Wy5UxXtioadnzXTrXO4OXEII2VwvvTM7MHD4vmsX+XucBmErFQ8IWMAUoogfOjcPJoiEOY3SiL/doUwl6xwJLAqXji+5skVPFxWyA9Xxkj+rML3vxvIBXE8fPShhL393KjUGzWTf7Zl3JhvFzs33RkUMpKhUiaqvLxJ/yYXqlQTSaS9HgW7EKQ+94byxDDyp42gNefDeYto7CxEHHG1T0YbuuVJ+KlLe32m3RDwc8bOI5t+WOkuKvJ3bLJVT2eoNr4T1zZExNw5cLaBMiTXr22/uADODxgM9s156IP7DeJZDFzR42xigK8snhTTrnKqNvX1UIajmEyR5WMOx9+va1HDyWQy2O4Q1oWwjJdB5MZHku6STqrAYPkXQpyA= 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)(396003)(376002)(136003)(346002)(230922051799003)(1800799012)(451199024)(186009)(82310400011)(64100799003)(46966006)(36840700001)(47076005)(83380400001)(1076003)(2616005)(336012)(26005)(36860700001)(4326008)(8676002)(8936002)(5660300002)(44832011)(41300700001)(7416002)(2906002)(478600001)(42186006)(54906003)(70206006)(6916009)(316002)(70586007)(36756003)(81166007)(86362001)(40480700001)(36900700001);DIR:OUT;SFP:1102; X-OriginatorOrg: opensynergy.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2023 22:06:34.3467 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 282d9463-953e-4fa8-2bba-08dbfdba19f9 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: DB8EUR05FT012.eop-eur05.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BE1P281MB2932 X-TM-AS-ERS: 104.47.7.168-0.0.0.0 X-TMASE-Version: StarCloud-1.3-9.1.1015-28060.002 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: adbce404-56d9-4abd-afa9-55a092636643-0-0-200-0 X-TM-Deliver-Signature: B819EC21C70D82E2308EA9DCB3485B89 X-TM-Addin-Auth: 7n2liQSfv/l2jQ8mhkvQOzxTvEU6xMkC2HSJXzl75MYIDgpCyS9+QL7naJ5 NEhnfryRmv8FATbKtHV4FRuhVJDXiCyNxiYywWP2h3r9YRYoeYuLVsxlbr63rVCCxr2+6pfhGjC 27BMqowTqxEL5T8TsqG6Ck5ljt2D4KPIdCznnDAVMo1gTsYpbhKFTf9kpipIsri4lRnBhxsQ0+v uCiGnN7i2FBv+QY3yd3tCJbQjaIK6J8NpkIUIAHpERPJOXvQzYCnLF00ks6Mh463yV25r7FjCo1 xWwkvxwPFZUqcYM=.Zr9HoGg1JNgvSbfKNJb4YLbipw0BMkejA1/LH1SN49l8x72K+pKj7jK0r8 wL/r5nz2dlOqDi5P8cIRX7oOgdTuhRb1DYt8aCtqJ2eL7s/mhLIdyXq5LgZT/1LPFqN1x6KWdqJ G+qBX7xjxY1uLwRky54K31QkW6FPxs7Etig2V91G7PuS3Nrn38oioOUcH/lXq5OpJVl+6AGq8Ml mTRymcCsR60/lEr54f82zHXYjIh88khj/LICY9sck1GRTiCokHtYymJfJwzkpRrmYA+s2EkhzZX iJ5J85zlr/KQ9d2bm8WqyPMQfB3A9qi8D4YjE86bGze3aDTjD+rDd9GsUXA== X-TM-Addin-ProductCode: EMS DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=opensynergy.com; s=TM-DKIM-20210503141657; t=1702677996; bh=D57pOeABfamN98NGLpRroVr6iGToMt3H85oc0X/wUSE=; l=4724; h=From:To:Date; b=mviW8a/ILMUFUiUX4SXEVY7pQb2hpF9WfzofXo7M6w37PkAnjsyT7HaBMuXoILGdY ziLAtJlqdnpgmPhByLqAifsQUUPJoeaWut+ZwdVibtyNsW7W+QGKtic3qVrcvu/NWw fNJNyPeBKnkOkMIX9cUjZjgj0yJWIouJseUjPtvQ9mf6ydt0RWI8MFEZko6++j3YmH BqtSSmpVqM+nUY2P/ogvXsC6AfoEBY4UXuvNhOPAyo2fJtg6KSck8ETG8ykIuZ8r8z BZ34Ew49LojuW7RqxBXzmMuIaHDanS3CRoQ6nMP7+fs6zCKTjpYE+nw3cMQbrDJ450 c+f4IkhQ1tylA== X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785388651956182309 X-GMAIL-MSGID: 1785388651956182309 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 Fri Dec 15 22:06:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Hilber X-Patchwork-Id: 179605 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp9613489dys; Fri, 15 Dec 2023 14:22:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IHpYp7TOavjUgqerzxeNZUQwFSbZCjdsXujc2eEYc8dhKa38Z5j8+hmRBN1ApWETZtkQL/0 X-Received: by 2002:a05:6358:7f1c:b0:170:efd3:2d03 with SMTP id p28-20020a0563587f1c00b00170efd32d03mr5879850rwn.24.1702678962306; Fri, 15 Dec 2023 14:22:42 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1702678962; cv=pass; d=google.com; s=arc-20160816; b=D2MypVpR0XvdeQAcSOwJAJcSJfciXEyZOV5UiPOxjsRkG0pHxft+vwwgszczwYPyA1 msVUtfzumRxUJjdGa+mKjYQPS7iSZyH/0Y683GaBof6JwjB6Hvy/RGCmOAf8OhOz2Y2g 3oIQ8a1LUy1ZK6c9FvkLZL4aJopxUSlvQqDYNowvVtfkdHqEDB3MI9ApqDFN7NBuw5Sx xG9/bzVdZfPxXB0o/S9L9rSY8bUurpnO9TbZUHgnJzDZZ0ZXAwKmJpK7SB8HqbQMYLX/ UKvFTHWb9nbv0aqs9SV3ptfIeXm2jEICvK8x80NQFEGWW859JiZPBWORX8CTBrut0AC/ LbeA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=dkim-signature:content-transfer-encoding:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :in-reply-to:message-id:date:subject:cc:to:from; bh=3xfDBu0dFrCJ0xgcFfSZVaKqG7Zde6VKWwu8n6eP+A0=; fh=2ZOfY1UPohcHr3RdYtQVaEb65CIC/CCqe9V1ggrRl7U=; b=00cD5BghxpscpUHxsc5sjBxi/cptGBIbsNMUm7VGo2X+/jDYE8xsNDJ83mlhOpvtu1 wLy4r8aOLkWDAYkRWnD71cJ5GKJcyDSCpSRdzZbfBzF8rFbL+y0Rf+/8cBbol59csyBp QCaWjEMeXzpjzRn5jzWFOLDzbQIPSaZzgO1LjcSUx5oB3ehuZlfhTZKhmqKhfDKRYqSG zkxV6zgM2hRR87lkWWlQlPSpLvzrzbzn5YHqSpKBguplPirQOMUW9Z0SVUHdPdMHCJ1S ehbAeLpuupRpz11XcfDWkuzKxm/HhCBKCPvbtsVPb8VcJcjDMxxnFR5Gd5lgYc2m+siO KAFg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@opensynergy.com header.s=TM-DKIM-20210503141657 header.b=VQhIjNaq; arc=pass (i=1 spf=pass spfdomain=opensynergy.com dmarc=pass fromdomain=opensynergy.com); spf=pass (google.com: domain of linux-kernel+bounces-1747-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1747-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=opensynergy.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id l63-20020a638842000000b005c621f72807si13307502pgd.593.2023.12.15.14.22.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 14:22:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-1747-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@opensynergy.com header.s=TM-DKIM-20210503141657 header.b=VQhIjNaq; arc=pass (i=1 spf=pass spfdomain=opensynergy.com dmarc=pass fromdomain=opensynergy.com); spf=pass (google.com: domain of linux-kernel+bounces-1747-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1747-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=opensynergy.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id EFFA728640F for ; Fri, 15 Dec 2023 22:22:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1D8A248CD9; Fri, 15 Dec 2023 22:22:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=opensynergy.com header.i=@opensynergy.com header.b="VQhIjNaq" X-Original-To: linux-kernel@vger.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 4DFF418EB9 for ; Fri, 15 Dec 2023 22:22:08 +0000 (UTC) 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 Received: from 104.47.7.168_.trendmicro.com (unknown [172.21.10.226]) by refb02.tmes.trendmicro.eu (Postfix) with ESMTPS id 466B310A4FCFB for ; Fri, 15 Dec 2023 22:06:45 +0000 (UTC) Received: from 104.47.7.168_.trendmicro.com (unknown [172.21.190.17]) by repost01.tmes.trendmicro.eu (Postfix) with SMTP id DD6FA1000006D; Fri, 15 Dec 2023 22:06:37 +0000 (UTC) X-TM-MAIL-RECEIVED-TIME: 1702677996.868000 X-TM-MAIL-UUID: b9911cce-9f2e-442c-be80-281553fba8e2 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 D4032100010AC; Fri, 15 Dec 2023 22:06:36 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=B8qwOH0LP0a+2dT6T3bmhN3gwhVzgk7+ijr/YNhHPNVJdrOyaiy9RXTzkf4SIOyafkfrZNBgkGckoWWBbqnK292j+TZj8c2tsRVn7JtaOMm1UmJ1Y1/+Yp37myNVr/H/NjfF58st7C9ZOOH8yjwpPH27b8SRTUZvvDzvz83mhrJkw9lMSBze4ueAU4+YiPvRV+558KX7KPOJtoIezgrnLx+uzTPDckCpryLEKxBcF7Z84IkvGxSzmJ8IsSvoECV2xE8NBhCYX7lix+h0AJGEFI9pC7GnrztssE0N6B9NPUMRC/2FXQ4mpwb3uOaMhEOf7jsEvNTDuHcM5m3E03LMAQ== 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=3xfDBu0dFrCJ0xgcFfSZVaKqG7Zde6VKWwu8n6eP+A0=; b=VhuAcRgFJ75vNoJvAKShPJcMGf4OUw5MhzHILcJNxST5RlaHilsg5tX25tI3kz7OdgdA/ey27WbTTajM39Q60gDzM+XKe4ysJEoSzMrzeacGPV5MapGhl2CqOqQcsN1tk9TWo866L9Fh11O1mvlra2Q4bG+lFqzxM3Ye2tWzQthLLnoakD51bzYVhM2HgC9h2uILF4n+KUkBxLtUtCSopTKZv66Rk+/cVWTeS6XdkWx08GYF/cNK24ddG3juH+NulDwACf81gQfaO/rDDvyeZEhz5xUnbHb8DwWJasUShRmG8zYYAHdc5TlcG8+KaezmEVWOFqOceRMDONTeFfrLbw== 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, andriy.shevchenko@linux.intel.com, "Dong, Eddie" , "Hall, Christopher S" , 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: [RFC PATCH v2 5/7] timekeeping: Evaluate system_counterval_t.cs_id instead of .cs Date: Fri, 15 Dec 2023 23:06:10 +0100 Message-Id: <20231215220612.173603-6-peter.hilber@opensynergy.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231215220612.173603-1-peter.hilber@opensynergy.com> References: <20231215220612.173603-1-peter.hilber@opensynergy.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB8EUR05FT060:EE_|FRYP281MB2304:EE_ X-MS-Office365-Filtering-Correlation-Id: a451a6e6-48ba-49e3-4948-08dbfdba1a79 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2yeCm6q8s6Z7qAa8lz2S9IEc2ybGg3JzMs0IP/j8nkV8GkVhLIFhlp5+3WG5vkrEJkIQzKWh8VZD1sf/GomE6s6W92D+QIRPAiDXuLKziaLBEeZo7c0We+s8MkWqgb75gqBqhSomdvEbyweEKZq3mBzRD3CefmB8IGDz97eQ7xVXkqXXamnpXt2czIdpZbKXOIsL7VJeKPznVlNeOKVw0gvlHEz1XQqOwrqSsxa1dK0XrXEjJLyHzIozMFFUzhcGj8Wr8mhPZ0RWi0x0wH0IgbZcdGZsM7ihyNoazO2p6pLp3WloCCF7RLY9wgIDuki2WcIpfk6UZRjs3f0tCpGi4xi6qcZgl2pCa3dpWgleelPeHQdd0IROEZ5XkqeOzscxgajStmPtqy92qKwEiCeMjKVKhAXM4QCmKzGBszhymDVV1P5k8aZF+kAZk7upZRoONxawO/H6ISSPeWqpTS+KT1s6yUD5tq4jk/GgtOFEpijNkujz4NjAY6vUDIa4AclHfGbeXuvEXMGTB4JYDVDl6SRpRG7yvk+pA929bq0Ca6sFV00bRLpK+udFelW3gpg14YJiyF3IcqULioU4GohLBI8UCgMo+0Az5+VlJecNdP3y+qcl5eZvrgiHeFB9VdTvUyKmrFN04YZc85Otp1afjjF5qKbn6bl17dR6TWmNsFVtVGF90iIZjfhRfPlsHlJnL8e/lJvoeJMxLUIMPXL4XHkPHqy3DOzXNZ/VigK0gjN8+4nSPjGT5o0uc1NusY//JoxfO4AVkQin81zmmnIjuVhA4OY7z02h6GUAJrm98G4= 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)(346002)(136003)(39840400004)(376002)(230922051799003)(451199024)(82310400011)(64100799003)(186009)(1800799012)(46966006)(36840700001)(47076005)(83380400001)(1076003)(2616005)(336012)(26005)(36860700001)(4326008)(8676002)(8936002)(5660300002)(44832011)(41300700001)(7416002)(2906002)(478600001)(966005)(42186006)(54906003)(70206006)(6916009)(316002)(70586007)(36756003)(81166007)(86362001)(40480700001)(142923001)(36900700001);DIR:OUT;SFP:1102; X-OriginatorOrg: opensynergy.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2023 22:06:35.1864 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a451a6e6-48ba-49e3-4948-08dbfdba1a79 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: DB8EUR05FT060.eop-eur05.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: FRYP281MB2304 X-TM-AS-ERS: 104.47.7.168-0.0.0.0 X-TMASE-Version: StarCloud-1.3-9.1.1015-28060.002 X-TMASE-Result: 10--4.043200-4.000000 X-TMASE-MatchedRID: xPvPRJicGCRt/9ulvM0QMd/Z7q+hZQVe6wJlKkXfZVkJ5yiKyAQmigHW HoYGrPh+C2QDPheido9iBl6ePEpdZVlsdSBrk49aju2XlcEx9HRelLFkoMPMWOI/qZVAgf06Vif 9o7rSV9vm9Tc/GgfFJwFtWueZlMH0t5KZ74QYwoxVSWOKG8Va/NVTzaAe7ACyygHdGJDPWm8TJ/ T+Ssc4ZVqoLahcwH4L6xA0Ava73nAPm15xyht8lXx2eIlQG1sMfC4IwOLvyucC4DhlAS07elo7G mCOJYd1ifGCYEa4FxdKYLa8+Kx/sN9Plhio5fnckALaj3suKW4400aIRT5JuQ== X-TMASE-XGENCLOUD: 433c05aa-ddf0-45d7-a0fb-c0f2b7ea777d-0-0-200-0 X-TM-Deliver-Signature: 9B5D122645748B5C3E68F7F255BE5457 X-TM-Addin-Auth: 2Smz6PIzA9aWRECSpKU3IMaFQ3QOtnjDu2p5JyMRuNABGs+ROowudK4OXIe mMg35X9gkMVwq7D+cdMcXWf17+Dc+qsWdb218EtH9aFnGw5XL4Q+NmLZUUpHvrYTyd52WOL3ct2 W/Iuz6pgKNwO+Zqbco/oI3/L0Ag+X9dkjG/x+TPr1ip+DNSygfhciGQh/LRQlsIoUYPzbmrtKBh bgmsSRT/cpzBnNS5IMNw1Lx2TTRaNvwVt5G+24zw+Gc0124B3ziP5gEPgbM5wsBU/9qoenl26zF A4iBRczYOJnppZ0=.c8JYJCjKerTdVa17JXNbgHeu7f94N8OFSitIG/uqQ0A4v1ichTrzYxvAx8 +XDyXVUYIvRF+HvTjmYpyQoePsMA4B+1S97F9ymPmlHHLygQtF47iYFNLHlc90CD9KRFHwFD4pR OIDca6uvXDf3mY19dajip1e4Jyn/8EZFAypG798RWxDcL7tWzE96KzFSOYyhy6ZAunUR9MDsvDp rrN/H8ywFWSzN1gzeaK/EV02GIpujAgIWiCb/VEsak9ipSoGJ3Gygul3nsWQYZJKlksc2pgxFNE WN8yDRQyBZsf/+gE7beefSLAeHzXfPsaNtytcPHH0zTBJzmJ2h3eqJwYtig== X-TM-Addin-ProductCode: EMS DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=opensynergy.com; s=TM-DKIM-20210503141657; t=1702677997; bh=NojOs1qfg8jfCnvQpu510s9G5wxEpdRCYhUuXgZyMgM=; l=3420; h=From:To:Date; b=VQhIjNaqWzDConf6m33bHny6T8JEUmz/xXKoo28/UItFI3emjHtLfee5RxKqbhpbR 9JNrSoxG6DUxm/pLxYfHUHgWCG7ib6HyY/yvK6slMXN+EdfTcVpPX8oMjv1j+DSMEV JLzD2OewqgJWBP+KswLFp4OQtI8a16PVZd/+d2L8tODvF826LEg6kgu7+VOyggTQ3I DS8zEvP11DlvzYYyM+C+5L7+9B+fqBF3J5o2Tv3a5zi1Lz45daA6bLavB8h6Zsfl/x 5AnO+q0H5V7D8yljYj1kQv7cDKfDU0tAum/EE1PN/rLOZQD92Cev/R2dbPIXdfoO9s ROQDNI6ceCzSg== X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785388295572134989 X-GMAIL-MSGID: 1785388295572134989 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/20230818012014.212155-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 74dc7c8b036f..75e957171bd5 100644 --- a/include/linux/timekeeping.h +++ b/include/linux/timekeeping.h @@ -267,13 +267,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 Fri Dec 15 22:06:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Hilber X-Patchwork-Id: 179617 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp9616491dys; Fri, 15 Dec 2023 14:30:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IFlAoXY4LzNBnq1+Gc/ycSqzN2IMFiDFtfSXAdVBHuUFt/Rajxbs2emTJ2PspNVzrh2+Ie5 X-Received: by 2002:a17:902:c406:b0:1d0:9416:efec with SMTP id k6-20020a170902c40600b001d09416efecmr8694183plk.74.1702679408090; Fri, 15 Dec 2023 14:30:08 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1702679408; cv=pass; d=google.com; s=arc-20160816; b=pq+u6ztDD8PIP/HqAQgprDff6PKYQAgrMFgvT30c7XLN/+ntEyMHMa1b7kF+PUvdKy J/Yov/1eNPaH9ebDcGvDqQb3rgpIjk08BQPr/zIveTuISWRildaNwgZ4x+YR/pXyCxrs gh/b1f4fu1c4Krn/iNXCiNBwHNBakxyl1jEBL4S8pQyFDBwyK3yULfizrGvnVTTOPmex /S+O6NLYVANWAXmVuPMTgfWq/oiTaHKoqb876JZ/qfhcF4vb+3C7/K9w+qg/sx8wGZiR hu/CyMwKM+CF6eIJ8Arq2ut+nsW/+XbPXdteMHkzJh65vULsAG1z1CG503PywpMLX9lO 5ehw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=dkim-signature:content-transfer-encoding:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :in-reply-to:message-id:date:subject:cc:to:from; bh=jxIjbTGYUvyiFb0/gfdolPN9p2YMcYlaQ7cCg+6BRCM=; fh=2ZOfY1UPohcHr3RdYtQVaEb65CIC/CCqe9V1ggrRl7U=; b=jAfhRV0C7XeWz/qcNiZIvndLboFmaUtzlPLGFxw1UiHjZOyKqQCM4nx/XZuZwmuQu4 kEhWNc8pSeYbxdJeIpDjgRE2RDpBDxdOdpUka6SPozxQcEJnENuwfU76ujuE2GUCzqaK /+lrhshh5Jgxp/ODSnKyQHCMdsd5tVpbmJyN/5xmzvZGz1OWrE1LHtIfX5apeFrDI2wF vcIyZxvC/q/t0Atx2yJ5III3Z+gDaHxPxm51HEAc2IikWe36J09a9fV0/2nWTW7l4cmk B8c5VYl7zIF7uyu/rGjB55DQ+3rndTs5gUctbvT21wiuh4qT4fBfTfzZTJOm6B05RNPJ Lo9g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@opensynergy.com header.s=TM-DKIM-20210503141657 header.b=EAEuIw9o; arc=pass (i=1 spf=pass spfdomain=opensynergy.com dmarc=pass fromdomain=opensynergy.com); spf=pass (google.com: domain of linux-kernel+bounces-1748-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1748-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=opensynergy.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id t9-20020a170902e84900b001d09711b7b7si13871697plg.334.2023.12.15.14.30.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 14:30:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-1748-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@opensynergy.com header.s=TM-DKIM-20210503141657 header.b=EAEuIw9o; arc=pass (i=1 spf=pass spfdomain=opensynergy.com dmarc=pass fromdomain=opensynergy.com); spf=pass (google.com: domain of linux-kernel+bounces-1748-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1748-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=opensynergy.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id E4DDFB25723 for ; Fri, 15 Dec 2023 22:22:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7EA3449F69; Fri, 15 Dec 2023 22:22:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=opensynergy.com header.i=@opensynergy.com header.b="EAEuIw9o" X-Original-To: linux-kernel@vger.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 4DFBD18EB8 for ; Fri, 15 Dec 2023 22:22:08 +0000 (UTC) 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 Received: from 104.47.11.169_.trendmicro.com (unknown [172.21.10.134]) by refb02.tmes.trendmicro.eu (Postfix) with ESMTPS id 483FB10A4FD07 for ; Fri, 15 Dec 2023 22:06:46 +0000 (UTC) Received: from 104.47.11.169_.trendmicro.com (unknown [172.21.199.136]) by repost01.tmes.trendmicro.eu (Postfix) with SMTP id 5AC5510001FCD; Fri, 15 Dec 2023 22:06:39 +0000 (UTC) X-TM-MAIL-RECEIVED-TIME: 1702677998.434000 X-TM-MAIL-UUID: 380a2162-0f97-44b7-bd2a-c04e49365528 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 6A2FD1000333E; Fri, 15 Dec 2023 22:06:38 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AAUNQT1zw7RsVAN+nof2ecsdmsI8RXb2jE1Gx234PtrcSPMr8SIsvG9DFbCdvaqibaVwzO0rMBnTvyWnWdEEIDTcw6pyHEnbJHp/4CGLPuNdX3VoQsd175qS7sQSZpeAoFHKr2PyJEWZfCZcrX6x9v8CltM1I+UJo5KBEEi9/3mstvmdQcitqsDMFx2qPZkiIRAGXxYgoxvdWpNcQEToOGd2fSA2iLKM2gWqmG0OoqixQ3xqnen3eBCaU6XRh5AqVTS5OWmslnIZcRpUYY+Lpl+DqZeBUCGGB2MASzFa6zt+qSHbM3U4J2tFwFn91TQUdGVA8aKduSGw2e5JjN6rOw== 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=jxIjbTGYUvyiFb0/gfdolPN9p2YMcYlaQ7cCg+6BRCM=; b=Vm1/4PrZXlRyj/hL/DUlxW/yYsRCZ8JyRplBzopBZMfYGnkQ6LH3wDQYG73m/knI+ydc8LXcxdpG11nLxPDHQ423NDGeg9mACQdR4LWSRYQ+1nIw/0RIOjOJZCuGzAKtoxTPJtEXVuLsu4QJD7y7YAauX3d7VUYljGz5sp2Jue8WCYVQ17r9hmxcgoyQSmj8jwkK/BCkD8A8aYFGOtT9kZI60qpIPzRFNm5puR1qI6O+b+K82Ui2jDhotLk5IWmn2KQfPP0WNGCjd6cb4u4PD5VJci7RywfguxJDV3u7lDNKAZG8vmwRr8MkmpEpnDMcu9zhpDdEhVkFJBT1gfKSyQ== 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, andriy.shevchenko@linux.intel.com, "Dong, Eddie" , "Hall, Christopher S" , 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: [RFC PATCH v2 6/7] treewide: Remove system_counterval_t.cs, which is never read Date: Fri, 15 Dec 2023 23:06:11 +0100 Message-Id: <20231215220612.173603-7-peter.hilber@opensynergy.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231215220612.173603-1-peter.hilber@opensynergy.com> References: <20231215220612.173603-1-peter.hilber@opensynergy.com> Precedence: bulk X-Mailing-List: linux-kernel@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_|BEZP281MB2565:EE_ X-MS-Office365-Filtering-Correlation-Id: 0f050ba9-8f21-4237-9841-08dbfdba1b07 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KZg1rM4Xi3aH+KMY3YAypfhSkB0OqvflvVb+V2gL79jodI2XWMukEK4fipK/Xy9TuFbyp4VDHNP+2TNSTHCax3DS+BOZhsKibFlUuoaflChFWchs44ceTAFVFuqvRQSyLNp0fuldFwQORa6hl1liLH320aI7TwKS+t7uicRx8SBlUbM87gv8fVfTO1k+8z8c4c7/7zIW1UIxKs0DZiLS8hh+PaHzz5qYmcZoJCxxDjuQTGsSg1utsmGtrXNCCFWI1eFUYxfKyRBAQb2H2UE0yMoU4HoePSsBWB38+T2vXkYPdA7cbj+VTfpkegaONQ7BetNTNh/9GkLhyE7OEY41FNiDnjk8l4TaH6tNVbbFoV2pi3XDDA9wwM31F3sb4P9vnGNfhf8bEbUZ+zHt2GxjKi87xmO2EdQkaPaN6NAU5rYSnHNqtiheVfqknOapu0DfBPWR/N985PeCjVsYgvCqdlIRhxBRR/WKn2fuPwCAENZR1RrC/dhe7NkXj6OoOGV/l2dBrxC22biCJ51oVft938mvTjH7ta6IGE8IPG4G6dXfxYJ0Lvq16G+3K0SQmrbb5aG3islSUg/ZS5BqtJSAHZogKXqy3W0SfmxpAWhXDrepn7q8kiOb9+Ypo11MmHqNAPaHJeSO9GBuH5Q9CoOYHy/VR4kb2UoELjIm6DPkbcAYzHklDtPPYOUPE9ptL1A/Ps88Cm9NPLmjQ6wuaVThPKKij8TPIQRClFu/IzTnoRAZafVPlwNTwIsPN864wWk5tkJ8T6uLxA4TIvd/IM4WNS0uNC8RXHG5JRnLSmqP0UY= 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)(376002)(346002)(396003)(136003)(39840400004)(230922051799003)(64100799003)(82310400011)(451199024)(1800799012)(186009)(36840700001)(46966006)(26005)(336012)(2616005)(1076003)(83380400001)(478600001)(44832011)(40480700001)(5660300002)(41300700001)(8936002)(8676002)(4326008)(86362001)(47076005)(36860700001)(36756003)(2906002)(7416002)(81166007)(6916009)(70586007)(70206006)(54906003)(316002)(42186006)(36900700001);DIR:OUT;SFP:1102; X-OriginatorOrg: opensynergy.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2023 22:06:36.1346 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0f050ba9-8f21-4237-9841-08dbfdba1b07 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: BEZP281MB2565 X-TM-AS-ERS: 104.47.11.169-0.0.0.0 X-TMASE-Version: StarCloud-1.3-9.1.1015-28060.002 X-TMASE-Result: 10-0.836900-4.000000 X-TMASE-MatchedRID: 2GwetqJOyZxrxBLbo6y0d4ruruLIWfnxgz5VmKZ8x85rIVA3IGfCC6DE DQa+uiKUfxo+wwDBGZpKfWS2EzGP5o/GIRjw2D78dArStA4IAF7scFLCzRtoVlQxWbscxchmnR4 nzBni1yUsCE8eCr9Fv/h6QguGwzP2odZPcBheFfPFPyeOO7dH/hqqRtM3sdE1t1CSfPp/+EVQx/ v29rIvkA26KZiyWHITa01Q0aXW7NFyiIBweSEVUnzV+KRRiDItcnxszfxH2Ckmx8kl1Wnd+q+eC SMeOiOkfZ9uentPYeaJcb4M4L3rfi1QF7giu85XOwBXM346/+yvkC0mxvBJfxrHZI5RLnIFAYOW D5xf/BeZ8t8OMKF/JZdgeE57XjFe X-TMASE-XGENCLOUD: 83b42042-85a5-9e61-a95c-102c20ead691-0-0-200-0 X-TM-Deliver-Signature: C38C6D983C320C4080E8007E1137FCAA X-TM-Addin-Auth: EEWhv+5llAm4/fbOKmJ61TMy2JOkDZQeoJhddwCqTDcZ0lL/XKMgAWTFJYw ieGO2TOmwFDveJjktUd+YFzcexEOysLp6b6uYh3vNXlPQOep4i4D/MIdzgQpu9IwuHynUAyQshq 5xU2QoxNWwXBBRys0cLiLTOPveC9HBJkL9Bbzl9wRlVqBbahHVtF74WNzwAJzmHpNfriVrPiXeg j5Vly4GyRrxw+b7OpyTCi/wdOL+6iTGpAz0bGw7TYeHDuLJG+ZJCygPlzo87OOv5bpWp0t4CptS ix9MXewHEtidU0w=.EpTjqq6jbicBovuIo5mU+mx/DOpcnWbkLDKy9lMFvEQ7lGGx0ygISGnBK8 qTSXgLfTicHPxmu4C17/JugbusZH2aV23OKlc7S8T0Xvn5U6USAP3jXYEo/SaXh8Riw5me7cTNz vwM0GtDuY9Z7BmgyXo3O/rbDwR0lCrH34NKFz2Jj6CFxpuDxEDeA22bcrLrRUOtG5Rtx+pc+/IN vt2LhvwACYRPPDoVXLf9nJf1RmBrfHcqsihAteH4UihFXIj6uNR4sLvD3350CXslfTPOAo7CLd2 zsWXZYAj2hDdNrr/v/yFT3g1XHSdq4WvCVvfgvF9yOF40HF6E+CAEsumbQQ== X-TM-Addin-ProductCode: EMS DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=opensynergy.com; s=TM-DKIM-20210503141657; t=1702677999; bh=BQ1ird3OIQSstOkL5D7Q4WuNIDqcJanL9DnLpx2+/qU=; l=7223; h=From:To:Date; b=EAEuIw9oOAURhR6HeGmUoB+cn7XiUKke8eOP0/T0Hfs1nyuDStqPxPyYz08F4pGb0 uHuK4KGEwaaQYvooRWN2UaEfKSWs4sbnddRD/FQO7TZIJ31HrfSkxdQJbk7f65e8d6 5vZjRTzWAZYrWBvfnVj55EH7wNwbB0ttJmP8zuJ/kQMQWajhEe1ww+ItX3VlP48qLe mA0lV55y1HfA5W+/wmLBbKIQY+xUcNaRovOkrAGJkoGUOeuaga+Zu+xMz6KxwjPhi0 JUJN1H8xkzni6Hl3BQyecff9NoW6V6fPZ+lmGim8R2whRP7PlceNTI5vZwj0XzkvND rcosdNEMMeseQ== X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785388762646980556 X-GMAIL-MSGID: 1785388762646980556 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 | 14 ++------------ 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(+), 27 deletions(-) diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c index 9367174f7920..868f09966b0f 100644 --- a/arch/x86/kernel/tsc.c +++ b/arch/x86/kernel/tsc.c @@ -54,7 +54,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 { @@ -1314,7 +1313,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 }; @@ -1337,9 +1335,6 @@ EXPORT_SYMBOL(convert_art_to_tsc); * 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 comparability of two cycle - * values. * @cs_id: Clocksource ID corresponding to system counter value. * Used by timekeeping code to verify comparability of two * cycle values. @@ -1358,7 +1353,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 }; @@ -1467,10 +1461,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); @@ -1495,10 +1487,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 75e957171bd5..0f00f382bb5d 100644 --- a/include/linux/timekeeping.h +++ b/include/linux/timekeeping.h @@ -270,8 +270,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 @@ -279,7 +277,6 @@ struct system_device_crosststamp { */ struct system_counterval_t { u64 cycles; - struct clocksource *cs; enum clocksource_ids cs_id; }; From patchwork Fri Dec 15 22:06:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Hilber X-Patchwork-Id: 179597 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp9608314dys; Fri, 15 Dec 2023 14:11:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IFXRQJxYDpRj5w6CqWVe+Go8yUxaM/IhLW9CdL68OKZMUdFy20o3CtXQpKxCSkFGRIIqnI+ X-Received: by 2002:aa7:d511:0:b0:552:6b9b:b9ae with SMTP id y17-20020aa7d511000000b005526b9bb9aemr3166966edq.21.1702678318277; Fri, 15 Dec 2023 14:11:58 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1702678318; cv=pass; d=google.com; s=arc-20160816; b=gfjAB1EWvWaZvp4pLmSeAo+lJwJtz9l7/JnYHuLLrAyUyq3DURt9ZSVVcJsJ40/50c dZz7rf0ATN4ewpRIJ/Ym0Nv7cw323D25tWKTHYIHWe4uqm29o2Pn6qm6PBz5nMuYraj1 W3CmGNdAoFDozodECAVstv0wX9nX3ZvRHngnYtTREVnvZz/OLPHa3ixvgEwO9x9lj0f7 a8muNa0P4BpUfopTa9MFGN5wlKr9QwDq+c8FUcXBv7rWIem2bPnqLA6/1sCUdMYEhdmT Yr/5l8dJLfq8ENQmv/Er2S0yD1A5uINu5Ul1xq0eP2VBFsPdhjLW8WnbN1SfzPqCCzUx Re9Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=dkim-signature:content-transfer-encoding:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :in-reply-to:message-id:date:subject:cc:to:from; bh=8igrOwD5gdm1nUNms67uxinoVx8SWxrYCVAZOEIjgAU=; fh=/cn+e5IASEkptmcs3w8RuKlSFgqeb9LhpePaFBhn/QI=; b=mIQQIJYmo7VfOIX+ybj/oEiwI4OQ7kcKCZCQuiEe/njM0avFn1xZri4IERB9PI1ObQ NzyiWYs4Pj7lrwHLcSJFKmR0F5gg2zeFlJ0Nme7IR/FImuDMasAlFohECSOn0ZH+w+dt xfgKot0kGP0tC3o2jlb5r1JI3owdIjgpYzqjzRGVTzXeqduUTtkRHAmQ08To6hxVUArL uLiXuSgxcB62CZm6ePYe1xdRsatnQ3fao0mHfJW/Xd6Bc62X/MOnMdgL5GZ2baRcmMAQ IfQQJGDou3/j/hjBmGkEcjYjN5zAKy4xzltQ1P6Hqwdi9UVDYdMH5Y0fBsrXsKIev0Oe VBhQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@opensynergy.com header.s=TM-DKIM-20210503141657 header.b=r+mwdqB4; arc=pass (i=1 spf=pass spfdomain=opensynergy.com dmarc=pass fromdomain=opensynergy.com); spf=pass (google.com: domain of linux-kernel+bounces-1731-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1731-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=opensynergy.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id de24-20020a056402309800b00552f8860647si101377edb.552.2023.12.15.14.11.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 14:11:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-1731-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@opensynergy.com header.s=TM-DKIM-20210503141657 header.b=r+mwdqB4; arc=pass (i=1 spf=pass spfdomain=opensynergy.com dmarc=pass fromdomain=opensynergy.com); spf=pass (google.com: domain of linux-kernel+bounces-1731-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1731-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=opensynergy.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id B54491F21488 for ; Fri, 15 Dec 2023 22:11:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 80A725F845; Fri, 15 Dec 2023 22:08:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=opensynergy.com header.i=@opensynergy.com header.b="r+mwdqB4" X-Original-To: linux-kernel@vger.kernel.org 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 ED10318EBC for ; Fri, 15 Dec 2023 22:08:44 +0000 (UTC) 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 Received: from 104.47.7.169_.trendmicro.com (unknown [172.21.19.72]) by refb01.tmes.trendmicro.eu (Postfix) with ESMTPS id 5E515108D954E; Fri, 15 Dec 2023 22:06:47 +0000 (UTC) Received: from 104.47.7.169_.trendmicro.com (unknown [172.21.165.80]) by repost01.tmes.trendmicro.eu (Postfix) with SMTP id 7D169100004DC; Fri, 15 Dec 2023 22:06:40 +0000 (UTC) X-TM-MAIL-RECEIVED-TIME: 1702677999.039000 X-TM-MAIL-UUID: e89fab8d-f901-4680-9eb2-6350fabcb655 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 09B2C1000179A; Fri, 15 Dec 2023 22:06:39 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mN9CBsYr1igp1Q5ecL+5LKNdiZ9a5IljsVGyXe4GaNIIlNgmV2GLsJFhztiLqEmZpNE+YUOs85kzF1wRbFTZdR2ZAVwGc4lKBYRk7EAd3dAimLBdP6Ltbwrq4+ikORJ/+RIxorN4Ac/N2YbLbSYailEhalR+7K/tyd5xtYusPIphP6fxP1GkurkiXfwu1hP09WU4dqDWOcBVjw1LZmO1HQeV3g271oytIbRafzMjyr2sKyJ1zx0TIRXDryoKIHBazY0tKewJygqX+M3fGZGWdf99yFya12qL++y6VSGJ9ZLK3RE1V9tMwBMnRIi76BDQIpYLLrn9ZBOzyy5BTBIIdg== 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=8igrOwD5gdm1nUNms67uxinoVx8SWxrYCVAZOEIjgAU=; b=dcy5hbOQkcbH16D0561GyGY2u+Xdt7xLRzJpx3giZWd5QHkM+QQ0JzltehGZm3OviFqmyounFEkVgSd//yqo0CItvLnclb5zXcLZfGrz0EQB5ET2V4de8zHVvrr01FMxUZCBN852Q8FZm4a/mg09pzW+pQe4A4oSFfZCchi5qVwaF5YYzHe33lwszGQt0aFTpkD5x+xzXtIZdKEnKFPnzcu/7Lud3Irin5HwMIuFj2a3Ut9z9f8EZTG2jRne9P/SRznbKypm2Th834WCty+cKogcUnCOob4h/yuzykDrj7VAYVSPczThsAGkCT0QQjceA+FcVoj2D6WwCvnSS5pa2g== 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, andriy.shevchenko@linux.intel.com, "Dong, Eddie" , "Hall, Christopher S" , 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: [RFC PATCH v2 7/7] kvmclock: Unexport kvmclock clocksource Date: Fri, 15 Dec 2023 23:06:12 +0100 Message-Id: <20231215220612.173603-8-peter.hilber@opensynergy.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231215220612.173603-1-peter.hilber@opensynergy.com> References: <20231215220612.173603-1-peter.hilber@opensynergy.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB8EUR05FT061:EE_|FR2P281MB1733:EE_ X-MS-Office365-Filtering-Correlation-Id: 0d53975a-360b-442a-0e6e-08dbfdba1b72 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kygg9/BQQbOtJaKlA8sRe5x3+SnVFB+qyEhStITrXPHNIJNYXpDuCc94uJUe08Wug+LbMdQdyxbzvNodGlBU/OAiUH7FRcPIwufE45LFq2hChSLbE0qAGh8wL5un/YSyp8Tf/T5j9qX/GmB9BPMR3b3r1Id4fxLZNcIbm19nAgMN828qMS2gg0NvTuItQbdqQeGQXN2pbU7wqYasVHSHk0Zmj0zZV49ibF+XR3zBUNhC4CO3nt5njksHkRHjmV70MHZkuFWtZmmdmbLZqWLnetgdvdJYj7utoK+YlNFAeO/DH5cLpYBGUMFiElnC1Fkewjlzq7ecooZzXpYNmH+E9uCqcNdBfkzuBHriySq6m2s0CiXWAkteDx1Je3ModAl6aPWUiAqWXSW54uBBNrurScnrHdeu2M4SoksSIgWwa171M3AFHPiH8DlgmIRrQ6K0fKUGLSYiEyGz0Jc8mB1CgzLAaob+CscBHxLx7ZDtPAJw0U4+4k8GrMY5bm1bZ/kCPhK/qICV03AbaXb93h3hhkY5XVPIpKNYIldqQxktltaLVIT4mXdMU0ArXggnd+wLhHn/dXsHiJuMoCaH4f47j/bmNDZwP1zyx0vFubzlvJ9u1yzEOkzgBPbdH/YfM30S53Ug/q0CQJXBqwk6dnOjKvtGckwz6MJJdL6OTKkT75yMY1/58dpJqmF1gAZiKynL9PAqMYW9KJlMK0PjXyOmEP3RS8U3gH2pF8CoTKlEeF0VTSvjjHeY6cn4pqYOMfC6oFbGJx9aYbMkJ/vY9fkCm0HHJaPWznPrkoyDptE3nSM= 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)(346002)(136003)(376002)(39830400003)(230922051799003)(451199024)(82310400011)(64100799003)(186009)(1800799012)(46966006)(36840700001)(47076005)(83380400001)(1076003)(2616005)(336012)(26005)(36860700001)(4326008)(8676002)(8936002)(5660300002)(44832011)(41300700001)(7416002)(2906002)(478600001)(42186006)(54906003)(70206006)(6916009)(316002)(70586007)(36756003)(81166007)(86362001)(40480700001)(36900700001);DIR:OUT;SFP:1102; X-OriginatorOrg: opensynergy.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2023 22:06:36.8323 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0d53975a-360b-442a-0e6e-08dbfdba1b72 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: DB8EUR05FT061.eop-eur05.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: FR2P281MB1733 X-TM-AS-ERS: 104.47.7.169-0.0.0.0 X-TMASE-Version: StarCloud-1.3-9.1.1015-28060.002 X-TMASE-Result: 10--1.575700-4.000000 X-TMASE-MatchedRID: BoYRaA2j95x5JK6VZ/y/JZIdC0Q5JDAc3O2+pOfl+vcwLJ9PZUBQhdqK Kei3fK/BwLkzWLqYXGIPTxis+8SzNY5D3dtciD32DnyoB5C0LDMhB2S/EqeA6zB4jJltGVDbLN5 wGPX3TPXYeXOEzfM22ez1ZBVjJwp/DeUZOJCXHMgCZpI9UgJMHqJYuGaIjh0/fiAqrjYtFiQxS9 94xGDNKqw9tW5jEvZ438AP4uzP/tN9ZAWWNlw3BX7cGd19dSFd X-TMASE-XGENCLOUD: c5e42938-9243-421a-96da-f6f86875924b-0-0-200-0 X-TM-Deliver-Signature: 2C4C557BE2D73A0C7566D672411B7F6A X-TM-Addin-Auth: c3PzKypaMfdlFzSvm1CTlzQhM7QWSsUjNbvDp+1029UD6iRC9gqXd1TlEtE uEg32fULegaxi7y4PjHdqNMzFAw7Ux6XfGQKsa/qb0+CY9LfLa3oQ6bJJggMKnmemJfVy0fbYrB Z1+U5fkL6zz5YqrGNsZx2kvPMT3gaV1kytMkUNgZd9A1kYq+svYDgye/y1vyqsZI7Q0p71oF+T1 Zfgxc0sWMT5bCMjCJTD2kCxRMpLCTpIaWLRSjKYo9bsHLyW+zSz4IrD0KQ3P0JDBF5RtrwpVdHD 4ZbrjBwX5zS8AHE=.1kwie91cxv0TfL2bi29pDFdm5YUQkJhesAriKE+DNolxR58P5MSNZ1zus8 a0VS2OPRiGy8cafFIrBtQ0vYEum/DbXcf1CBu6Ho5lV/WELG60xLhGGHk3sWT34We5wsRPbO394 mhw3N+M05MhUlYYfr0xZcEfipH9rsc8Nd6nZKSw6BQ7GfskrdxjUmmMbM/HngKU0n1U4m1UFxVc 7xeYVe4SaxnbkXMRkLDm1PTX0f2Ge2s+KFF45og96CoWLDQ29SJsKgvbCQ+GeezUyXXIa+EOM/X lIIIa42/jxniwVE+mRAVyT8vLEdV32Z7RNLJpUVQYMV1QtUmUGyn59HJcQg== X-TM-Addin-ProductCode: EMS DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=opensynergy.com; s=TM-DKIM-20210503141657; t=1702678000; bh=IpcNBYNAwG6Ko4w5APrpa6SbF+s2i99WUAExpUxxx5s=; l=1567; h=From:To:Date; b=r+mwdqB48AOofF6R/gA5tImU3XQKaFH8R3Bk1c6Bbo718GiPES5Kp5aCSLYNqPKws zFHHeQAU8hu9kY/eRSGQkSBob4s+hMULieqXKEusUbn4n07H3RCNtltQ9Nu+n5oeGw GhiHfmVPJkkNwN1HGFORnWMa9zmAPFvbd+Tt/+pmjehC9ow+bZOQGbp3v925Swn7XP nYRK9aym/gsqOakPL/ufU+600SpFGOuMj3e7WQl6gUvLSON9tDu4VQc4YQj11a47Ew dJD27K6ZjOG0wzKmrPe7qEKmNBjCBjPw+NDYVAJYvgfVVtWdvOCY+qbqbgszDJnkJ9 Rld+QuLI74yEg== X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785387620379013244 X-GMAIL-MSGID: 1785387620379013244 The KVM PTP driver now refers to the clocksource id CSID_X86_KVM_CLK, so does not need to refer 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 25d6bf743b03..9dfbcd2f4244 100644 --- a/arch/x86/kernel/kvmclock.c +++ b/arch/x86/kernel/kvmclock.c @@ -155,7 +155,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, @@ -164,7 +164,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) {