]> git.baikalelectronics.ru Git - kernel.git/commit
x86/mm/tlb: Leave lazy TLB mode at page table free time
authorRik van Riel <riel@surriel.com>
Mon, 16 Jul 2018 19:03:32 +0000 (15:03 -0400)
committerIngo Molnar <mingo@kernel.org>
Tue, 17 Jul 2018 07:35:31 +0000 (09:35 +0200)
commit5b08dcdd40d12cb407a6ad86d00d435fcf5a3489
treee608a4aa5331e3fcd5a1b00a6c65de41b6563eb5
parentae38d713b1d71f52b7d0e42d474d06a08e840c11
x86/mm/tlb: Leave lazy TLB mode at page table free time

Andy discovered that speculative memory accesses while in lazy
TLB mode can crash a system, when a CPU tries to dereference a
speculative access using memory contents that used to be valid
page table memory, but have since been reused for something else
and point into la-la land.

The latter problem can be prevented in two ways. The first is to
always send a TLB shootdown IPI to CPUs in lazy TLB mode, while
the second one is to only send the TLB shootdown at page table
freeing time.

The second should result in fewer IPIs, since operationgs like
mprotect and madvise are very common with some workloads, but
do not involve page table freeing. Also, on munmap, batching
of page table freeing covers much larger ranges of virtual
memory than the batching of unmapped user pages.

Tested-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Rik van Riel <riel@surriel.com>
Acked-by: Dave Hansen <dave.hansen@intel.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: efault@gmx.de
Cc: kernel-team@fb.com
Cc: luto@kernel.org
Link: http://lkml.kernel.org/r/20180716190337.26133-3-riel@surriel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
arch/x86/include/asm/tlbflush.h
arch/x86/mm/tlb.c
include/asm-generic/tlb.h
mm/memory.c