lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 8 Mar 2021 12:00:23 -0500
From:   Boris Ostrovsky <boris.ostrovsky@...cle.com>
To:     Juergen Gross <jgross@...e.com>, xen-devel@...ts.xenproject.org,
        x86@...nel.org, virtualization@...ts.linux-foundation.org,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
        linux-hyperv@...r.kernel.org, kvm@...r.kernel.org
Cc:     Deep Shah <sdeep@...are.com>,
        "VMware, Inc." <pv-drivers@...are.com>,
        Russell King <linux@...linux.org.uk>,
        Catalin Marinas <catalin.marinas@....com>,
        Will Deacon <will@...nel.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
        "H. Peter Anvin" <hpa@...or.com>,
        "K. Y. Srinivasan" <kys@...rosoft.com>,
        Haiyang Zhang <haiyangz@...rosoft.com>,
        Stephen Hemminger <sthemmin@...rosoft.com>,
        Wei Liu <wei.liu@...nel.org>,
        Paolo Bonzini <pbonzini@...hat.com>,
        Sean Christopherson <seanjc@...gle.com>,
        Vitaly Kuznetsov <vkuznets@...hat.com>,
        Wanpeng Li <wanpengli@...cent.com>,
        Jim Mattson <jmattson@...gle.com>,
        Joerg Roedel <joro@...tes.org>,
        Stefano Stabellini <sstabellini@...nel.org>
Subject: Re: [PATCH v5 02/12] x86/paravirt: switch time pvops functions to use
 static_call()


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)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ