[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v5 02/12] x86/paravirt: switch time pvops functions to use static_call()
- To: Juergen Gross <jgross@xxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx, x86@xxxxxxxxxx, virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx, linux-arm-kernel@xxxxxxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, linux-hyperv@xxxxxxxxxxxxxxx, kvm@xxxxxxxxxxxxxxx
- From: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
- Date: Mon, 8 Mar 2021 12:00:23 -0500
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=daP0eS7DKjw/+pNTAUvjnxRcOnE0s9+Kg1bQ2QfZFvQ=; b=m1P2AaIvtGUwgLt6GQ86H86jFrM2VZEZvUuRK17LMZj9Hm8Ez2yW0HB8BDZbdCTp+HJsNgZ7W63xHlEq/DsVpDltQXmkkV9PSnh1Td9jV4btMK08B5dMcX1JRbBTKeR3J64dpLnh6XNO4NrSguUBWkNxE4b+FcGhpYwVXEr4Qf9JZy+UZG1uZbKxCJ//yY5n/AILKAvoVARv8WEPaLFNsV8sq4qsT7KoBjmkMP/qJjfAbp2kxKG2RnIFitaE+cONBpgFrzG7I97U4ec8SvbuJriTtdCE3kqD/EokLc2cR7A6Bjjc4RXDuKq6E6qFsRFhD/kyxJaFW4jOd4AD8AuHyQ==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KGbEHjBQcyzj4p+XG5VXrDnnfUFQX7Pp3MW0HZeE+el3k7Km8MhD9iHPXEpUh0uNM+pITh+c1nb//W3gioi6f841eRzqXykBlgmlrvkCoWifwwSmgoQvNGujVOODFfRujxsMnl6i3Nrfk1ioGlddgURHxsCM/nWrLVL2K7bVwll+6Evf7QsKAkjgqdoHwhev/+T6T9HAMand+4Wk5oPUIE2kKYYyjyahM+O9tC05Lg8Pln7ERt/+RKbCzues8WHA22Mqm7EN3bqmq721lUdEzBaSs9Rm2MEazs59Nyj102pZdLCT2MHDRo36gaH9QYy8iZasQI1DT//DAKjywpRQ6g==
- Authentication-results: kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=none action=none header.from=oracle.com;
- Cc: Deep Shah <sdeep@xxxxxxxxxx>, "VMware, Inc." <pv-drivers@xxxxxxxxxx>, Russell King <linux@xxxxxxxxxxxxxxx>, Catalin Marinas <catalin.marinas@xxxxxxx>, Will Deacon <will@xxxxxxxxxx>, Thomas Gleixner <tglx@xxxxxxxxxxxxx>, Ingo Molnar <mingo@xxxxxxxxxx>, Borislav Petkov <bp@xxxxxxxxx>, "H. Peter Anvin" <hpa@xxxxxxxxx>, "K. Y. Srinivasan" <kys@xxxxxxxxxxxxx>, Haiyang Zhang <haiyangz@xxxxxxxxxxxxx>, Stephen Hemminger <sthemmin@xxxxxxxxxxxxx>, Wei Liu <wei.liu@xxxxxxxxxx>, Paolo Bonzini <pbonzini@xxxxxxxxxx>, Sean Christopherson <seanjc@xxxxxxxxxx>, Vitaly Kuznetsov <vkuznets@xxxxxxxxxx>, Wanpeng Li <wanpengli@xxxxxxxxxxx>, Jim Mattson <jmattson@xxxxxxxxxx>, Joerg Roedel <joro@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>
- Delivery-date: Mon, 08 Mar 2021 17:01:36 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
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(¶virt_steal_enabled);
> if (xen_runstate_remote)
|