lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
 <SN6PR02MB41578BB5ACCB9370E2D31EA4D4C82@SN6PR02MB4157.namprd02.prod.outlook.com>
Date: Tue, 4 Mar 2025 04:17:43 +0000
From: Michael Kelley <mhklinux@...look.com>
To: Sean Christopherson <seanjc@...gle.com>, Thomas Gleixner
	<tglx@...utronix.de>, Ingo Molnar <mingo@...hat.com>, Borislav Petkov
	<bp@...en8.de>, Dave Hansen <dave.hansen@...ux.intel.com>, "x86@...nel.org"
	<x86@...nel.org>, "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
	Paolo Bonzini <pbonzini@...hat.com>, Juergen Gross <jgross@...e.com>, "K. Y.
 Srinivasan" <kys@...rosoft.com>, Haiyang Zhang <haiyangz@...rosoft.com>, Wei
 Liu <wei.liu@...nel.org>, Dexuan Cui <decui@...rosoft.com>, Ajay Kaher
	<ajay.kaher@...adcom.com>, Jan Kiszka <jan.kiszka@...mens.com>, Andy
 Lutomirski <luto@...nel.org>, Peter Zijlstra <peterz@...radead.org>, Daniel
 Lezcano <daniel.lezcano@...aro.org>, John Stultz <jstultz@...gle.com>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"linux-coco@...ts.linux.dev" <linux-coco@...ts.linux.dev>,
	"kvm@...r.kernel.org" <kvm@...r.kernel.org>, "virtualization@...ts.linux.dev"
	<virtualization@...ts.linux.dev>, "linux-hyperv@...r.kernel.org"
	<linux-hyperv@...r.kernel.org>, "xen-devel@...ts.xenproject.org"
	<xen-devel@...ts.xenproject.org>, Tom Lendacky <thomas.lendacky@....com>,
	Nikunj A Dadhania <nikunj@....com>
Subject: RE: [PATCH v2 09/38] clocksource: hyper-v: Drop wrappers to
 sched_clock save/restore helpers

From: Sean Christopherson <seanjc@...gle.com> Sent: Wednesday, February 26, 2025 6:18 PM
> 
> Now that all of the Hyper-V timer sched_clock code is located in a single

Again, "Hyper-V refcounter", not "Hyper-V timer".

> file, drop the superfluous wrappers for the save/restore flows.
> 
> No functional change intended.
> 
> Signed-off-by: Sean Christopherson <seanjc@...gle.com>

Modulo the terminology in the commit message,

Reviewed-by: Michael Kelley <mhklinux@...look.com>
Tested-by: Michael Kelley <mhklinux@...look.com>

> ---
>  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 86a55167bf5d..5a52d0acf31f 100644
> --- a/drivers/clocksource/hyperv_timer.c
> +++ b/drivers/clocksource/hyperv_timer.c
> @@ -471,17 +471,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)
>  {
> @@ -545,12 +534,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
> @@ -558,23 +549,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.48.1.711.g2feabab25a-goog
> 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ