mm/x86: Flush lazy MMU when DEBUG_PAGEALLOC is set
PATCH 1/1 mm/x86: Flush lazy MMU when DEBUG_PAGEALLOC is set
When CONFIG_DEBUG_PAGEALLOC is set page table updates made by kernel_map_pages() are not made visible (via TLB flush) immediately if lazy MMU is on. In environments that support lazy MMU (e.g. Xen) this may lead to fatal page faults, for example, when zap_pte_range() needs to allocate pages in __tlb_remove_page() -> tlb_next_batch().
--- arch/x86/mm/pageattr.c | 2 ++ 1 file changed, 2 insertions(+)
arch/x86/mm/pageattr.c +2 -0
@@ -1369,6 +1369,8 @@ void kernel_map_pages(struct page *page, int numpages, int enable)* but that can deadlock->flush only current cpu: */ __flush_tlb_all (); + +arch_flush_lazy_mmu_mode (); }#ifdef CONFIG_HIBERNATION
Signature · 1 line
1.8.1.2
H. Peter Anvin
reviewerQuoted 17 lines · Boris Ostrovsky
When
CONFIG_DEBUG_PAGEALLOCis set page table updates made bykernel_map_pages()are not made visible (via TLB flush) immediately if lazy MMU is on. In environments that support lazy MMU (e.g. Xen) this may lead to fatal page faults, for example, whenzap_pte_range()needs to allocate pages in__tlb_remove_page()->tlb_next_batch().Signed-off-by Boris Ostrovsky <[email protected]>--- arch/x86/mm/pageattr.c | 2 ++ 1 file changed, 2 insertions(+)arch/x86/mm/pageattr.c +0
-0
arch/x86/mm/pageattr.c void kernel_map_pages(struct page *page, int numpages, int enable) · line 1376
Quoted 8 lines
arch/x86/mm/pageattr.c +2
-0@@ -1369,6 +1369,8 @@ void kernel_map_pages(struct page *page, int numpages, int enable)* but that can deadlock->flush only current cpu: */ __flush_tlb_all (); + +arch_flush_lazy_mmu_mode (); }#ifdef CONFIG_HIBERNATION
This sounds like a critical fix, i.e. a -stable candidate. Am I correct?
-hpa
H. Peter Anvin
reviewerQuoted 17 lines · Boris Ostrovsky
When
CONFIG_DEBUG_PAGEALLOCis set page table updates made bykernel_map_pages()are not made visible (via TLB flush) immediately if lazy MMU is on. In environments that support lazy MMU (e.g. Xen) this may lead to fatal page faults, for example, whenzap_pte_range()needs to allocate pages in__tlb_remove_page()->tlb_next_batch().Signed-off-by Boris Ostrovsky <[email protected]>--- arch/x86/mm/pageattr.c | 2 ++ 1 file changed, 2 insertions(+)arch/x86/mm/pageattr.c +0
-0
arch/x86/mm/pageattr.c void kernel_map_pages(struct page *page, int numpages, int enable) · line 1376
Quoted 8 lines
arch/x86/mm/pageattr.c +2
-0@@ -1369,6 +1369,8 @@ void kernel_map_pages(struct page *page, int numpages, int enable)* but that can deadlock->flush only current cpu: */ __flush_tlb_all (); + +arch_flush_lazy_mmu_mode (); }#ifdef CONFIG_HIBERNATION
This sounds like a critical fix, i.e. a -stable candidate. Am I correct?
-hpa