android_kernel_xiaomi_sm8450/Documentation/virt/kvm
Nico Boehr edd7f5bc6f KVM: s390: disable migration mode when dirty tracking is disabled
commit f2d3155e2a6bac44d16f04415a321e8707d895c6 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-11 16:39:58 +01:00
..
arm Documentation/kvm/arm: improve description of HVC_SOFT_RESTART 2020-09-11 19:29:10 +01:00
devices KVM: s390: disable migration mode when dirty tracking is disabled 2023-03-11 16:39:58 +01:00
amd-memory-encryption.rst docs: kvm: fix referenced ioctl symbol 2020-09-09 11:19:39 -06:00
api.rst KVM: s390: disable migration mode when dirty tracking is disabled 2023-03-11 16:39:58 +01:00
cpuid.rst x86/kvm: Reserve KVM_FEATURE_MSI_EXT_DEST_ID 2020-10-28 13:52:05 -04:00
halt-polling.rst docs: virt: convert halt-polling.txt to ReST format 2020-02-12 20:09:50 +01:00
hypercalls.rst docs: fix broken references to text files 2020-04-20 15:35:59 -06:00
index.rst docs/virt/kvm: Document configuring and running nested guests 2020-05-06 05:45:47 -04:00
locking.rst KVM: Documentation: Update fast page fault for indirect sp 2020-03-16 17:58:56 +01:00
mmu.rst KVM: X86: MMU: Use the correct inherited permissions to get shadow page 2021-06-16 12:01:40 +02:00
msr.rst KVM: x86: announce KVM_FEATURE_ASYNC_PF_INT 2020-06-01 04:26:08 -04:00
nested-vmx.rst docs: kvm: Replace HTTP links with HTTPS ones 2020-07-13 09:34:07 -06:00
ppc-pv.rst docs: kvm: Convert ppc-pv.txt to ReST format 2020-02-12 20:10:05 +01:00
review-checklist.rst docs: fix broken references for ReST files that moved around 2020-04-20 15:45:03 -06:00
running-nested-guests.rst docs/virt/kvm: Document configuring and running nested guests 2020-05-06 05:45:47 -04:00
s390-diag.rst docs: kvm: Convert s390-diag.txt to ReST format 2020-02-12 20:10:06 +01:00
s390-pv-boot.rst DOCUMENTATION: Protected virtual machine introduction and IPL 2020-02-27 19:47:12 +01:00
s390-pv.rst Documentation: virt: kvm/s390-pv: drop doubled words 2020-07-05 14:42:17 -06:00
timekeeping.rst docs: kvm: Convert timekeeping.txt to ReST format 2020-02-12 20:10:06 +01:00
vcpu-requests.rst Documentation: move Documentation/virtual to Documentation/virt 2019-07-24 10:52:11 +02:00