From: Michael Kelley <mikelley@microsoft.com>
To: Juergen Gross <jgross@suse.com>,
"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
"x86@kernel.org" <x86@kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-hyperv@vger.kernel.org" <linux-hyperv@vger.kernel.org>,
"virtualization@lists.linux-foundation.org"
<virtualization@lists.linux-foundation.org>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
"H. Peter Anvin" <hpa@zytor.com>,
KY Srinivasan <kys@microsoft.com>,
Haiyang Zhang <haiyangz@microsoft.com>,
Stephen Hemminger <sthemmin@microsoft.com>,
Wei Liu <wei.liu@kernel.org>, Deep Shah <sdeep@vmware.com>,
"VMware, Inc." <pv-drivers@vmware.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Sean Christopherson <seanjc@google.com>,
vkuznets <vkuznets@redhat.com>,
Wanpeng Li <wanpengli@tencent.com>,
Jim Mattson <jmattson@google.com>, Joerg Roedel <joro@8bytes.org>,
Boris Ostrovsky <boris.ostrovsky@oracle.com>,
Stefano Stabellini <sstabellini@kernel.org>,
Daniel Lezcano <daniel.lezcano@linaro.org>,
Peter Zijlstra <peterz@infradead.org>,
Juri Lelli <juri.lelli@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Steven Rostedt <rostedt@goodmis.org>,
Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
Daniel Bristot de Oliveira <bristot@redhat.com>
Subject: RE: [PATCH v3 06/15] x86/paravirt: switch time pvops functions to use static_call()
Date: Thu, 17 Dec 2020 17:31:50 +0000 [thread overview]
Message-ID: <MW2PR2101MB1052877B5376112F1BAF3D93D7C49@MW2PR2101MB1052.namprd21.prod.outlook.com> (raw)
In-Reply-To: <20201217093133.1507-7-jgross@suse.com>
From: Juergen Gross <jgross@suse.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@suse.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.
Michael
next prev parent reply other threads:[~2020-12-17 17:32 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-17 9:31 [PATCH v3 00/15] x86: major paravirt cleanup Juergen Gross
2020-12-17 9:31 ` [PATCH v3 01/15] x86/xen: use specific Xen pv interrupt entry for MCE Juergen Gross
2020-12-17 9:31 ` [PATCH v3 02/15] x86/xen: use specific Xen pv interrupt entry for DF Juergen Gross
2020-12-17 9:31 ` [PATCH v3 03/15] x86/pv: switch SWAPGS to ALTERNATIVE Juergen Gross
2020-12-17 9:31 ` [PATCH v3 04/15] x86/xen: drop USERGS_SYSRET64 paravirt call Juergen Gross
2020-12-17 9:31 ` [PATCH v3 05/15] x86: rework arch_local_irq_restore() to not use popf Juergen Gross
2020-12-17 9:31 ` [PATCH v3 06/15] x86/paravirt: switch time pvops functions to use static_call() Juergen Gross
2020-12-17 17:31 ` Michael Kelley [this message]
2021-01-06 10:41 ` Borislav Petkov
2021-01-19 11:36 ` Jürgen Groß
2021-01-06 10:03 ` Borislav Petkov
2021-01-19 11:33 ` Jürgen Groß
2020-12-17 9:31 ` [PATCH v3 07/15] x86/alternative: support "not feature" and ALTERNATIVE_TERNARY Juergen Gross
2021-01-07 19:08 ` Borislav Petkov
2021-01-19 11:35 ` Jürgen Groß
2021-01-19 12:06 ` Borislav Petkov
2021-01-19 12:12 ` Jürgen Groß
2020-12-17 9:31 ` [PATCH v3 08/15] x86: add new features for paravirt patching Juergen Gross
2020-12-17 13:12 ` kernel test robot
2021-01-14 18:30 ` Borislav Petkov
2021-01-14 18:40 ` Borislav Petkov
2020-12-17 9:31 ` [PATCH v3 09/15] x86/paravirt: remove no longer needed 32-bit pvops cruft Juergen Gross
2020-12-17 9:31 ` [PATCH v3 10/15] x86/paravirt: simplify paravirt macros Juergen Gross
2020-12-17 16:46 ` kernel test robot
2020-12-17 9:31 ` [PATCH v3 11/15] x86/paravirt: switch iret pvops to ALTERNATIVE Juergen Gross
2020-12-17 9:31 ` [PATCH v3 12/15] objtool: Alternatives vs ORC, the hard way Juergen Gross
2020-12-17 9:31 ` [PATCH v3 13/15] x86/paravirt: add new macros PVOP_ALT* supporting pvops in ALTERNATIVEs Juergen Gross
2020-12-17 9:31 ` [PATCH v3 14/15] x86/paravirt: switch functions with custom code to ALTERNATIVE Juergen Gross
2020-12-17 16:42 ` kernel test robot
2020-12-17 9:31 ` [PATCH v3 15/15] x86/paravirt: have only one paravirt patch function Juergen Gross
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=MW2PR2101MB1052877B5376112F1BAF3D93D7C49@MW2PR2101MB1052.namprd21.prod.outlook.com \
--to=mikelley@microsoft.com \
--cc=boris.ostrovsky@oracle.com \
--cc=bp@alien8.de \
--cc=bristot@redhat.com \
--cc=bsegall@google.com \
--cc=daniel.lezcano@linaro.org \
--cc=dietmar.eggemann@arm.com \
--cc=haiyangz@microsoft.com \
--cc=hpa@zytor.com \
--cc=jgross@suse.com \
--cc=jmattson@google.com \
--cc=joro@8bytes.org \
--cc=juri.lelli@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=kys@microsoft.com \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peterz@infradead.org \
--cc=pv-drivers@vmware.com \
--cc=rostedt@goodmis.org \
--cc=sdeep@vmware.com \
--cc=seanjc@google.com \
--cc=sstabellini@kernel.org \
--cc=sthemmin@microsoft.com \
--cc=tglx@linutronix.de \
--cc=vincent.guittot@linaro.org \
--cc=virtualization@lists.linux-foundation.org \
--cc=vkuznets@redhat.com \
--cc=wanpengli@tencent.com \
--cc=wei.liu@kernel.org \
--cc=x86@kernel.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).