From patchwork Tue May 4 18:35:28 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Glauber Costa X-Patchwork-Id: 96851 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 o44IbvKg015738 for ; Tue, 4 May 2010 18:37:59 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933431Ab0EDShb (ORCPT ); Tue, 4 May 2010 14:37:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:62427 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760063Ab0EDSha (ORCPT ); Tue, 4 May 2010 14:37:30 -0400 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o44IbTwa021546 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 4 May 2010 14:37:29 -0400 Received: from localhost.localdomain (virtlab1.virt.bos.redhat.com [10.16.72.21]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o44IbPOI030879; Tue, 4 May 2010 14:37:28 -0400 From: Glauber Costa To: kvm@vger.kernel.org Cc: avi@redhat.com, zamsden@redhat.com, mtosatti@redhat.com Subject: [PATCH 2/2] turn off kvmclock when resetting cpu Date: Tue, 4 May 2010 14:35:28 -0400 Message-Id: <1272998128-30384-3-git-send-email-glommer@redhat.com> In-Reply-To: <1272998128-30384-2-git-send-email-glommer@redhat.com> References: <1272998128-30384-1-git-send-email-glommer@redhat.com> <1272998128-30384-2-git-send-email-glommer@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.21 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]); Tue, 04 May 2010 18:37:59 +0000 (UTC) diff --git a/qemu-kvm-x86.c b/qemu-kvm-x86.c index 439c31a..4b94e04 100644 --- a/qemu-kvm-x86.c +++ b/qemu-kvm-x86.c @@ -1417,8 +1417,27 @@ void kvm_arch_push_nmi(void *opaque) } #endif /* KVM_CAP_USER_NMI */ +static int kvm_turn_off_clock(CPUState *env) +{ + struct { + struct kvm_msrs info; + struct kvm_msr_entry entries[100]; + } msr_data; + + struct kvm_msr_entry *msrs = msr_data.entries; + int n = 0; + + kvm_msr_entry_set(&msrs[n++], MSR_KVM_SYSTEM_TIME, 0); + kvm_msr_entry_set(&msrs[n++], MSR_KVM_WALL_CLOCK, 0); + msr_data.info.nmsrs = n; + + return kvm_vcpu_ioctl(env, KVM_SET_MSRS, &msr_data); +} + + void kvm_arch_cpu_reset(CPUState *env) { + kvm_turn_off_clock(env); kvm_arch_reset_vcpu(env); kvm_reset_mpstate(env); }