Commit 5c83511b authored by Juergen Gross's avatar Juergen Gross Committed by Thomas Gleixner
Browse files

x86/paravirt: Use a single ops structure



Instead of using six globally visible paravirt ops structures combine
them in a single structure, keeping the original structures as
sub-structures.

This avoids the need to assemble struct paravirt_patch_template at
runtime on the stack each time apply_paravirt() is being called (i.e.
when loading a module).

[ tglx: Made the struct and the initializer tabular for readability sake ]

Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Cc: xen-devel@lists.xenproject.org
Cc: virtualization@lists.linux-foundation.org
Cc: akataria@vmware.com
Cc: rusty@rustcorp.com.au
Cc: boris.ostrovsky@oracle.com
Cc: hpa@zytor.com
Link: https://lkml.kernel.org/r/20180828074026.820-9-jgross@suse.com
parent 27876f38
Loading
Loading
Loading
Loading
+7 −2
Original line number Original line Diff line number Diff line
@@ -10,11 +10,16 @@ extern struct static_key paravirt_steal_rq_enabled;
struct pv_time_ops {
struct pv_time_ops {
	unsigned long long (*steal_clock)(int cpu);
	unsigned long long (*steal_clock)(int cpu);
};
};
extern struct pv_time_ops pv_time_ops;

struct paravirt_patch_template {
	struct pv_time_ops time;
};

extern struct paravirt_patch_template pv_ops;


static inline u64 paravirt_steal_clock(int cpu)
static inline u64 paravirt_steal_clock(int cpu)
{
{
	return pv_time_ops.steal_clock(cpu);
	return pv_ops.time.steal_clock(cpu);
}
}
#endif
#endif


+2 −2
Original line number Original line Diff line number Diff line
@@ -21,5 +21,5 @@
struct static_key paravirt_steal_enabled;
struct static_key paravirt_steal_enabled;
struct static_key paravirt_steal_rq_enabled;
struct static_key paravirt_steal_rq_enabled;


struct pv_time_ops pv_time_ops;
struct paravirt_patch_template pv_ops;
EXPORT_SYMBOL_GPL(pv_time_ops);
EXPORT_SYMBOL_GPL(pv_ops);
+7 −2
Original line number Original line Diff line number Diff line
@@ -10,11 +10,16 @@ extern struct static_key paravirt_steal_rq_enabled;
struct pv_time_ops {
struct pv_time_ops {
	unsigned long long (*steal_clock)(int cpu);
	unsigned long long (*steal_clock)(int cpu);
};
};
extern struct pv_time_ops pv_time_ops;

struct paravirt_patch_template {
	struct pv_time_ops time;
};

extern struct paravirt_patch_template pv_ops;


static inline u64 paravirt_steal_clock(int cpu)
static inline u64 paravirt_steal_clock(int cpu)
{
{
	return pv_time_ops.steal_clock(cpu);
	return pv_ops.time.steal_clock(cpu);
}
}
#endif
#endif


+2 −2
Original line number Original line Diff line number Diff line
@@ -21,5 +21,5 @@
struct static_key paravirt_steal_enabled;
struct static_key paravirt_steal_enabled;
struct static_key paravirt_steal_rq_enabled;
struct static_key paravirt_steal_rq_enabled;


struct pv_time_ops pv_time_ops;
struct paravirt_patch_template pv_ops;
EXPORT_SYMBOL_GPL(pv_time_ops);
EXPORT_SYMBOL_GPL(pv_ops);
+2 −2
Original line number Original line Diff line number Diff line
@@ -231,6 +231,6 @@ void hyperv_setup_mmu_ops(void)
		return;
		return;


	pr_info("Using hypercall for remote TLB flush\n");
	pr_info("Using hypercall for remote TLB flush\n");
	pv_mmu_ops.flush_tlb_others = hyperv_flush_tlb_others;
	pv_ops.mmu.flush_tlb_others = hyperv_flush_tlb_others;
	pv_mmu_ops.tlb_remove_table = tlb_remove_table;
	pv_ops.mmu.tlb_remove_table = tlb_remove_table;
}
}
Loading