]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commit
UBUNTU: SAUCE: s390/mm: fix race on mm->context.flush_mm
authorMartin Schwidefsky <schwidefsky@de.ibm.com>
Tue, 12 Sep 2017 09:45:42 +0000 (11:45 +0200)
committerJuerg Haefliger <juerg.haefliger@canonical.com>
Wed, 13 Sep 2017 05:58:25 +0000 (07:58 +0200)
commitf8ce57a21762be7f244102c8aea73b6fb4944b67
tree0405b3f4ef271a3224e8409f69a70d2bd1a09eec
parentf14180d091364aeb1473123614327452e3a2a1cb
UBUNTU: SAUCE: 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 linux-next)
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Brad Figg <brad.figg@canonical.com>
Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
arch/s390/include/asm/mmu.h
arch/s390/include/asm/mmu_context.h
arch/s390/include/asm/tlbflush.h