From nobody Mon Aug 24 19:02:11 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=google.com ARC-Seal: i=1; a=rsa-sha256; t=1782934461; cv=none; d=zohomail.com; s=zohoarc; b=U3MDbXQGJvBLU1F4XSs0NdaarMRZ1hytTHBNNYxo1JKk6gB9n9iE6WXfYFEPXD1AFgGbjxxr/k9SIcDohGMJRGLN3Sw5uTAO0lmtlKdPUazrtmn4vVGSlLtAFakDK8Ei7LCQqztVme7BUs6Vt9Qn34ij+qfyusL54a6ap5lgXFA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1782934461; h=Content-Type:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=D8RMEeRf8IO60ymrjMFeZrqFOqn/98Ma8JhKdrpIeKM=; b=LX8JFb7ZQosRqXFPmpNDAgi0KOvXiifPrbU12hmS14SmJeHQ5zF3oc5F+RCkJQL+NyGXNajPqEhfZRy8EF2yfPRwReiY0W2K4OR3/rjU6Nb7Io+un1Vgz1YeA2SUDYZaUtp8qjLK+3EDOGKvrWSWH83coR5Iv+IEURHzjjRnrt0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1782934461220929.4036174643019; Wed, 1 Jul 2026 12:34:21 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1350551.1608068 (Exim 4.92) (envelope-from ) id 1wf0hA-0002uw-46; Wed, 01 Jul 2026 19:34:04 +0000 Received: by outflank-mailman (output) from mailman id 1350551.1608068; Wed, 01 Jul 2026 19:34:04 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wf0h9-0002tl-W7; Wed, 01 Jul 2026 19:34:03 +0000 Received: by outflank-mailman (input) for mailman id 1350551; Wed, 01 Jul 2026 19:34:02 +0000 Received: from mx.expurgate.net ([195.190.135.10]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from <3a2tFagYKCbAiUQdZSWeeWbU.SecnUd-TUlUbbYiji.nUdfheZUSj.ehW@flex--seanjc.bounces.google.com>) id 1wf0h8-0002Y4-54 for xen-devel@lists.xenproject.org; Wed, 01 Jul 2026 19:34:02 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1wf0h7-00B44A-IH for xen-devel@lists.xenproject.org; Wed, 01 Jul 2026 21:34:01 +0200 Received: from [10.42.69.10] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from <3a2tFagYKCbAiUQdZSWeeWbU.SecnUd-TUlUbbYiji.nUdfheZUSj.ehW@flex--seanjc.bounces.google.com>) id 6a456b9b-5cb7-0a2a0a5109dd-0a2a450ad372-32 for ; Wed, 01 Jul 2026 21:34:01 +0200 Received: from [209.85.214.202] (helo=mail-pl1-f202.google.com) by tlsNG-4011c0.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from <3a2tFagYKCbAiUQdZSWeeWbU.SecnUd-TUlUbbYiji.nUdfheZUSj.ehW@flex--seanjc.bounces.google.com>) id 6a456b6c-e40e-0a2a450a0019-d155d6caed15-3 for ; Wed, 01 Jul 2026 21:33:01 +0200 Received: by mail-pl1-f202.google.com with SMTP id d9443c01a7336-2c6a20348ceso13515645ad.1 for ; Wed, 01 Jul 2026 12:33:00 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=20251104 header.d=google.com header.i="@google.com" header.h="Content-Type:Cc:To:From:Subject:Message-ID:References:Mime-Version:In-Reply-To:Date:Reply-To" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1782934379; x=1783539179; darn=lists.xenproject.org; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:reply-to:from:to:cc:subject:date:message-id :reply-to:content-type; bh=D8RMEeRf8IO60ymrjMFeZrqFOqn/98Ma8JhKdrpIeKM=; b=TMNivoOfhimJCECmLDLcAOqwk2S7M8O0behC/qBKtXSqXv7ysQc3mfbhAojGDc5rO7 4iMgQkBHinu+GNDXJGf6hSwe45qGOID5CKQlscgk4AaDqlaQ6cOrtRkOflN37DX85RSU mL1Xy7fiRBi/Y7NE7aZtofm5QxWRSmmQ/E7b5f4+g4BJ9/ScbW88igyuvEjp0oEvRqDu L5WyVvZMnBcwpmT4NGyU/xUyYa1N/qW3mLN/XAwJO9tKQNCsNhR3Df8liWtxtwpVMv4S PKMdqKSRq+uhcbCyHaRPQPkKPXiBv68dHqAf1UZJ1pribvuZKldSmLBVcZA7JHtnMRF/ m3xA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782934379; x=1783539179; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:reply-to:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to:content-type; bh=D8RMEeRf8IO60ymrjMFeZrqFOqn/98Ma8JhKdrpIeKM=; b=ZTmxfRsLy0gWTeUvlvGOx1OW9M/ntIxQ8cZfUfrb0SBhU0CYhVRHAjhlorc016xl6D 5EHqjHoctjKOC5GPhN3XZzMOSYhQzPTiZJGTgtHFD7GCS6WgFgA3m9piJld7Yp6hXh+4 nkkmMkQWJOQK2H/e/kFrpgzD4ryysQaGuZzlyKcGDPyBLBvZaqftGs4AAUA6U7m2ZHii Hqx3DzVQI1/GONXBsL8g2dB8jEwyWYkLS9Z1LwKDXaFuIGyDc7okkjK6UvawaSwH8RLu 5bemxdIvcnT/YVj5PURaIlabahO1g9JivU14gS04w5gixiK8Z5NiI+KXHBKSfsDyDuWL HHfg== X-Forwarded-Encrypted: i=1; AHgh+RplLpkp15SioDmyGN/vkaHFGQWEJ6HNtLrfO/9vLn8qwLhPg60jkcmrEAkDRneUQYgBq8TBi+Wbnh0=@lists.xenproject.org X-Gm-Message-State: AOJu0YxiO9od9iNAKoy/gyyudX3xeveCmAdkZU86T1PFRhavpUhLHI4m X73eafca4DSJS8YoY0JgMAmgd/7qqvG7de1a4BOh8JZqJb5Do0YOABj4DNnx6lbgm36++Hs96+N X9RiU2Q== X-Received: from plkp8.prod.google.com ([2002:a17:902:6b88:b0:2c7:ebed:f6e8]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a17:903:3ba4:b0:2c1:ee75:56bb with SMTP id d9443c01a7336-2ca9117aa06mr20678475ad.20.1782934379169; Wed, 01 Jul 2026 12:32:59 -0700 (PDT) Reply-To: Sean Christopherson Date: Wed, 1 Jul 2026 12:31:48 -0700 In-Reply-To: <20260701193212.749551-1-seanjc@google.com> Mime-Version: 1.0 References: <20260701193212.749551-1-seanjc@google.com> X-Mailer: git-send-email 2.55.0.rc0.799.gd6f94ed593-goog Message-ID: <20260701193212.749551-28-seanjc@google.com> Subject: [PATCH v5 27/51] clocksource: hyper-v: Don't save/restore TSC offset when using HV sched_clock From: Sean Christopherson To: Jonathan Corbet , Paolo Bonzini , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, Kiryl Shutsemau , Rick Edgecombe , Sean Christopherson , "K. Y. Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui , Long Li , Ajay Kaher , Alexey Makhalov , Jan Kiszka , Andy Lutomirski , Peter Zijlstra , Juergen Gross , Daniel Lezcano , John Stultz Cc: Shuah Khan , "H. Peter Anvin" , Vitaly Kuznetsov , Broadcom internal kernel review list , Boris Ostrovsky , Stephen Boyd , linux-doc@vger.kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-coco@lists.linux.dev, linux-hyperv@vger.kernel.org, virtualization@lists.linux.dev, xen-devel@lists.xenproject.org, Tom Lendacky , Nikunj A Dadhania , David Woodhouse , David Woodhouse , Michael Kelley , Thomas Gleixner X-purgate-ID: tlsNG-4011c0/1782934381-3C07ADDE-E9F45FBF/13/0 X-purgate-type: clean X-purgate-size: 2767 X-ZohoMail-DKIM: pass (identity @google.com) X-ZM-MESSAGEID: 1782934462596158500 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Now that Hyper-V overrides the sched_clock save/restore hooks if and only sched_clock itself is set to the Hyper-V reference counter, drop the invocation of the "old" save/restore callbacks. When the registration of the PV sched_clock was done separately from overriding the save/restore hooks, it was possible for Hyper-V to clobber the TSC save/restore callbacks without actually switching to the Hyper-V refcounter. Enabling a PV sched_clock is a one-way street, i.e. the kernel will never revert to using TSC for sched_clock, and so there is no need to invoke the TSC save/restore hooks (and if there was, it belongs in common PV code). Reviewed-by: Michael Kelley Tested-by: Michael Kelley Reviewed-by: David Woodhouse Acked-by: Wei Liu Signed-off-by: Sean Christopherson --- drivers/clocksource/hyperv_timer.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/drivers/clocksource/hyperv_timer.c b/drivers/clocksource/hyper= v_timer.c index daa8cbfe61ee..220668207d19 100644 --- a/drivers/clocksource/hyperv_timer.c +++ b/drivers/clocksource/hyperv_timer.c @@ -544,9 +544,6 @@ static __always_inline void hv_setup_sched_clock(void *= sched_clock) #include =20 static u64 hv_ref_counter_at_suspend; -static void (*old_save_sched_clock_state)(void); -static void (*old_restore_sched_clock_state)(void); - /* * Hyper-V clock counter resets during hibernation. Save and restore clock * offset during suspend/resume, while also considering the time passed @@ -556,8 +553,6 @@ static void (*old_restore_sched_clock_state)(void); */ static void hv_save_sched_clock_state(void) { - old_save_sched_clock_state(); - hv_ref_counter_at_suspend =3D hv_read_reference_counter(); } =20 @@ -570,8 +565,6 @@ static void hv_restore_sched_clock_state(void) * - reference counter (time) now. */ hv_sched_clock_offset -=3D (hv_ref_counter_at_suspend - hv_read_reference= _counter()); - - old_restore_sched_clock_state(); } =20 static __always_inline void hv_setup_sched_clock(void *sched_clock) @@ -579,10 +572,7 @@ static __always_inline void hv_setup_sched_clock(void = *sched_clock) /* We're on x86/x64 *and* using PV ops */ paravirt_set_sched_clock(sched_clock); =20 - old_save_sched_clock_state =3D x86_platform.save_sched_clock_state; x86_platform.save_sched_clock_state =3D hv_save_sched_clock_state; - - old_restore_sched_clock_state =3D x86_platform.restore_sched_clock_state; x86_platform.restore_sched_clock_state =3D hv_restore_sched_clock_state; } #else /* !CONFIG_GENERIC_SCHED_CLOCK && !CONFIG_PARAVIRT */ --=20 2.55.0.rc0.799.gd6f94ed593-goog