[ Sasha's backport helper bot ] Hi, Found matching upstream commit: bcc80dec91ee745b3d66f3e48f0ec2efdea97149 Status in newer kernel trees: 6.12.y | Present (different SHA1: bacd0498dea0) 6.6.y | Present (different SHA1: 4c8d45af23c2) 6.1.y | Not found 5.15.y | Not found Note: The patch differs from the upstream commit: --- 1: bcc80dec91ee ! 1: b992b4219991 x86/hyperv: Fix hv tsc page based sched_clock for hibernation @@ Commit message Link: https://lore.kernel.org/r/20240917053917.76787-1-namjain@xxxxxxxxxxxxxxxxxxx Signed-off-by: Wei Liu <wei.liu@xxxxxxxxxx> Message-ID: <20240917053917.76787-1-namjain@xxxxxxxxxxxxxxxxxxx> + (cherry picked from commit bcc80dec91ee745b3d66f3e48f0ec2efdea97149) + Signed-off-by: Naman Jain <namjain@xxxxxxxxxxxxxxxxxxx> ## arch/x86/kernel/cpu/mshyperv.c ## @@ arch/x86/kernel/cpu/mshyperv.c: static void hv_machine_crash_shutdown(struct pt_regs *regs) hyperv_cleanup(); } - #endif /* CONFIG_CRASH_DUMP */ + #endif /* CONFIG_KEXEC_CORE */ + +static u64 hv_ref_counter_at_suspend; +static void (*old_save_sched_clock_state)(void); @@ arch/x86/kernel/cpu/mshyperv.c: static void __init ms_hyperv_init_platform(void) /* Register Hyper-V specific clocksource */ hv_init_clocksource(); + x86_setup_ops_for_tsc_pg_clock(); - hv_vtl_init_platform(); #endif /* + * TSC should be marked as unstable only after Hyper-V ## drivers/clocksource/hyperv_timer.c ## @@ @@ drivers/clocksource/hyperv_timer.c /* * If false, we're using the old mechanism for stimer0 interrupts @@ drivers/clocksource/hyperv_timer.c: static void resume_hv_clock_tsc(struct clocksource *arg) - hv_set_msr(HV_MSR_REFERENCE_TSC, tsc_msr.as_uint64); + hv_set_register(HV_REGISTER_REFERENCE_TSC, tsc_msr); } +/* @@ drivers/clocksource/hyperv_timer.c: static void resume_hv_clock_tsc(struct clock { ## include/clocksource/hyperv_timer.h ## -@@ include/clocksource/hyperv_timer.h: extern void hv_remap_tsc_clocksource(void); - extern unsigned long hv_get_tsc_pfn(void); +@@ include/clocksource/hyperv_timer.h: extern void hv_init_clocksource(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) + static inline notrace u64 + hv_read_tsc_page_tsc(const struct ms_hyperv_tsc_page *tsc_pg, u64 *cur_tsc) + { --- Results of testing on various branches: | Branch | Patch Apply | Build Test | |---------------------------|-------------|------------| | stable/linux-5.15.y | Success | Success |