linux-stable/arch
Nico Boehr 12bda36df5 KVM: s390: disable migration mode when dirty tracking is disabled
commit f2d3155e2a upstream.

Migration mode is a VM attribute which enables tracking of changes in
storage attributes (PGSTE). It assumes dirty tracking is enabled on all
memslots to keep a dirty bitmap of pages with changed storage attributes.

When enabling migration mode, we currently check that dirty tracking is
enabled for all memslots. However, userspace can disable dirty tracking
without disabling migration mode.

Since migration mode is pointless with dirty tracking disabled, disable
migration mode whenever userspace disables dirty tracking on any slot.

Also update the documentation to clarify that dirty tracking must be
enabled when enabling migration mode, which is already enforced by the
code in kvm_s390_vm_start_migration().

Also highlight in the documentation for KVM_S390_GET_CMMA_BITS that it
can now fail with -EINVAL when dirty tracking is disabled while
migration mode is on. Move all the error codes to a table so this stays
readable.

To disable migration mode, slots_lock should be held, which is taken
in kvm_set_memory_region() and thus held in
kvm_arch_prepare_memory_region().

Restructure the prepare code a bit so all the sanity checking is done
before disabling migration mode. This ensures migration mode isn't
disabled when some sanity check fails.

Cc: stable@vger.kernel.org
Fixes: 190df4a212 ("KVM: s390: CMMA tracking, ESSA emulation, migration mode")
Signed-off-by: Nico Boehr <nrb@linux.ibm.com>
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Link: https://lore.kernel.org/r/20230127140532.230651-2-nrb@linux.ibm.com
Message-Id: <20230127140532.230651-2-nrb@linux.ibm.com>
[frankja@linux.ibm.com: fixed commit message typo, moved api.rst error table upwards]
Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-03-10 09:34:05 +01:00
..
alpha alpha/boot/tools/objstrip: fix the check for ELF header 2023-03-10 09:33:30 +01:00
arc ARC: mm: fix leakage of memory allocated for PTE 2022-10-17 16:32:12 -07:00
arm ARM: dts: exynos: Use Exynos5420 compatible for the MIPI video phy 2023-03-10 09:33:45 +01:00
arm64 arm64: zynqmp: Enable hs termination flag for USB dwc3 controller 2023-03-10 09:33:46 +01:00
csky - hfs and hfsplus kmap API modernization from Fabio Francesco 2022-10-12 11:00:22 -07:00
hexagon - hfs and hfsplus kmap API modernization from Fabio Francesco 2022-10-12 11:00:22 -07:00
ia64 ia64: fix build error due to switch case label appearing next to declaration 2023-02-09 11:28:23 +01:00
loongarch LoongArch, bpf: Use 4 instructions for function address in JIT 2023-03-10 09:33:06 +01:00
m68k m68k: Check syscall_trace_enter() return code 2023-03-10 09:33:51 +01:00
microblaze kbuild: fix "cat: .version: No such file or directory" 2022-11-24 09:26:02 +09:00
mips of/fdt: run soc memory setup when early_init_dt_scan_memory fails 2023-01-12 12:02:51 +01:00
nios2 nios2: add FORCE for vmlinuz.gz 2022-11-27 08:28:41 +09:00
openrisc OpenRISC 6.1 Updates 2022-10-15 16:47:33 -07:00
parisc parisc: Wire up PTRACE_GETREGS/PTRACE_SETREGS for compat case 2023-02-09 11:28:20 +01:00
powerpc powerpc: Remove linker flag from KBUILD_AFLAGS 2023-03-10 09:33:41 +01:00
riscv RISC-V: time: initialize hrtimer based broadcast clock event device 2023-03-10 09:33:03 +01:00
s390 KVM: s390: disable migration mode when dirty tracking is disabled 2023-03-10 09:34:05 +01:00
sh sh: define RUNTIME_DISCARD_EXIT 2023-02-25 11:25:42 +01:00
sparc sparc: allow PM configs for sparc32 COMPILE_TEST 2023-03-10 09:33:27 +01:00
um um: virt-pci: Avoid GCC non-NULL warning 2023-01-07 11:11:52 +01:00
x86 x86/bugs: Reset speculation control settings on init 2023-03-10 09:33:49 +01:00
xtensa xtensa: add __umulsidi3 helper 2023-01-07 11:11:46 +01:00
.gitignore
Kconfig ftrace: Allow WITH_ARGS flavour of graph tracer with shadow call stack 2022-12-31 13:32:45 +01:00