mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 01:55:51 +02:00
x86/xen: Get rid of last XEN_LAZY_MMU uses
There are only very few use cases of XEN_LAZY_MMU left. Get rid of them in order to avoid having to call enter_lazy(XEN_LAZY_MMU) and leave_lazy(XEN_LAZY_MMU). The query in xen_batched_set_pte() can be replaced by using is_lazy_mmu_mode_active() instead. As xen_flush_lazy_mmu() will be called only with lazy MMU mode being active, the test for the lazy mode can just be dropped. In xen_start_context_switch() and xen_end_context_switch() use __task_lazy_mmu_mode_pause() and __task_lazy_mmu_mode_resume(), allowing to drop xen_enter_lazy_mmu() and xen_leave_lazy_mmu() completely. Call arch_flush_lazy_mmu_mode() from arch_leave_lazy_mmu_mode(), as this is the only required action now. Drop the lazy mmu enter and leave paravirt hooks, leaving the flush hook as the only needed one. Signed-off-by: Juergen Gross <jgross@suse.com> Message-ID: <20260526150514.129330-5-jgross@suse.com>
This commit is contained in:
parent
811f0d8caa
commit
bec6f41a6f
|
|
@ -483,17 +483,16 @@ static inline void arch_end_context_switch(struct task_struct *next)
|
|||
|
||||
static inline void arch_enter_lazy_mmu_mode(void)
|
||||
{
|
||||
PVOP_VCALL0(pv_ops, mmu.lazy_mode.enter);
|
||||
}
|
||||
|
||||
static inline void arch_leave_lazy_mmu_mode(void)
|
||||
{
|
||||
PVOP_VCALL0(pv_ops, mmu.lazy_mode.leave);
|
||||
}
|
||||
|
||||
static inline void arch_flush_lazy_mmu_mode(void)
|
||||
{
|
||||
PVOP_VCALL0(pv_ops, mmu.lazy_mode.flush);
|
||||
PVOP_VCALL0(pv_ops, mmu.lazy_mode_flush);
|
||||
}
|
||||
|
||||
static inline void arch_leave_lazy_mmu_mode(void)
|
||||
{
|
||||
arch_flush_lazy_mmu_mode();
|
||||
}
|
||||
|
||||
static inline void __set_fixmap(unsigned /* enum fixed_addresses */ idx,
|
||||
|
|
|
|||
|
|
@ -19,15 +19,6 @@ struct cpumask;
|
|||
struct flush_tlb_info;
|
||||
struct vm_area_struct;
|
||||
|
||||
#ifdef CONFIG_PARAVIRT_XXL
|
||||
struct pv_lazy_ops {
|
||||
/* Set deferred update mode, used for batching operations. */
|
||||
void (*enter)(void);
|
||||
void (*leave)(void);
|
||||
void (*flush)(void);
|
||||
} __no_randomize_layout;
|
||||
#endif
|
||||
|
||||
struct pv_cpu_ops {
|
||||
/* hooks for various privileged instructions */
|
||||
#ifdef CONFIG_PARAVIRT_XXL
|
||||
|
|
@ -171,7 +162,7 @@ struct pv_mmu_ops {
|
|||
|
||||
void (*set_pgd)(pgd_t *pgdp, pgd_t pgdval);
|
||||
|
||||
struct pv_lazy_ops lazy_mode;
|
||||
void (*lazy_mode_flush)(void);
|
||||
|
||||
/* dom0 ops */
|
||||
|
||||
|
|
|
|||
|
|
@ -204,11 +204,7 @@ struct paravirt_patch_template pv_ops = {
|
|||
|
||||
.mmu.enter_mmap = paravirt_nop,
|
||||
|
||||
.mmu.lazy_mode = {
|
||||
.enter = paravirt_nop,
|
||||
.leave = paravirt_nop,
|
||||
.flush = paravirt_nop,
|
||||
},
|
||||
.mmu.lazy_mode_flush = paravirt_nop,
|
||||
|
||||
.mmu.set_fixmap = native_set_fixmap,
|
||||
#endif /* CONFIG_PARAVIRT_XXL */
|
||||
|
|
|
|||
|
|
@ -424,9 +424,7 @@ static void xen_start_context_switch(struct task_struct *prev)
|
|||
{
|
||||
BUG_ON(preemptible());
|
||||
|
||||
if (this_cpu_read(xen_lazy_mode) == XEN_LAZY_MMU) {
|
||||
arch_leave_lazy_mmu_mode();
|
||||
}
|
||||
__task_lazy_mmu_mode_pause(prev);
|
||||
enter_lazy(XEN_LAZY_CPU);
|
||||
}
|
||||
|
||||
|
|
@ -436,8 +434,7 @@ static void xen_end_context_switch(struct task_struct *next)
|
|||
|
||||
xen_mc_flush();
|
||||
leave_lazy(XEN_LAZY_CPU);
|
||||
if (__task_lazy_mmu_mode_active(next))
|
||||
arch_enter_lazy_mmu_mode();
|
||||
__task_lazy_mmu_mode_resume(next);
|
||||
}
|
||||
|
||||
static unsigned long xen_store_tr(void)
|
||||
|
|
|
|||
|
|
@ -324,7 +324,7 @@ static bool xen_batched_set_pte(pte_t *ptep, pte_t pteval)
|
|||
{
|
||||
struct mmu_update u;
|
||||
|
||||
if (xen_get_lazy_mode() != XEN_LAZY_MMU)
|
||||
if (!is_lazy_mmu_mode_active())
|
||||
return false;
|
||||
|
||||
xen_mc_batch();
|
||||
|
|
@ -2151,21 +2151,10 @@ static void xen_set_fixmap(unsigned idx, phys_addr_t phys, pgprot_t prot)
|
|||
#endif
|
||||
}
|
||||
|
||||
static void xen_enter_lazy_mmu(void)
|
||||
{
|
||||
preempt_disable();
|
||||
if (xen_get_lazy_mode() != XEN_LAZY_MMU)
|
||||
enter_lazy(XEN_LAZY_MMU);
|
||||
preempt_enable();
|
||||
}
|
||||
|
||||
static void xen_flush_lazy_mmu(void)
|
||||
{
|
||||
preempt_disable();
|
||||
|
||||
if (xen_get_lazy_mode() == XEN_LAZY_MMU)
|
||||
xen_mc_flush();
|
||||
|
||||
xen_mc_flush();
|
||||
preempt_enable();
|
||||
}
|
||||
|
||||
|
|
@ -2189,15 +2178,6 @@ static void __init xen_post_allocator_init(void)
|
|||
pv_ops.mmu.write_cr3 = &xen_write_cr3;
|
||||
}
|
||||
|
||||
static void xen_leave_lazy_mmu(void)
|
||||
{
|
||||
preempt_disable();
|
||||
xen_mc_flush();
|
||||
if (xen_get_lazy_mode() != XEN_LAZY_NONE)
|
||||
leave_lazy(XEN_LAZY_MMU);
|
||||
preempt_enable();
|
||||
}
|
||||
|
||||
void __init xen_init_mmu_ops(void)
|
||||
{
|
||||
x86_init.paging.pagetable_init = xen_pagetable_init;
|
||||
|
|
@ -2237,9 +2217,7 @@ void __init xen_init_mmu_ops(void)
|
|||
pv_ops.mmu.make_p4d = PV_CALLEE_SAVE(xen_make_p4d);
|
||||
pv_ops.mmu.enter_mmap = xen_enter_mmap;
|
||||
pv_ops.mmu.exit_mmap = xen_exit_mmap;
|
||||
pv_ops.mmu.lazy_mode.enter = xen_enter_lazy_mmu;
|
||||
pv_ops.mmu.lazy_mode.leave = xen_leave_lazy_mmu;
|
||||
pv_ops.mmu.lazy_mode.flush = xen_flush_lazy_mmu;
|
||||
pv_ops.mmu.lazy_mode_flush = xen_flush_lazy_mmu;
|
||||
pv_ops.mmu.set_fixmap = xen_set_fixmap;
|
||||
|
||||
memset(dummy_mapping, 0xff, PAGE_SIZE);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user