]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commit
s390/mm: fix race on mm->context.flush_mm
authorMartin Schwidefsky <schwidefsky@de.ibm.com>
Thu, 17 Aug 2017 06:15:16 +0000 (08:15 +0200)
committerSeth Forshee <seth.forshee@canonical.com>
Tue, 12 Sep 2017 15:13:32 +0000 (10:13 -0500)
commit9e0b058b4147eb9e2d8f5ef8ccb038570e20e1e0
tree8c6f8e07752790ec16b211080080ce3d598315aa
parent23a51d6fd7c5f98562ccf77f11ae2df76b4a07c7
s390/mm: fix race on mm->context.flush_mm

BugLink: http://bugs.launchpad.net/bugs/1708399
The order in __tlb_flush_mm_lazy is to flush TLB first and then clear
the mm->context.flush_mm bit. This can lead to missed flushes as the
bit can be set anytime, the order needs to be the other way aronud.

But this leads to a different race, __tlb_flush_mm_lazy may be called
on two CPUs concurrently. If mm->context.flush_mm is cleared first then
another CPU can bypass __tlb_flush_mm_lazy although the first CPU has
not done the flush yet. In a virtualized environment the time until the
flush is finally completed can be arbitrarily long.

Add a spinlock to serialize __tlb_flush_mm_lazy and use the function
in finish_arch_post_lock_switch as well.

Cc: <stable@vger.kernel.org>
Reviewed-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
(cherry picked from commit 60f07c8ec5fae06c23e9fd7bab67dabce92b3414)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
arch/s390/include/asm/mmu.h
arch/s390/include/asm/mmu_context.h
arch/s390/include/asm/tlbflush.h