linux-hardened/arch/s390
Christian Borntraeger fa41ba0d08 s390/mm: avoid empty zero pages for KVM guests to avoid postcopy hangs
Right now there is a potential hang situation for postcopy migrations,
if the guest is enabling storage keys on the target system during the
postcopy process.

For storage key virtualization, we have to forbid the empty zero page as
the storage key is a property of the physical page frame.  As we enable
storage key handling lazily we then drop all mappings for empty zero
pages for lazy refaulting later on.

This does not work with the postcopy migration, which relies on the
empty zero page never triggering a fault again in the future. The reason
is that postcopy migration will simply read a page on the target system
if that page is a known zero page to fault in an empty zero page.  At
the same time postcopy remembers that this page was already transferred
- so any future userfault on that page will NOT be retransmitted again
to avoid races.

If now the guest enters the storage key mode while in postcopy, we will
break this assumption of postcopy.

The solution is to disable the empty zero page for KVM guests early on
and not during storage key enablement. With this change, the postcopy
migration process is guaranteed to start after no zero pages are left.

As guest pages are very likely not empty zero pages anyway the memory
overhead is also pretty small.

While at it this also adds proper page table locking to the zero page
removal.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Acked-by: Janosch Frank <frankja@linux.vnet.ibm.com>
Cc: stable@vger.kernel.org
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2017-08-29 16:31:27 +02:00
..
appldata sched/headers: Move task statistics APIs from <linux/sched.h> to <linux/sched/stat.h> 2017-03-03 01:43:43 +01:00
boot s390/decompressor: fix initrd corruption caused by bss clear 2017-03-22 08:21:20 +01:00
configs s390: update defconfig 2017-06-08 15:53:48 +02:00
crypto s390/crypto: fix aes/paes Kconfig dependeny 2017-06-12 16:25:58 +02:00
hypfs s390: hypfs: make inode explicitly non-modular 2016-10-31 17:55:40 +01:00
include s390/mm: avoid empty zero pages for KVM guests to avoid postcopy hangs 2017-08-29 16:31:27 +02:00
kernel s390/dasd: Change unsigned long long to unsigned long 2017-08-23 13:31:51 +02:00
kvm KVM: s390: use new mm defines instead of magic values 2017-07-26 08:25:10 +02:00
lib s390/uaccess: avoid mvcos jump label 2017-08-29 16:29:10 +02:00
mm s390/mm: avoid empty zero pages for KVM guests to avoid postcopy hangs 2017-08-29 16:31:27 +02:00
net bpf: Add jited_len to struct bpf_prog 2017-06-06 15:41:24 -04:00
numa s390/numa: pin all possible cpus to nodes early 2016-12-07 07:23:33 +01:00
oprofile s390/dumpstack: restore reliable indicator for call traces 2016-10-17 14:44:30 +02:00
pci s390/pci: log changes to uid checking 2017-08-09 09:09:41 -04:00
tools s390/facilities: fix typo 2017-08-29 16:29:04 +02:00
defconfig s390: update defconfig 2017-06-08 15:53:48 +02:00
Kbuild s390/crypto: Provide s390 specific arch random functionality. 2017-04-26 13:41:35 +02:00
Kconfig s390: add support for IBM z14 machines 2017-07-26 08:25:15 +02:00
Kconfig.debug Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux 2017-02-22 10:20:04 -08:00
Makefile s390: add support for IBM z14 machines 2017-07-26 08:25:15 +02:00