Received: from eggs.gnu.org ([2001:4830:134:3::10]:51790) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XTvIT-0003rH-VJ for qemu-devel@nongnu.org; Tue, 16 Sep 2014 12:08:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XTvIN-0002kG-QL for qemu-devel@nongnu.org; Tue, 16 Sep 2014 12:08:05 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44417) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XTvIN-0002k5-HI for qemu-devel@nongnu.org; Tue, 16 Sep 2014 12:07:59 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s8GG7tSJ032345 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Tue, 16 Sep 2014 12:07:56 -0400 Date: Tue, 16 Sep 2014 13:07:35 -0300 From: Marcelo Tosatti Message-ID: <20140916160735.GB30753@amt.cnet> References: <20140916151437.GA27819@amt.cnet> <54185A58.2010105@redhat.com> <20140916155526.GB29476@amt.cnet> <54185F5C.60906@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <54185F5C.60906@redhat.com> 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: Paolo Bonzini Cc: qemu-devel On Tue, Sep 16, 2014 at 06:03:40PM +0200, Paolo Bonzini wrote: > 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? Its there to make sure the pair env->tsc, s->clock = data.clock are relative to point close in time. > 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. Because of the "pair of time values" explanation above. > I don't understand even the original patch without cpu_clean_all_dirty()... > > Paolo