[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5e34b263-da71-daf4-8ff6-b583427f1565@suse.com>
Date: Tue, 19 Jan 2021 12:36:37 +0100
From: Jürgen Groß <jgross@...e.com>
To: Michael Kelley <mikelley@...rosoft.com>,
"xen-devel@...ts.xenproject.org" <xen-devel@...ts.xenproject.org>,
"x86@...nel.org" <x86@...nel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-hyperv@...r.kernel.org" <linux-hyperv@...r.kernel.org>,
"virtualization@...ts.linux-foundation.org"
<virtualization@...ts.linux-foundation.org>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>
Cc: Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
"H. Peter Anvin" <hpa@...or.com>,
KY Srinivasan <kys@...rosoft.com>,
Haiyang Zhang <haiyangz@...rosoft.com>,
Stephen Hemminger <sthemmin@...rosoft.com>,
Wei Liu <wei.liu@...nel.org>, Deep Shah <sdeep@...are.com>,
"VMware, Inc." <pv-drivers@...are.com>,
Paolo Bonzini <pbonzini@...hat.com>,
Sean Christopherson <seanjc@...gle.com>,
vkuznets <vkuznets@...hat.com>,
Wanpeng Li <wanpengli@...cent.com>,
Jim Mattson <jmattson@...gle.com>,
Joerg Roedel <joro@...tes.org>,
Boris Ostrovsky <boris.ostrovsky@...cle.com>,
Stefano Stabellini <sstabellini@...nel.org>,
Daniel Lezcano <daniel.lezcano@...aro.org>,
Peter Zijlstra <peterz@...radead.org>,
Juri Lelli <juri.lelli@...hat.com>,
Vincent Guittot <vincent.guittot@...aro.org>,
Dietmar Eggemann <dietmar.eggemann@....com>,
Steven Rostedt <rostedt@...dmis.org>,
Ben Segall <bsegall@...gle.com>, Mel Gorman <mgorman@...e.de>,
Daniel Bristot de Oliveira <bristot@...hat.com>
Subject: Re: [PATCH v3 06/15] x86/paravirt: switch time pvops functions to use
static_call()
On 17.12.20 18:31, Michael Kelley wrote:
> From: Juergen Gross <jgross@...e.com> 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 <jgross@...e.com>
>> ---
>> 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 <clocksource/hyperv_timer.h>
>> #include <asm/hyperv-tlfs.h>
>> #include <asm/mshyperv.h>
>> +#include <asm/paravirt_time.h>
>>
>> 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
Download attachment "OpenPGP_0xB0DE9DD628BF132F.asc" of type "application/pgp-keys" (3092 bytes)
Download attachment "OpenPGP_signature" of type "application/pgp-signature" (496 bytes)
Powered by blists - more mailing lists