Skip to content

Commit b8bcfe9

Browse files
author
Jeremy Fitzhardinge
committed
x86/paravirt: remove lazy mode in interrupts
Impact: simplification, robustness Make paravirt_lazy_mode() always return PARAVIRT_LAZY_NONE when in an interrupt. This prevents interrupt code from accidentally inheriting an outer lazy state, and instead does everything synchronously. Outer batched operations are left deferred. Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com> Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Thomas Gleixner <tglx@linutronix.de>
1 parent a8a93f3 commit b8bcfe9

5 files changed

Lines changed: 5 additions & 21 deletions

File tree

‎arch/x86/kernel/paravirt.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,9 @@ void paravirt_leave_lazy_cpu(void)
282282

283283
enum paravirt_lazy_mode paravirt_get_lazy_mode(void)
284284
{
285+
if (in_interrupt())
286+
return PARAVIRT_LAZY_NONE;
287+
285288
return __get_cpu_var(paravirt_lazy_mode);
286289
}
287290

‎arch/x86/mm/fault.c‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -225,12 +225,10 @@ static inline pmd_t *vmalloc_sync_one(pgd_t *pgd, unsigned long address)
225225
if (!pmd_present(*pmd_k))
226226
return NULL;
227227

228-
if (!pmd_present(*pmd)) {
228+
if (!pmd_present(*pmd))
229229
set_pmd(pmd, *pmd_k);
230-
arch_flush_lazy_mmu_mode();
231-
} else {
230+
else
232231
BUG_ON(pmd_page(*pmd) != pmd_page(*pmd_k));
233-
}
234232

235233
return pmd_k;
236234
}

‎arch/x86/mm/highmem_32.c‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ void *kmap_atomic_prot(struct page *page, enum km_type type, pgprot_t prot)
8787
vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
8888
BUG_ON(!pte_none(*(kmap_pte-idx)));
8989
set_pte(kmap_pte-idx, mk_pte(page, prot));
90-
arch_flush_lazy_mmu_mode();
9190

9291
return (void *)vaddr;
9392
}
@@ -117,7 +116,6 @@ void kunmap_atomic(void *kvaddr, enum km_type type)
117116
#endif
118117
}
119118

120-
arch_flush_lazy_mmu_mode();
121119
pagefault_enable();
122120
}
123121

‎arch/x86/mm/iomap_32.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ iounmap_atomic(void *kvaddr, enum km_type type)
7474
if (vaddr == __fix_to_virt(FIX_KMAP_BEGIN+idx))
7575
kpte_clear_flush(kmap_pte-idx, vaddr);
7676

77-
arch_flush_lazy_mmu_mode();
7877
pagefault_enable();
7978
}
8079
EXPORT_SYMBOL_GPL(iounmap_atomic);

‎arch/x86/mm/pageattr.c‎

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -824,13 +824,6 @@ static int change_page_attr_set_clr(unsigned long *addr, int numpages,
824824

825825
vm_unmap_aliases();
826826

827-
/*
828-
* If we're called with lazy mmu updates enabled, the
829-
* in-memory pte state may be stale. Flush pending updates to
830-
* bring them up to date.
831-
*/
832-
arch_flush_lazy_mmu_mode();
833-
834827
cpa.vaddr = addr;
835828
cpa.numpages = numpages;
836829
cpa.mask_set = mask_set;
@@ -873,13 +866,6 @@ static int change_page_attr_set_clr(unsigned long *addr, int numpages,
873866
} else
874867
cpa_flush_all(cache);
875868

876-
/*
877-
* If we've been called with lazy mmu updates enabled, then
878-
* make sure that everything gets flushed out before we
879-
* return.
880-
*/
881-
arch_flush_lazy_mmu_mode();
882-
883869
out:
884870
return ret;
885871
}

0 commit comments

Comments
 (0)