From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f201.google.com (mail-pg1-f201.google.com [209.85.215.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EF56D4189C5 for ; Wed, 1 Jul 2026 19:32:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782934382; cv=none; b=CSa8HYAoQu5xKDE1Rdw2x40iy2drBhys3vKMB0Byr+jayouDftUIk6uwNr6o3w/NE8CPpk9Urr9IVDttoK04oOa/fcGRVhFD0rn3HQA9AlgEltbV3at6otvZZgO4fM2ZQymvrf7WFzNcnzz8lNSYafqMJeQrItTg8KPb8tL8HUo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782934382; c=relaxed/simple; bh=naebGTX3IOtMBaOZ6Pc/blHlj+HGS0vQ3lqqBbsq1SI=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=FOfvuMB67Ajw/6zd/i693wiASyx3vwH4oE01IlxCsVtc8MWh5FkEX8PCCoJXcOzjpsV0LudeYYF4r+mfHx5FUIbE94NfFCbuDi+gxXhB/REyR0hmMdA31Wyr1uesnxKBLJgyda8X/rJ72WomLaUTto+DOpV6zOTEF/OJpK3Yzoc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=t1v9x+2Y; arc=none smtp.client-ip=209.85.215.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="t1v9x+2Y" Received: by mail-pg1-f201.google.com with SMTP id 41be03b00d2f7-c89704da8c7so1486261a12.0 for ; Wed, 01 Jul 2026 12:32:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1782934378; x=1783539178; darn=lists.linux.dev; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=m4IxRx7fOhcWBmMrJhtIUc/shJhrGyqdre87YRmUR5M=; b=t1v9x+2YZhrr4XrUpn5xLG7k7eUSq5WmzrDdlHhglV3G96Dlxv/vbObyCcIAn9CNsz kkA5E4XZo9GsfEXZWsFcxFKe/2kYkZDYtAOvWvdlKK1bmVaD1HKXiqk6ZoCKb5RUyLvU 7PZr5r8bZvKLzq84zAPe4BuOA0F0Mwv2BltWy0vhUDX/5R5ueVzpojO3LBBGHgU+dW1Q gUgBofTJHpzFZRo5mBRYD3+V10ydXbDcOVNFF3NP1Bhzk7Wso7YdjiIBwwtgO87wKf6t sC/IXlsXi5/cUzffjuCKnVugYOLQcudiB9NqcJ40/ax2lQaOkv7BIBt/mwe6C5hkFpRt nSFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782934378; x=1783539178; h=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; bh=m4IxRx7fOhcWBmMrJhtIUc/shJhrGyqdre87YRmUR5M=; b=XcZpbaQkYorq/CyLW/YrZLuxH/U9TNIS1L+HS6Nx/mOQEZsbX50S1R/60Xv/8pIPXs H5q5NBwpbAX3QtpfKW7J9X+sbfkMo1hl83iFgp0ciGcd65WkHx4DurEhUWG0zutd6i3Q caL5zlm+ApkJ5miO7iQku0xHs+W5lHE3IsOxjXsTDB+kohR1LDbOPx2PkT11yEqXnuVc lCsD2dNNCymXeDdI5W4wTsZtQgpRU1z7E6XVk4kF/uVHKOq9TERn1YLod32Z3krcHnsz Nfw5lWOuzCfp+oQdmXsxNa6S7jRd0oi8WEX14XFxr2kUYrQ4GnVXv4fnZPuRhwnkUEs0 UK1Q== X-Forwarded-Encrypted: i=1; AFNElJ801Ci9wIcqf4ycXyFrckULJlTrUlNnZdwLKhfAEW1V8r8fpVMy3tAXulcMr1IEVx6xfP51KowUmEMy@lists.linux.dev X-Gm-Message-State: AOJu0YyYZegalW9+KnbEov3UWZi1B4wMcyb4ySYHnuhz0xRlIprKgXZc eUqcdBZscACPGFtW+o4GOowAgfwx5ytTukjceV0XQBhCVMRELazwaDaK74nUJWLOeGi1OLu7YVk wia79FA== X-Received: from pgbda6.prod.google.com ([2002:a05:6a02:2386:b0:c99:7baf:126d]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a21:6b01:b0:3b4:931c:3c7c with SMTP id adf61e73a8af0-3bfed50b68fmr3305567637.44.1782934378058; Wed, 01 Jul 2026 12:32:58 -0700 (PDT) Reply-To: Sean Christopherson Date: Wed, 1 Jul 2026 12:31:47 -0700 In-Reply-To: <20260701193212.749551-1-seanjc@google.com> Precedence: bulk X-Mailing-List: linux-coco@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: 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-27-seanjc@google.com> Subject: [PATCH v5 26/51] clocksource: hyper-v: Drop wrappers to sched_clock save/restore helpers 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 Content-Type: text/plain; charset="UTF-8" Now that all of the Hyper-V reference counter sched_clock code is located in a single file, drop the superfluous wrappers for the save/restore flows. No functional change intended. Reviewed-by: Michael Kelley Tested-by: Michael Kelley Acked-by: Wei Liu Signed-off-by: Sean Christopherson --- drivers/clocksource/hyperv_timer.c | 34 +++++------------------------- include/clocksource/hyperv_timer.h | 2 -- 2 files changed, 5 insertions(+), 31 deletions(-) diff --git a/drivers/clocksource/hyperv_timer.c b/drivers/clocksource/hyperv_timer.c index 4293173c3a27..daa8cbfe61ee 100644 --- a/drivers/clocksource/hyperv_timer.c +++ b/drivers/clocksource/hyperv_timer.c @@ -488,17 +488,6 @@ static void resume_hv_clock_tsc(struct clocksource *arg) hv_set_msr(HV_MSR_REFERENCE_TSC, tsc_msr.as_uint64); } -/* - * Called during resume from hibernation, from overridden - * x86_platform.restore_sched_clock_state routine. This is to adjust offsets - * used to calculate time for hv tsc page based sched_clock, to account for - * time spent before hibernation. - */ -void hv_adj_sched_clock_offset(u64 offset) -{ - hv_sched_clock_offset -= offset; -} - #ifdef HAVE_VDSO_CLOCKMODE_HVCLOCK static int hv_cs_enable(struct clocksource *cs) { @@ -565,12 +554,14 @@ static void (*old_restore_sched_clock_state)(void); * based clocksource, proceeds from where it left off during suspend and * it shows correct time for the timestamps of kernel messages after resume. */ -static void save_hv_clock_tsc_state(void) +static void hv_save_sched_clock_state(void) { + old_save_sched_clock_state(); + hv_ref_counter_at_suspend = hv_read_reference_counter(); } -static void restore_hv_clock_tsc_state(void) +static void hv_restore_sched_clock_state(void) { /* * Adjust the offsets used by hv tsc clocksource to @@ -578,23 +569,8 @@ static void restore_hv_clock_tsc_state(void) * adjusted value = reference counter (time) at suspend * - reference counter (time) now. */ - hv_adj_sched_clock_offset(hv_ref_counter_at_suspend - hv_read_reference_counter()); -} -/* - * Functions to override save_sched_clock_state and restore_sched_clock_state - * functions of x86_platform. The Hyper-V clock counter is reset during - * suspend-resume and the offset used to measure time needs to be - * corrected, post resume. - */ -static void hv_save_sched_clock_state(void) -{ - old_save_sched_clock_state(); - save_hv_clock_tsc_state(); -} + hv_sched_clock_offset -= (hv_ref_counter_at_suspend - hv_read_reference_counter()); -static void hv_restore_sched_clock_state(void) -{ - restore_hv_clock_tsc_state(); old_restore_sched_clock_state(); } diff --git a/include/clocksource/hyperv_timer.h b/include/clocksource/hyperv_timer.h index d48dd4176fd3..a4c81a60f53d 100644 --- a/include/clocksource/hyperv_timer.h +++ b/include/clocksource/hyperv_timer.h @@ -38,8 +38,6 @@ extern void hv_remap_tsc_clocksource(void); extern unsigned long hv_get_tsc_pfn(void); extern struct ms_hyperv_tsc_page *hv_get_tsc_page(void); -extern void hv_adj_sched_clock_offset(u64 offset); - static __always_inline bool hv_read_tsc_page_tsc(const struct ms_hyperv_tsc_page *tsc_pg, u64 *cur_tsc, u64 *time) -- 2.55.0.rc0.799.gd6f94ed593-goog