From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f202.google.com (mail-pg1-f202.google.com [209.85.215.202]) (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 45CE04189CD for ; Wed, 1 Jul 2026 19:32:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782934381; cv=none; b=epBH8BlJ2Jr1nvHxtaUdMgsxBQVAcgMNnmL186hkS1ux+1Xh7bTGdeQmgcmsotnXVnOGvT8zVIJxncwTFdoYonXMkWMGriiFjZjtUPpgV+Qd/C4yfWkXCz2yYLBaYEReY7WrUm426NvJQbQk6sX6H/wF4SaNQxlZ2TbU3Cy8StI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782934381; c=relaxed/simple; bh=naebGTX3IOtMBaOZ6Pc/blHlj+HGS0vQ3lqqBbsq1SI=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=XIJnuqiWKYLhM0QAHoLCOEHm8Hq4H92sc91HoprtpI2u7sKa1IdBYLxe5RnN0A8p2dkEZQMtgA7NDjUamAfCm2q08y0+EEuDZ2ckKwJ+fyNrKsKNAIOg2J5pCl8Up3WF9+3t7RO1o24wH2nVQulTyqz+nBJgHlQ/2d9sd+ymvuo= 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=iyNOMycB; arc=none smtp.client-ip=209.85.215.202 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="iyNOMycB" Received: by mail-pg1-f202.google.com with SMTP id 41be03b00d2f7-c88d7a75507so1270576a12.1 for ; Wed, 01 Jul 2026 12:32:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1782934378; x=1783539178; darn=vger.kernel.org; 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=iyNOMycBlszI4a1HIBWK81mhnIwgmiW948lZfDycVv/tm9NA/ZE7mQRjX/SChewDHY 00Comf23hBbSoobQi8e7A+BD+ca13v7vrr5+i4Hwqfx1NSJTZolWOhgOZTG8h4C3NN1C B/PQqiiLJv5tjPXQGEeSqi6HEHe1xUTe3YVdRh5bM+4n9lRvz0hGrJL5t4NrZ1hv9rlr sQ/PSutRmqNLJPxG+RcgkQuQYBU7bSfFBGG949J4tm/Gm6oZhPZ90srLs7+fujh5ZV5i 8G8kAEwl0+nE69jxQMDkkX3pnU+geQyWf8zmggNKQhij8pfF7zavYBEYKk0zr7dOl5EH f7CA== 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=KaiDIBrJKspQ9XD2ZwUsZc02E+YG7+EZsi+Uid/sxBfnkwgKqLrl5YJC4nsgPhhDhE 5+d7sHOsqaV2/CIgXgamaRjDOEe8gTuG5zfSaHz5Bq4JgQ7F8cNPwS2uTESFMXYWrCGz gngfB/mJRQy+tbs/BH+pTBKtrQRlMTO+YmeYysDr2Jm5Awjy1Kcbhm/9M9zFidUEC+FQ qdAqZIgztnLo5nG1HYds1qSxt6e6gvK4WdWuw3W0ai25Im3qAkGWyJdws4E2Yqr7k6Y0 Ah2kRDQlFGfD6kKSsjgU1h3y7hsYfzGHdl3ABA4k5ndllUn+xsodJpmMX6vrXVMJuOr6 vVnw== X-Forwarded-Encrypted: i=1; AFNElJ/WADHuyXrR4z1UZAcMnm7VX0qAN9TR7WMfVUgzoufn3c+Y1AtlUwDKlIGsGfAlT6OLxCGHR7pdIRqp/0U=@vger.kernel.org X-Gm-Message-State: AOJu0YwvN0O2fGYZI6PO3pKW9uGydf3wtk9RBLJxMU3+p3zkF9V38QPi QA3y9ppCMw3nP4aPz/E5+lL70hTi2jF/ySTdzl/CRLEJjMWBWg8THmwrYFMciJq36asmW0ChZuQ 9+huTHg== 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-hyperv@vger.kernel.org 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