[Qemu-devel] [PATCH 0/3] kvm: use kvm_vm_check_extension() with VM capabilities

Greg Kurz posted 3 patches 6 years, 7 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/150541711102.1616.2690784964841960181.stgit@bahia.lan
Test checkpatch passed
Test docker passed
Test s390x passed
There is a newer version of this series
accel/kvm/kvm-all.c |   47 ++++++++++++++++++++++++-----------------------
target/ppc/kvm.c    |    6 +++---
2 files changed, 27 insertions(+), 26 deletions(-)
[Qemu-devel] [PATCH 0/3] kvm: use kvm_vm_check_extension() with VM capabilities
Posted by Greg Kurz 6 years, 7 months ago
Some VM capabilities are currently checked with kvm_check_extension(). This
doesn't have any impact for most host architectures because they don't depend
on the KVM type. However, this is a problem for server-class ppc hosts that
can support the PR and HV KVM types. Both implementations can co-exist in the
kernel at the same time and we decide which one will be used with the "type"
argument of the KVM_CREATE_VM ioctl.

Each KVM type has a different set of capabilities, and checking them with
kvm_check_extension() will always cause KVM to assume we're in HV mode,
even if they are VM specific and we have explicitely requested to run in
PR mode. This may produce unexpected results.

A similar issue was recently fix in the ppc code:

https://lists.nongnu.org/archive/html/qemu-devel/2017-09/msg03751.html

This series goes a bit further, and turns more kvm_check_extension() into
kvm_vm_check_extension() where appropriate.

--
Greg

---

Greg Kurz (3):
      kvm: check KVM_CAP_SYNC_MMU with kvm_vm_check_extension()
      kvm: check KVM_CAP_NR_VCPUS with kvm_vm_check_extension()
      ppc/kvm: check some capabilities with kvm_vm_check_extension()


 accel/kvm/kvm-all.c |   47 ++++++++++++++++++++++++-----------------------
 target/ppc/kvm.c    |    6 +++---
 2 files changed, 27 insertions(+), 26 deletions(-)