From patchwork Mon Jan 24 09:02:32 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 80129 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id D7BE91007D4 for ; Mon, 24 Jan 2011 20:59:01 +1100 (EST) Received: from localhost ([127.0.0.1]:35442 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PhJCM-0003BM-OJ for incoming@patchwork.ozlabs.org; Mon, 24 Jan 2011 04:58:58 -0500 Received: from [140.186.70.92] (port=38085 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PhIMX-0008Pv-6T for qemu-devel@nongnu.org; Mon, 24 Jan 2011 04:05:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PhIMQ-0007GF-7I for qemu-devel@nongnu.org; Mon, 24 Jan 2011 04:05:25 -0500 Received: from mx1.redhat.com ([209.132.183.28]:40430) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PhIMP-0007F9-VB for qemu-devel@nongnu.org; Mon, 24 Jan 2011 04:05:18 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id p0O95GoR014732 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 24 Jan 2011 04:05:17 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p0O95GHv018159; Mon, 24 Jan 2011 04:05:16 -0500 Received: from amt.cnet (vpn2-9-29.ams2.redhat.com [10.36.9.29]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id p0O95E0X008934; Mon, 24 Jan 2011 04:05:15 -0500 Received: from amt.cnet (localhost.localdomain [127.0.0.1]) by amt.cnet (Postfix) with ESMTP id 1EED765215A; Mon, 24 Jan 2011 07:04:28 -0200 (BRST) Received: (from marcelo@localhost) by amt.cnet (8.14.4/8.14.4/Submit) id p0O94OsO028419; Mon, 24 Jan 2011 07:04:24 -0200 From: Marcelo Tosatti To: Anthony Liguori Date: Mon, 24 Jan 2011 07:02:32 -0200 Message-Id: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Cc: Jan Kiszka , Glauber Costa , Marcelo Tosatti , qemu-devel@nongnu.org, kvm@vger.kernel.org Subject: [Qemu-devel] [PATCH 23/31] kvm: x86: Reset paravirtual MSRs X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Jan Kiszka Make sure to write the cleared MSR_KVM_SYSTEM_TIME, MSR_KVM_WALL_CLOCK, and MSR_KVM_ASYNC_PF_EN to the kernel state so that a freshly booted guest cannot be disturbed by old values. Signed-off-by: Jan Kiszka CC: Glauber Costa Signed-off-by: Marcelo Tosatti --- target-i386/kvm.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/target-i386/kvm.c b/target-i386/kvm.c index 454ddb1..825af42 100644 --- a/target-i386/kvm.c +++ b/target-i386/kvm.c @@ -845,6 +845,13 @@ static int kvm_put_msrs(CPUState *env, int level) if (smp_cpus == 1 || env->tsc != 0) { kvm_msr_entry_set(&msrs[n++], MSR_IA32_TSC, env->tsc); } + } + /* + * The following paravirtual MSRs have side effects on the guest or are + * too heavy for normal writeback. Limit them to reset or full state + * updates. + */ + if (level >= KVM_PUT_RESET_STATE) { kvm_msr_entry_set(&msrs[n++], MSR_KVM_SYSTEM_TIME, env->system_time_msr); kvm_msr_entry_set(&msrs[n++], MSR_KVM_WALL_CLOCK, env->wall_clock_msr);