From patchwork Thu May 7 18:48:48 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 22371 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n47InR7W004470 for ; Thu, 7 May 2009 18:49:28 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754569AbZEGStY (ORCPT ); Thu, 7 May 2009 14:49:24 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755328AbZEGStX (ORCPT ); Thu, 7 May 2009 14:49:23 -0400 Received: from mx2.redhat.com ([66.187.237.31]:34928 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755231AbZEGStX (ORCPT ); Thu, 7 May 2009 14:49:23 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n47InOb8011859 for ; Thu, 7 May 2009 14:49:24 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n47InN5Z008393; Thu, 7 May 2009 14:49:23 -0400 Received: from amt.cnet (vpn-10-132.str.redhat.com [10.32.10.132]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n47InLOf014232; Thu, 7 May 2009 14:49:22 -0400 Received: from amt.cnet (amt.cnet [127.0.0.1]) by amt.cnet (Postfix) with ESMTP id 085DC682004; Thu, 7 May 2009 15:48:50 -0300 (BRT) Received: (from marcelo@localhost) by amt.cnet (8.14.3/8.14.3/Submit) id n47ImmsF032396; Thu, 7 May 2009 15:48:49 -0300 Date: Thu, 7 May 2009 15:48:48 -0300 From: Marcelo Tosatti To: kvm@vger.kernel.org Cc: Glauber de Oliveira Costa , Mark McLoughlin Subject: qemu: kvm: avoid harmless unhandled wrmsr 0xc0010117 messages Message-ID: <20090507184848.GA32150@amt.cnet> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.19 (2009-01-05) X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org 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 --- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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;