From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f199.google.com (mail-pg1-f199.google.com [209.85.215.199]) (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 BAB464A433B for ; Thu, 6 Aug 2026 23:36:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.199 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786059420; cv=none; b=KBxKU9Gudqu81iePIXdTuw6gWfJwUCgyGvkfhbHO6Yiv2gTTy5U2UicscGlOI7lay9YZ7ddoei7ONQf0w7sgwdqpK0JhbXH1I6j0pX4Qe+KLjM1c8K0FC7laMOlfc1yKG6SuQo2BcTBqRiop2TFmGrLaIWNZV18gXnFZ/4r9oL4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786059420; c=relaxed/simple; bh=9DAIjDH1F2HoJUEVpdMLcADO0LnHG+NJf0QuZz8Bg8c=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=i2iJxusTEX737VjLCclfWgyWJdCrN8QOzy5JrUlpFTxWuC9K+UzMnZBEtHekjs8bueuFYfDjHomW2gfVH3PHferjtsvk0/k/7TRcUR1EaGWb79IZB4sahPgEVFZkq1EAILETSNa7e5DJgO+Oyix1h3py9e2V1XMwiqTUNgWkFrE= 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=YSIjCUzp; arc=none smtp.client-ip=209.85.215.199 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="YSIjCUzp" Received: by mail-pg1-f199.google.com with SMTP id 41be03b00d2f7-c9fe4c5eb39so2012281a12.1 for ; Thu, 06 Aug 2026 16:36:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1786059417; x=1786664217; darn=vger.kernel.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=mGO2RWCI+1OC1QgQlwRZRpcTYMYFszJFieAT3RQjORg=; b=YSIjCUzpIj6KrkOh58ZIjgHX2VQ9aHKIaEq4q3rJpZAPwdTOgqP8pUBsHp5oJ8J5Td sb0/7nK5SVE3sEmphEixRA9cIkXC9HLtPd+6qM2St95q3bai98baz54O3nuv5goX7iyJ gC5ZalhA673YyYikpDEY6IH74VkCtpu/EGPUdJhQ7kCoCMOKaItxk1YcCQArbOZ2ViPh 8WelV0PuyIrKjVOQEy/29pbu/MHRjwPJvxE9WGEGvX6XW2FlYCxiSk9yJNN1qoclYJoy U03Gb5PFxcO5dJX0Hoe9mL9wzPDbC5ry6bQx3DtZWk7hdO7/iQefWtbey5ulO0fg3os6 CTIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786059417; x=1786664217; 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=mGO2RWCI+1OC1QgQlwRZRpcTYMYFszJFieAT3RQjORg=; b=S5qfmJmV0jlcH8L2EW8lfZ9ildL3bxyT/G3maoEhSeeCFS447XV+jseYOcg6Rj7/n1 2lbSSDgKOfznOZCXnDRpqwgZ2Yw1G9SJp7MyPnjyF5tI6kh7WTZ8Fv1uBktUyzDmYieV I7Njvd9CKORHkQeDkc7UJKNy5nmetFX2PCfbVeYh/ZXsBXAhbsmUT7uBRi1H+Fey6a68 Cs71LkIJ5oEs4pUomU7Fb5iZmX10i4fTl41RXBcZDoPs6+9FKAfwnz14wtqZ2kps0j8O ao7Le6KebtI+eeC08cj4CdfIBpnovuTwVztju1+2xZM/4hJzSoXs0FCkhaRJpMTn9xQq B2uA== X-Forwarded-Encrypted: i=1; AHgh+Rqgzavhs56thVvrCgoTbk0duDPolDPDHAoLp7hWg37vgyKLt//RqhC4IVMrooddniafMfDxkfgicu+crDE=@vger.kernel.org X-Gm-Message-State: AOJu0YwxQ4Hm/I25skBT0vxUsGMQlCEPYDeOSAL2wDovYJcXbN5OSJ1x ayr0qKmZf2YapJoNwT6Y2/DoMnL+WPXnzkXvdM5GTXk0DaRt0JeCsJ+cnj3TdD953u5EYhV57b2 fuuAfyA== X-Received: from pgmj25.prod.google.com ([2002:a63:5959:0:b0:c9e:364c:61a2]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a21:329c:b0:3c3:8315:80b7 with SMTP id adf61e73a8af0-3cb85e9757amr21773483637.9.1786059416350; Thu, 06 Aug 2026 16:36:56 -0700 (PDT) Reply-To: Sean Christopherson Date: Thu, 6 Aug 2026 16:35:43 -0700 In-Reply-To: <20260806233609.212337-1-seanjc@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260806233609.212337-1-seanjc@google.com> X-Mailer: git-send-email 2.55.0.679.g6767b8d81c-goog Message-ID: <20260806233609.212337-27-seanjc@google.com> Subject: [PATCH v6 26/51] clocksource: hyper-v: Drop wrappers to sched_clock save/restore helpers From: Sean Christopherson To: Kiryl Shutsemau , Rick Edgecombe , Sean Christopherson , Paolo Bonzini , "K. Y. Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui , Long Li , Ajay Kaher , Alexey Makhalov , Jan Kiszka , Dave Hansen , Andy Lutomirski , Peter Zijlstra , Juergen Gross , Daniel Lezcano , Thomas Gleixner , John Stultz Cc: Vitaly Kuznetsov , Broadcom internal kernel review list , Boris Ostrovsky , Stephen Boyd , Miroslav Lichvar , x86@kernel.org, linux-coco@lists.linux.dev, kvm@vger.kernel.org, linux-hyperv@vger.kernel.org, virtualization@lists.linux.dev, linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org, Michael Kelley , Tom Lendacky , Nikunj A Dadhania , David Woodhouse , David Woodhouse , 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.679.g6767b8d81c-goog