linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Boris Ostrovsky <boris.ostrovsky@oracle.com>
To: Juergen Gross <jgross@suse.com>,
	xen-devel@lists.xenproject.org, x86@kernel.org,
	virtualization@lists.linux-foundation.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org,
	kvm@vger.kernel.org
Cc: Deep Shah <sdeep@vmware.com>,
	"VMware, Inc." <pv-drivers@vmware.com>,
	Russell King <linux@armlinux.org.uk>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	"K. Y. Srinivasan" <kys@microsoft.com>,
	Haiyang Zhang <haiyangz@microsoft.com>,
	Stephen Hemminger <sthemmin@microsoft.com>,
	Wei Liu <wei.liu@kernel.org>, Paolo Bonzini <pbonzini@redhat.com>,
	Sean Christopherson <seanjc@google.com>,
	Vitaly Kuznetsov <vkuznets@redhat.com>,
	Wanpeng Li <wanpengli@tencent.com>,
	Jim Mattson <jmattson@google.com>, Joerg Roedel <joro@8bytes.org>,
	Stefano Stabellini <sstabellini@kernel.org>
Subject: Re: [PATCH v5 02/12] x86/paravirt: switch time pvops functions to use static_call()
Date: Mon, 8 Mar 2021 12:00:23 -0500	[thread overview]
Message-ID: <1346dbb1-c43e-9ac2-10e4-3c10cb2ead78@oracle.com> (raw)
In-Reply-To: <20210308122844.30488-3-jgross@suse.com>


On 3/8/21 7:28 AM, Juergen Gross wrote:
> --- a/arch/x86/xen/time.c
> +++ b/arch/x86/xen/time.c
> @@ -379,11 +379,6 @@ void xen_timer_resume(void)
>  	}
>  }
>  
> -static const struct pv_time_ops xen_time_ops __initconst = {
> -	.sched_clock = xen_sched_clock,
> -	.steal_clock = xen_steal_clock,
> -};
> -
>  static struct pvclock_vsyscall_time_info *xen_clock __read_mostly;
>  static u64 xen_clock_value_saved;
>  
> @@ -528,7 +523,8 @@ static void __init xen_time_init(void)
>  void __init xen_init_time_ops(void)
>  {
>  	xen_sched_clock_offset = xen_clocksource_read();
> -	pv_ops.time = xen_time_ops;
> +	static_call_update(pv_steal_clock, xen_steal_clock);
> +	paravirt_set_sched_clock(xen_sched_clock);
>  
>  	x86_init.timers.timer_init = xen_time_init;
>  	x86_init.timers.setup_percpu_clockev = x86_init_noop;
> @@ -570,7 +566,8 @@ void __init xen_hvm_init_time_ops(void)
>  	}
>  
>  	xen_sched_clock_offset = xen_clocksource_read();
> -	pv_ops.time = xen_time_ops;
> +	static_call_update(pv_steal_clock, xen_steal_clock);
> +	paravirt_set_sched_clock(xen_sched_clock);
>  	x86_init.timers.setup_percpu_clockev = xen_time_init;
>  	x86_cpuinit.setup_percpu_clockev = xen_hvm_setup_cpu_clockevents;


There is a bunch of stuff that's common between the two cases so it can be factored out.


>  
> diff --git a/drivers/xen/time.c b/drivers/xen/time.c
> index 108edbcbc040..152dd33bb223 100644
> --- a/drivers/xen/time.c
> +++ b/drivers/xen/time.c
> @@ -7,6 +7,7 @@
>  #include <linux/math64.h>
>  #include <linux/gfp.h>
>  #include <linux/slab.h>
> +#include <linux/static_call.h>
>  
>  #include <asm/paravirt.h>
>  #include <asm/xen/hypervisor.h>
> @@ -175,7 +176,7 @@ void __init xen_time_setup_guest(void)
>  	xen_runstate_remote = !HYPERVISOR_vm_assist(VMASST_CMD_enable,
>  					VMASST_TYPE_runstate_update_flag);
>  
> -	pv_ops.time.steal_clock = xen_steal_clock;
> +	static_call_update(pv_steal_clock, xen_steal_clock);
>  


Do we actually need this? We've already set this up in xen_init_time_ops(). (But maybe for ARM).


-boris


>  	static_key_slow_inc(&paravirt_steal_enabled);
>  	if (xen_runstate_remote)

  reply	other threads:[~2021-03-08 17:03 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-08 12:28 [PATCH v5 00/12] x86: major paravirt cleanup Juergen Gross
2021-03-08 12:28 ` [PATCH v5 01/12] staticcall: move struct static_call_key definition to static_call_types.h Juergen Gross
2021-03-08 16:27   ` Peter Zijlstra
2021-03-08 12:28 ` [PATCH v5 02/12] x86/paravirt: switch time pvops functions to use static_call() Juergen Gross
2021-03-08 17:00   ` Boris Ostrovsky [this message]
2021-03-09  6:14     ` Jürgen Groß
2021-03-08 12:28 ` [PATCH v5 03/12] x86/alternative: drop feature parameter from ALTINSTR_REPLACEMENT() Juergen Gross
2021-03-08 12:28 ` [PATCH v5 04/12] x86/alternative: support not-feature Juergen Gross
2021-03-08 12:28 ` [PATCH v5 05/12] x86/alternative: support ALTERNATIVE_TERNARY Juergen Gross
2021-03-08 12:28 ` [PATCH v5 06/12] x86: add new features for paravirt patching Juergen Gross
2021-03-08 12:28 ` [PATCH v5 07/12] x86/paravirt: remove no longer needed 32-bit pvops cruft Juergen Gross
2021-03-08 12:28 ` [PATCH v5 08/12] x86/paravirt: simplify paravirt macros Juergen Gross
2021-03-08 12:28 ` [PATCH v5 09/12] x86/paravirt: switch iret pvops to ALTERNATIVE Juergen Gross
2021-03-08 12:28 ` [PATCH v5 10/12] x86/paravirt: add new macros PVOP_ALT* supporting pvops in ALTERNATIVEs Juergen Gross
2021-03-08 12:28 ` [PATCH v5 11/12] x86/paravirt: switch functions with custom code to ALTERNATIVE Juergen Gross
2021-03-08 18:30   ` Borislav Petkov
2021-03-09  6:21     ` Jürgen Groß
2021-03-08 12:28 ` [PATCH v5 12/12] x86/paravirt: have only one paravirt patch function Juergen Gross
2021-03-08 16:31 ` [PATCH v5 00/12] x86: major paravirt cleanup Peter Zijlstra

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=1346dbb1-c43e-9ac2-10e4-3c10cb2ead78@oracle.com \
    --to=boris.ostrovsky@oracle.com \
    --cc=bp@alien8.de \
    --cc=catalin.marinas@arm.com \
    --cc=haiyangz@microsoft.com \
    --cc=hpa@zytor.com \
    --cc=jgross@suse.com \
    --cc=jmattson@google.com \
    --cc=joro@8bytes.org \
    --cc=kvm@vger.kernel.org \
    --cc=kys@microsoft.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=mingo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=pv-drivers@vmware.com \
    --cc=sdeep@vmware.com \
    --cc=seanjc@google.com \
    --cc=sstabellini@kernel.org \
    --cc=sthemmin@microsoft.com \
    --cc=tglx@linutronix.de \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=vkuznets@redhat.com \
    --cc=wanpengli@tencent.com \
    --cc=wei.liu@kernel.org \
    --cc=will@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).