Skip to content

KVM: x86: Partially allow KVM_SET_CPUID{,2} after KVM_RUN for CPU hotplug

Vitaly Kuznetsov kvm lkml 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest5 patches 3 repliesIn review
  2. v34 patches 3 repliesSuperseded
  3. v24 patches 9 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v15 patches4 repliesSuperseded

Changes in v4 from the cover letter

- Use memcmp() [Sean].
- Update the comment in kvm_set_cpuid() making (hopefully) it more clear that the introduced check does not cover all potentially problemmatic scenarios [Sean].
- Add "KVM: x86: Move CPUID.(EAX=0x12,ECX=1) mangling to __kvm_update_cpuid_runtime()" patch.

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5KVM: x86: Do runtime CPUID update before updating vcpu->arch.cpuid_entriesarch/x86/kvm/cpuid.c+24 -100 replies
2/5KVM: x86: Move CPUID.(EAX=0x12,ECX=1) mangling to __kvm_update_cpuid_runtime()arch/x86/kvm/cpuid.c+33 -213 replies
3/5KVM: x86: Partially allow KVM_SET_CPUID{,2} after KVM_RUNarch/x86/kvm/cpuid.c arch/x86/kvm/x86.c+31 -190 replies
4/5KVM: selftests: Rename 'get_cpuid_test' to 'cpuid_test'tools/testing/selftests/kvm/.gitignore tools/testing/selftests/kvm/Makefile tools/testing/selftests/kvm/x86_64/cpuid_test.c+3 -30 replies
5/5KVM: selftests: Test KVM_SET_CPUID2 after KVM_RUNtools/testing/selftests/kvm/include/x86_64/processor.h tools/testing/selftests/kvm/lib/x86_64/processor.c tools/testing/selftests/kvm/x86_64/cpuid_test.c+66 -40 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v4 yet.

Read the v4 thread

Cover letter [PATCH v4 0/5] KVM: x86: Partially allow KVM_SET_CPUID{,2} after KVM_RUN for CPU hotplug

Changes since v3:
- Use memcmp() [Sean].
- Update the comment in kvm_set_cpuid() making (hopefully) it more clear that the introduced check does not cover all potentially problemmatic scenarios [Sean].
- Add "KVM: x86: Move CPUID.(EAX=0x12,ECX=1) mangling to __kvm_update_cpuid_runtime()" patch.

Original description:

Recently, KVM made it illegal to change CPUID after KVM_RUN but unfortunately this change is not fully compatible with existing VMMs. In particular, QEMU reuses vCPU fds for CPU hotplug after unplug and it calls KVM_SET_CPUID2. Relax the requirement by implementing an allowing KVM_SET_CPUID{,2} with the exact same data.

Vitaly Kuznetsov (5):
KVM: x86: Do runtime CPUID update before updating

    vcpu->arch.cpuid_entries

KVM: x86: Move CPUID.(EAX=0x12,ECX=1) mangling to
__kvm_update_cpuid_runtime()
KVM: x86: Partially allow KVM_SET_CPUID{,2} after KVM_RUN
KVM: selftests: Rename 'get_cpuid_test' to 'cpuid_test'
KVM: selftests: Test KVM_SET_CPUID2 after KVM_RUN

 arch/x86/kvm/cpuid.c                          | 119 +++++++++++++-----
 arch/x86/kvm/x86.c                            |  19 ---
 tools/testing/selftests/kvm/.gitignore        |   2 +-
 tools/testing/selftests/kvm/Makefile          |   4 +-
 .../selftests/kvm/include/x86_64/processor.h  |   7 ++
 .../selftests/kvm/lib/x86_64/processor.c      |  33 ++++-
 .../x86_64/{get_cpuid_test.c => cpuid_test.c} |  30 +++++
 7 files changed, 157 insertions(+), 57 deletions(-)
 rename tools/testing/selftests/kvm/x86_64/{get_cpuid_test.c => cpuid_test.c} (83%)
Signature · 1 line
2.34.1