From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38602) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eWhOl-0007jl-9v for qemu-devel@nongnu.org; Wed, 03 Jan 2018 06:39:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eWhOh-0004cj-7S for qemu-devel@nongnu.org; Wed, 03 Jan 2018 06:39:55 -0500 Received: from mx1.redhat.com ([209.132.183.28]:49626) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eWhOh-0004cQ-1X for qemu-devel@nongnu.org; Wed, 03 Jan 2018 06:39:51 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3F08CC0587FD for ; Wed, 3 Jan 2018 11:39:50 +0000 (UTC) Date: Wed, 3 Jan 2018 19:39:45 +0800 From: Peter Xu Message-ID: <20180103113945.GO2557@xz-mi> References: <20180103054043.25719-1-peterx@redhat.com> <20180103054043.25719-3-peterx@redhat.com> <87efn72the.fsf@secure.laptop> <20180103093619.GH2557@xz-mi> <87shbn1bv8.fsf@secure.laptop> <20180103102632.GJ2557@xz-mi> <87k1wz197l.fsf@secure.laptop> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <87k1wz197l.fsf@secure.laptop> Subject: Re: [Qemu-devel] [PATCH 02/11] migration: qemu_savevm_state_cleanup() in cleanup List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Juan Quintela Cc: qemu-devel@nongnu.org, Laurent Vivier , "Dr . David Alan Gilbert" On Wed, Jan 03, 2018 at 12:18:54PM +0100, Juan Quintela wrote: > Peter Xu wrote: > > On Wed, Jan 03, 2018 at 11:21:31AM +0100, Juan Quintela wrote: > >> Peter Xu wrote: > >> > On Wed, Jan 03, 2018 at 10:15:41AM +0100, Juan Quintela wrote: > >> >> Peter Xu wrote: > >> >> > Moving existing callers all into migrate_fd_cleanup(). It simplifies > >> >> > migration_thread() a bit. > >> >> > > >> >> > Signed-off-by: Peter Xu > >> >> > >> >> Reviewed-by: Juan Quintela > >> > > >> > Thanks. > >> > > >> >> > >> >> I am trying to see if we can call migrate_fd_cleanup() twice. As far as > >> >> I can see, we are not doing it. But, and it is a big but, we are not > >> >> checking that we are not calling qemu_savevm_state_cleanup() twice. If > >> >> that happens, we can get double frees and similar. > >> >> > >> >> I put the reviewed-by anyways, because I *think* that we are doing it > >> >> right now, and otherwise, we should make sure that we are not calling it > >> >> twice, not papering over it. > >> >> > >> >> Once here, I have notice that we call block_cleanup_parameters() in > >> >> *three* places. We call notifier_list_notify() on two of this places (I > >> >> can't see any good reason *why* we don't call the notifier for > >> >> migrate_fd_cancel). > >> > > >> > Indeed. > >> > > >> > IMHO we can remove two calls of block_cleanup_parameters(), only keep > >> > the one in migrate_fd_cleanup(), and remove on notifier_list_notify() > >> > in migrate_fd_error() (these can be two more patches). What do you > >> > think? > >> > >> I think we need to make sure that we have a function that we always > >> call at the end. I think that we have that on migration_fd_cleanup(), > >> so put everything there should be ok, no? > > > > IMHO that's exactly what I mean, no? :) > > > > For notifier_list_notify(), it's different - I just remove the extra > > one in migrate_fd_error() because it'll be called in > > migrate_fd_cleanup() as well, which is a duplicate. > > then what call the one when we do a cancel? the one in cleanup also? Yes, IIUC migrate_fd_cancel() tells the thread to cancel, then the migrate_fd_cleanup() is called there (finally in the bottom half of main loop, of course). -- Peter Xu