Skip to contentSkip to conversation

KVM fix for QEMU 4.2-rc

GIT PULL Applied Paolo Bonzini 2 participants 4 messages Dec 6, 2019

lore
Share & tools
lore
#0 lore raw

The following changes since commit 1bdc319ab5d289ce6b822e06fb2b13666fd9278e:

Update version for v4.2.0-rc4 release (2019-12-03 17:56:30 +0000)

are available in the Git repository at:

git://github.com/bonzini/qemu.git tags/for-upstream

for you to fetch changes up to 2605188240f939fa9ae9353f53a0985620b34769:

target/i386: disable VMX features if nested=0 (2019-12-06 12:35:40 +0100)

----------------------------------------------------------------
* fix for x86 KVM on older kernels (Yang Zhong)

----------------------------------------------------------------
Yang Zhong (1):
target/i386: disable VMX features if nested=0

 target/i386/kvm.c | 8 ++++++++
 1 file changed, 8 insertions(+)
Signature · 1 line
2.21.0
#1 lore raw

[PULL 1/1] target/i386: disable VMX features if nested=0

From: Yang Zhong <[email protected]>

If kvm does not support VMX feature by nested=0, the kvm_vmx_basic can't get the right value from MSR_IA32_VMX_BASIC register, which make qemu coredump when qemu do KVM_SET_MSRS.

The coredump info:
error: failed to set MSR 0x480 to 0x0
kvm_put_msrs: Assertion `ret == cpu->kvm_msr_buf->nmsrs' failed.

Message-Id: <[email protected]>

---
 target/i386/kvm.c | 8 ++++++++
 1 file changed, 8 insertions(+)
target/i386/kvm.c +8 -0
index bf1655645b..1d10046a6c 100644
@@ -2572,6 +2572,14 @@ static void kvm_msr_entry_add_vmx(X86CPU *cpu, FeatureWordArray f)
     uint64_t kvm_vmx_basic =
         kvm_arch_get_supported_msr_feature(kvm_state,
                                            MSR_IA32_VMX_BASIC);
+
+    if (!kvm_vmx_basic) {
+        /* If the kernel doesn't support VMX feature (kvm_intel.nested=0),
+         * then kvm_vmx_basic will be 0 and KVM_SET_MSR will fail.
+         */
+        return;
+    }
+
     uint64_t kvm_vmx_misc =
         kvm_arch_get_supported_msr_feature(kvm_state,
                                            MSR_IA32_VMX_MISC);
Signature · 1 line
2.21.0
#2 lore raw
In reply to Paolo Bonzini
Quoted 7 lines · Paolo Bonzini

The following changes since commit 1bdc319ab5d289ce6b822e06fb2b13666fd9278e:

Update version for v4.2.0-rc4 release (2019-12-03 17:56:30 +0000)

are available in the Git repository at:

Quoted 8 lines

git://github.com/bonzini/qemu.git tags/for-upstream

for you to fetch changes up to 2605188240f939fa9ae9353f53a0985620b34769:

target/i386: disable VMX features if nested=0 (2019-12-06 12:35:40 +0100)

----------------------------------------------------------------
* fix for x86 KVM on older kernels (Yang Zhong)

I know you talked to me on irc about this, but pull request cover letters at this stage in the release process really need detailed discussion of what is being fixed, the severity of the bug and why it needs to go into this release rather than waiting for 5.0...

Quoted 9 lines

----------------------------------------------------------------
Yang Zhong (1):
target/i386: disable VMX features if nested=0

 target/i386/kvm.c | 8 ++++++++
 1 file changed, 8 insertions(+)

--
2.21.0

thanks
-- PMM

#3 lore raw
In reply to Paolo Bonzini
Quoted 11 lines · Paolo Bonzini

The following changes since commit 1bdc319ab5d289ce6b822e06fb2b13666fd9278e:

Update version for v4.2.0-rc4 release (2019-12-03 17:56:30 +0000)

are available in the Git repository at:

git://github.com/bonzini/qemu.git tags/for-upstream

for you to fetch changes up to 2605188240f939fa9ae9353f53a0985620b34769:

Quoted 8 lines

target/i386: disable VMX features if nested=0 (2019-12-06 12:35:40 +0100)

----------------------------------------------------------------
* fix for x86 KVM on older kernels (Yang Zhong)

----------------------------------------------------------------
Yang Zhong (1):
target/i386: disable VMX features if nested=0

Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/4.2
for any user-visible changes.

-- PMM