kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] target/i386: relax assert when old host kernels don't include msrs
@ 2019-12-04  8:50 Catherine Ho
  2019-12-04 11:22 ` Paolo Bonzini
  0 siblings, 1 reply; 11+ messages in thread
From: Catherine Ho @ 2019-12-04  8:50 UTC (permalink / raw)
  To: Paolo Bonzini, Marcelo Tosatti, qemu-devel
  Cc: Richard Henderson, Eduardo Habkost, kvm, Catherine Ho, Paolo Bonzini

Commit 20a78b02d315 ("target/i386: add VMX features") unconditionally
add vmx msr entry although older host kernels don't include them.

But old host kernel + newest qemu will cause a qemu crash as follows:
qemu-system-x86_64: error: failed to set MSR 0x480 to 0x0
target/i386/kvm.c:2932: kvm_put_msrs: Assertion `ret ==
cpu->kvm_msr_buf->nmsrs' failed.

This fixes it by relaxing the condition.

Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Catherine Ho <catherine.hecx@gmail.com>
---
 target/i386/kvm.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/target/i386/kvm.c b/target/i386/kvm.c
index bf16556..a8c44bf 100644
--- a/target/i386/kvm.c
+++ b/target/i386/kvm.c
@@ -2936,7 +2936,7 @@ static int kvm_put_msrs(X86CPU *cpu, int level)
                      (uint32_t)e->index, (uint64_t)e->data);
     }
 
-    assert(ret == cpu->kvm_msr_buf->nmsrs);
+    assert(ret <= cpu->kvm_msr_buf->nmsrs);
     return 0;
 }
 
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2019-12-06 23:49 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-04  8:50 [PATCH] target/i386: relax assert when old host kernels don't include msrs Catherine Ho
2019-12-04 11:22 ` Paolo Bonzini
     [not found]   ` <CAEn6zmFex9WJ9jr5-0br7YzQZ=jA5bQn314OM+U=Q6ZGPiCRAg@mail.gmail.com>
2019-12-04 13:53     ` Paolo Bonzini
2019-12-04 15:07       ` Catherine Ho
2019-12-04 15:34         ` Paolo Bonzini
2019-12-04 15:47           ` Eduardo Habkost
2019-12-04 16:23             ` Paolo Bonzini
2019-12-06 10:23           ` [PATCH] target/i386: skip kvm_msr_entry_add when kvm_vmx_basic is 0 Catherine Ho
2019-12-06 10:28             ` Catherine Ho
2019-12-06 11:30             ` Paolo Bonzini
2019-12-06 23:48             ` no-reply

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).