From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57168) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VLxPW-0003tC-KN for qemu-devel@nongnu.org; Tue, 17 Sep 2013 11:42:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VLxPN-000550-Df for qemu-devel@nongnu.org; Tue, 17 Sep 2013 11:41:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:8244) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VLxPN-00054e-5F for qemu-devel@nongnu.org; Tue, 17 Sep 2013 11:41:45 -0400 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.14.4/8.14.4) with ESMTP id r8HFfgBG019558 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 17 Sep 2013 11:41:43 -0400 Message-ID: <52387840.8090405@redhat.com> Date: Tue, 17 Sep 2013 17:41:52 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1378211609-16121-1-git-send-email-pbonzini@redhat.com> <20130917124724.GA18965@redhat.com> <52386A29.9090908@redhat.com> <20130917144541.GA19882@redhat.com> In-Reply-To: <20130917144541.GA19882@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 00/38] Delay destruction of memory regions to instance_finalize List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: qemu-devel@nongnu.org Il 17/09/2013 16:45, Michael S. Tsirkin ha scritto: > On Tue, Sep 17, 2013 at 04:41:45PM +0200, Paolo Bonzini wrote: >> Il 17/09/2013 14:47, Michael S. Tsirkin ha scritto: >>> Ergo, to make sure a referenced MR does not get >>> destroyed, we must make sure only finalize >>> calls memory_region_destroy. >>> >>> So I think this patchset should do exactly that, >>> not try to move out more stuff to finalize. >> >> Yes, this is the part of the problem that applies to all devices. >> >> Some devices may have timers or other dynamically-allocated data that >> may be used between exit and finalize. The same applies to capabilities >> such as MSI and MSI-X. All this must also be moved to finalize, but >> this can be done in separate patches. >> >> I'll separate the series as follows: >> >> - memory_region_destroy >> >> - unregister_savevm > > What's the problem here exactly? I was thinking about AIO callbacks here, but we don't support device hot(un)plug during migration so I can remove this part. >> - other dynamically allocated data > > And here? I don't think we should move rundom stuff out to finalize > just because we can. It's not random stuff, AIO callbacks can access dynamically allocated data between exit and finalize. Even if a particular device doesn't do it, there's no hope of having best practices from contributors if we do not do things consistently. >> - del_vm_change_state_handler Same here: user can stop/cont between exit and finalize, for example because the I/O failed. Paolo >> - MSI-X >> >> - SHPC, AER and other PCI/bridge stuff >> >> Paolo > > Let's document specific problems and fix them. > Randomly moving cleanup order has a high chance to > introduce bugs. >