From patchwork Thu Feb 25 08:48:47 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 81919 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 o1P8neP5017655 for ; Thu, 25 Feb 2010 08:49:40 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752107Ab0BYIti (ORCPT ); Thu, 25 Feb 2010 03:49:38 -0500 Received: from fmmailgate03.web.de ([217.72.192.234]:33259 "EHLO fmmailgate03.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752594Ab0BYIti (ORCPT ); Thu, 25 Feb 2010 03:49:38 -0500 Received: from smtp08.web.de (fmsmtp08.dlan.cinetic.de [172.20.5.216]) by fmmailgate03.web.de (Postfix) with ESMTP id 0432E14000088; Thu, 25 Feb 2010 09:48:54 +0100 (CET) Received: from [88.65.45.119] (helo=[192.168.1.10]) by smtp08.web.de with asmtp (TLSv1:AES256-SHA:256) (WEB.DE 4.110 #314) id 1NkZOv-000673-00; Thu, 25 Feb 2010 09:48:53 +0100 Message-ID: <4B86396F.8070208@web.de> Date: Thu, 25 Feb 2010 09:48:47 +0100 From: Jan Kiszka User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666 MIME-Version: 1.0 To: Marcelo Tosatti CC: Avi Kivity , kvm@vger.kernel.org, qemu-devel@nongnu.org, Gleb Natapov , Zachary Amsden Subject: Re: [PATCH v3 07/10] qemu-kvm: Cleanup/fix TSC and PV clock writeback References: <20100224231708.GB16246@amt.cnet> <4B85BA33.5080008@web.de> <20100224234935.GA17862@amt.cnet> <4B85BD22.6050209@web.de> <20100225035814.GA470@amt.cnet> In-Reply-To: <20100225035814.GA470@amt.cnet> X-Enigmail-Version: 0.95.7 X-Sender: jan.kiszka@web.de X-Provags-ID: V01U2FsdGVkX1+0wFgiL66GA5MYitdtF50V7xSHUIGEU16L+DYA A2/7QBNSwhlAS/Re8rri6Rtoip1j/TakUMd7jhXFJkZYhE53hQ 8eG/WDYMk= 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]); Thu, 25 Feb 2010 08:49:40 +0000 (UTC) diff --git a/qemu-kvm-x86.c b/qemu-kvm-x86.c index 84fd7fa..285c05a 100644 --- a/qemu-kvm-x86.c +++ b/qemu-kvm-x86.c @@ -966,7 +966,15 @@ void kvm_arch_load_regs(CPUState *env, int level) } #endif if (level == KVM_PUT_FULL_STATE) { - set_msr_entry(&msrs[n++], MSR_IA32_TSC, env->tsc); + /* + * KVM is yet unable to synchronize TSC values of multiple VCPUs on + * writeback. Until this is fixed, we only write the offset to SMP + * guests after migration, desynchronizing the VCPUs, but avoiding + * huge jump-backs that would occur without any writeback at all. + */ + if (smp_cpus == 1 || env->tsc != 0) { + set_msr_entry(&msrs[n++], MSR_IA32_TSC, env->tsc); + } set_msr_entry(&msrs[n++], MSR_KVM_SYSTEM_TIME, env->system_time_msr); set_msr_entry(&msrs[n++], MSR_KVM_WALL_CLOCK, env->wall_clock_msr); }