public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Marcelo Tosatti <mtosatti@redhat.com>
To: kvm@vger.kernel.org
Cc: Glauber de Oliveira Costa <gcosta@redhat.com>,
	Mark McLoughlin <markmc@redhat.com>
Subject: qemu: kvm: avoid harmless unhandled wrmsr 0xc0010117 messages
Date: Thu, 7 May 2009 15:48:48 -0300	[thread overview]
Message-ID: <20090507184848.GA32150@amt.cnet> (raw)


Olders kernel which don't contain kvm.git commit
61a6bd672bda3b9468bf5895c1be085c4e481138 display the following message:

kvm: 32301: cpu0 unhandled wrmsr: 0xc0010117 data 0 

When kvm_arch_load_regs is called. This is confusing in bug reports.

Avoid it by checking whether the host advertises the MSR, similarly to
how MSR_STAR is handled.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>


diff --git a/qemu-kvm-x86.c b/qemu-kvm-x86.c
index 06ef775..5d19705 100644
--- a/qemu-kvm-x86.c
+++ b/qemu-kvm-x86.c
@@ -25,6 +25,7 @@
 static struct kvm_msr_list *kvm_msr_list;
 extern unsigned int kvm_shadow_memory;
 static int kvm_has_msr_star;
+static int kvm_has_vm_hsave_pa;
 
 static int lm_capable_kernel;
 
@@ -54,10 +55,14 @@ int kvm_arch_qemu_create_context(void)
     kvm_msr_list = kvm_get_msr_list(kvm_context);
     if (!kvm_msr_list)
 		return -1;
-    for (i = 0; i < kvm_msr_list->nmsrs; ++i)
+    for (i = 0; i < kvm_msr_list->nmsrs; ++i) {
 	if (kvm_msr_list->indices[i] == MSR_STAR)
 	    kvm_has_msr_star = 1;
-	return 0;
+        if (kvm_msr_list->indices[i] == MSR_VM_HSAVE_PA)
+            kvm_has_vm_hsave_pa = 1;
+    }
+
+    return 0;
 }
 
 static void set_msr_entry(struct kvm_msr_entry *entry, uint32_t index,
@@ -260,7 +265,8 @@ void kvm_arch_load_regs(CPUState *env)
     set_msr_entry(&msrs[n++], MSR_IA32_SYSENTER_EIP, env->sysenter_eip);
     if (kvm_has_msr_star)
 	set_msr_entry(&msrs[n++], MSR_STAR,              env->star);
-    set_msr_entry(&msrs[n++], MSR_VM_HSAVE_PA, env->vm_hsave);
+    if (kvm_has_vm_hsave_pa)
+        set_msr_entry(&msrs[n++], MSR_VM_HSAVE_PA, env->vm_hsave);
 #ifdef TARGET_X86_64
     if (lm_capable_kernel) {
         set_msr_entry(&msrs[n++], MSR_CSTAR,             env->cstar);
@@ -435,7 +441,8 @@ void kvm_arch_save_regs(CPUState *env)
     if (kvm_has_msr_star)
 	msrs[n++].index = MSR_STAR;
     msrs[n++].index = MSR_IA32_TSC;
-    msrs[n++].index = MSR_VM_HSAVE_PA;
+    if (kvm_has_vm_hsave_pa)
+        msrs[n++].index = MSR_VM_HSAVE_PA;
 #ifdef TARGET_X86_64
     if (lm_capable_kernel) {
         msrs[n++].index = MSR_CSTAR;


             reply	other threads:[~2009-05-07 18:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-07 18:48 Marcelo Tosatti [this message]
2009-05-31 14:26 ` qemu: kvm: avoid harmless unhandled wrmsr 0xc0010117 messages Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090507184848.GA32150@amt.cnet \
    --to=mtosatti@redhat.com \
    --cc=gcosta@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=markmc@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox