RE: [PATCH v2 09/38] clocksource: hyper-v: Drop wrappers to sched_clock save/restore helpers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Sean Christopherson <seanjc@xxxxxxxxxx> 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@xxxxxxxxxx>

Modulo the terminology in the commit message,

Reviewed-by: Michael Kelley <mhklinux@xxxxxxxxxxx>
Tested-by: Michael Kelley <mhklinux@xxxxxxxxxxx>

> ---
>  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
> 






[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux