From patchwork Wed May 5 19:19:21 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Glauber Costa X-Patchwork-Id: 97174 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o45JLbhc032747 for ; Wed, 5 May 2010 19:21:44 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757786Ab0EETVj (ORCPT ); Wed, 5 May 2010 15:21:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55250 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755146Ab0EETVi (ORCPT ); Wed, 5 May 2010 15:21:38 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o45JLb13018542 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 5 May 2010 15:21:37 -0400 Received: from localhost.localdomain (virtlab1.virt.bos.redhat.com [10.16.72.21]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o45JLWAK028191; Wed, 5 May 2010 15:21:36 -0400 From: Glauber Costa To: kvm@vger.kernel.org Cc: avi@redhat.com, zamsden@redhat.com, mtosatti@redhat.com Subject: [PATCH v2 2/2] turn off kvmclock when resetting cpu Date: Wed, 5 May 2010 15:19:21 -0400 Message-Id: <1273087161-32428-3-git-send-email-glommer@redhat.com> In-Reply-To: <1273087161-32428-2-git-send-email-glommer@redhat.com> References: <1273087161-32428-1-git-send-email-glommer@redhat.com> <1273087161-32428-2-git-send-email-glommer@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Wed, 05 May 2010 19:21:44 +0000 (UTC) diff --git a/qemu-kvm-x86.c b/qemu-kvm-x86.c index 5a2b552..bd74316 100644 --- a/qemu-kvm-x86.c +++ b/qemu-kvm-x86.c @@ -1417,8 +1417,31 @@ void kvm_arch_push_nmi(void *opaque) } #endif /* KVM_CAP_USER_NMI */ +static int kvm_reset_msrs(CPUState *env) +{ + struct { + struct kvm_msrs info; + struct kvm_msr_entry entries[100]; + } msr_data; + int n; + struct kvm_msr_entry *msrs = msr_data.entries; + + if (!kvm_msr_list) + return -1; + + for (n = 0; n < kvm_msr_list->nmsrs; n++) { + kvm_msr_entry_set(&msrs[n], kvm_msr_list->indices[n], 0); + } + + msr_data.info.nmsrs = n; + + return kvm_vcpu_ioctl(env, KVM_SET_MSRS, &msr_data); +} + + void kvm_arch_cpu_reset(CPUState *env) { + kvm_reset_msrs(env); kvm_arch_reset_vcpu(env); kvm_reset_mpstate(env); }