From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50849) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XTvET-0001cD-Pd for qemu-devel@nongnu.org; Tue, 16 Sep 2014 12:04:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XTvEL-0001YA-Fz for qemu-devel@nongnu.org; Tue, 16 Sep 2014 12:03:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:23533) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XTvEL-0001Ww-9l for qemu-devel@nongnu.org; Tue, 16 Sep 2014 12:03:49 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s8GG3iSP006308 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Tue, 16 Sep 2014 12:03:45 -0400 Message-ID: <54185F5C.60906@redhat.com> Date: Tue, 16 Sep 2014 18:03:40 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <20140916151437.GA27819@amt.cnet> <54185A58.2010105@redhat.com> <20140916155526.GB29476@amt.cnet> In-Reply-To: <20140916155526.GB29476@amt.cnet> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH] kvmclock: clarify usage of cpu_clean_all_dirty List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Marcelo Tosatti Cc: qemu-devel Il 16/09/2014 17:55, Marcelo Tosatti ha scritto: > On Tue, Sep 16, 2014 at 05:42:16PM +0200, Paolo Bonzini wrote: >> Il 16/09/2014 17:14, Marcelo Tosatti ha scritto: >>> + /* >>> + * Make sure that CPU state is synchronized from KVM >>> + * once every VM state change callback has finished. >> >> Which other callback could affect the in-kernel state, > > Marcin mentioned that APIC state was the culprit. > > Perhaps > > bdrv_drain_all(); > ret = bdrv_flush_all(); > > Can change the interrupt state ? Ah, I thought Marcin was checking on the destination, not the source. > Then that should read "once VM stop has finished". But I still do not understand. The cpu_synchronize_all_states() call in kvmclock_vm_state_change() is needed to make env->tsc up to date with the value on the source, right? But if the synchronize_all_states+clean_all_dirty pair runs on the source, why is the cpu_synchronize_all_states() call in qemu_savevm_state_complete() not enough? It runs even later than kvmclock_vm_state_change. I don't understand even the original patch without cpu_clean_all_dirty()... Paolo