On 17.12.20 18:31, Michael Kelley wrote: > From: Juergen Gross Sent: Thursday, December 17, 2020 1:31 AM > >> The time pvops functions are the only ones left which might be >> used in 32-bit mode and which return a 64-bit value. >> >> Switch them to use the static_call() mechanism instead of pvops, as >> this allows quite some simplification of the pvops implementation. >> >> Due to include hell this requires to split out the time interfaces >> into a new header file. >> >> Signed-off-by: Juergen Gross >> --- >> arch/x86/Kconfig | 1 + >> arch/x86/include/asm/mshyperv.h | 11 -------- >> arch/x86/include/asm/paravirt.h | 14 ---------- >> arch/x86/include/asm/paravirt_time.h | 38 +++++++++++++++++++++++++++ >> arch/x86/include/asm/paravirt_types.h | 6 ----- >> arch/x86/kernel/cpu/vmware.c | 5 ++-- >> arch/x86/kernel/kvm.c | 3 ++- >> arch/x86/kernel/kvmclock.c | 3 ++- >> arch/x86/kernel/paravirt.c | 16 ++++++++--- >> arch/x86/kernel/tsc.c | 3 ++- >> arch/x86/xen/time.c | 12 ++++----- >> drivers/clocksource/hyperv_timer.c | 5 ++-- >> drivers/xen/time.c | 3 ++- >> kernel/sched/sched.h | 1 + >> 14 files changed, 71 insertions(+), 50 deletions(-) >> create mode 100644 arch/x86/include/asm/paravirt_time.h >> > > [snip] > >> diff --git a/arch/x86/include/asm/mshyperv.h b/arch/x86/include/asm/mshyperv.h >> index ffc289992d1b..45942d420626 100644 >> --- a/arch/x86/include/asm/mshyperv.h >> +++ b/arch/x86/include/asm/mshyperv.h >> @@ -56,17 +56,6 @@ typedef int (*hyperv_fill_flush_list_func)( >> #define hv_get_raw_timer() rdtsc_ordered() >> #define hv_get_vector() HYPERVISOR_CALLBACK_VECTOR >> >> -/* >> - * Reference to pv_ops must be inline so objtool >> - * detection of noinstr violations can work correctly. >> - */ >> -static __always_inline void hv_setup_sched_clock(void *sched_clock) >> -{ >> -#ifdef CONFIG_PARAVIRT >> - pv_ops.time.sched_clock = sched_clock; >> -#endif >> -} >> - >> void hyperv_vector_handler(struct pt_regs *regs); >> >> static inline void hv_enable_stimer0_percpu_irq(int irq) {} > > [snip] > >> diff --git a/drivers/clocksource/hyperv_timer.c b/drivers/clocksource/hyperv_timer.c >> index ba04cb381cd3..1ed79993fc50 100644 >> --- a/drivers/clocksource/hyperv_timer.c >> +++ b/drivers/clocksource/hyperv_timer.c >> @@ -21,6 +21,7 @@ >> #include >> #include >> #include >> +#include >> >> static struct clock_event_device __percpu *hv_clock_event; >> static u64 hv_sched_clock_offset __ro_after_init; >> @@ -445,7 +446,7 @@ static bool __init hv_init_tsc_clocksource(void) >> clocksource_register_hz(&hyperv_cs_tsc, NSEC_PER_SEC/100); >> >> hv_sched_clock_offset = hv_read_reference_counter(); >> - hv_setup_sched_clock(read_hv_sched_clock_tsc); >> + paravirt_set_sched_clock(read_hv_sched_clock_tsc); >> >> return true; >> } >> @@ -470,6 +471,6 @@ void __init hv_init_clocksource(void) >> clocksource_register_hz(&hyperv_cs_msr, NSEC_PER_SEC/100); >> >> hv_sched_clock_offset = hv_read_reference_counter(); >> - hv_setup_sched_clock(read_hv_sched_clock_msr); >> + static_call_update(pv_sched_clock, read_hv_sched_clock_msr); >> } >> EXPORT_SYMBOL_GPL(hv_init_clocksource); > > These Hyper-V changes are problematic as we want to keep hyperv_timer.c > architecture independent. While only the code for x86/x64 is currently > accepted upstream, code for ARM64 support is in progress. So we need > to use hv_setup_sched_clock() in hyperv_timer.c, and have the per-arch > implementation in mshyperv.h. Okay, will switch back to old setup. Juergen