From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33485) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UkFi5-0003l8-1B for qemu-devel@nongnu.org; Wed, 05 Jun 2013 11:33:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UkFi0-0008Rv-4o for qemu-devel@nongnu.org; Wed, 05 Jun 2013 11:33:12 -0400 Received: from mail-ob0-x229.google.com ([2607:f8b0:4003:c01::229]:58477) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UkFi0-0008Rn-0O for qemu-devel@nongnu.org; Wed, 05 Jun 2013 11:33:08 -0400 Received: by mail-ob0-f169.google.com with SMTP id up14so2873840obb.0 for ; Wed, 05 Jun 2013 08:33:07 -0700 (PDT) From: Anthony Liguori In-Reply-To: <20130605142718.GA20565@redhat.com> References: <1370371954-8479-1-git-send-email-pbonzini@redhat.com> <51AF09FC.50308@suse.de> <20130605111044.GL31830@redhat.com> <877gi867ny.fsf@codemonkey.ws> <20130605142718.GA20565@redhat.com> Date: Wed, 05 Jun 2013 10:33:05 -0500 Message-ID: <8761xsr2ry.fsf@codemonkey.ws> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 00/39] 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: Paolo Bonzini , Andreas =?utf-8?Q?F=C3=A4rber?= , qemu-devel@nongnu.org "Michael S. Tsirkin" writes: > On Wed, Jun 05, 2013 at 07:53:05AM -0500, Anthony Liguori wrote: >> "Michael S. Tsirkin" writes: >>=20 >> > On Wed, Jun 05, 2013 at 11:50:52AM +0200, Andreas F=C3=A4rber wrote: >> >> Am 04.06.2013 20:51, schrieb Paolo Bonzini: >> >> > This series changes all PCI devices (the sole to support hotplug >> >> > _and_ use MemoryRegions) to do memory_region_del_subregion at >> >> > unrealize time, and memory_region_destroy at instance_finalize >> >> > time. >> >>=20 >> >> The general idea looks good. >> >>=20 >> >> Could you please follow-up with a patch that switches from exit to >> >> unrealize? >> > >> > What do you guys think about changing the name to something >> > else e.g. "free" or "destroy"? >>=20 >> exit/unrealize !=3D free/destroy. >>=20 >> You don't actually free anything. See 00/39 in this series for a >> precise description. > > That's where I got this. It says: > "instance_finalize will reclaim the memory" I'm not sure what you're talking about. There are two callbacks: exit and instance_finalize. exit() is called to disconnect the device to the guest. Andreas is proposing renaming it to unrealize. Ideally, reset() would be implemented as a combination of calls to unrealize() + realize() (or exit() + init() as they are named today). Nothing should be freed in exit. instance_finalize is only called once, before the object is freed(). It should be used to release resources associated with the object. Paolo is using this to destroy memory regions. Normally this callback is never used because child objects are automatically handled by QOM. "finalize" is the standard name of the hook that gets called before garbage collection as Andreas previously pointed out. It's this way in Java, Python, C#, etc. Regards, Anthony Liguori > >> > http://dictionary.cambridge.org/spellcheck/american-english/?q=3Dunrea= lize >>=20 >> English is a fluid language. I wouldn't worry too much about that. >>=20 >> Regards, >>=20 >> Anthony Liguori > > Well I am not worried about English at all. > I'm just confused by the function naming, and > I think it can be improved. > > Can we have names actually say what a function is > doing? There's no need to use ambiguous terms and then > document what they mean. > > >> > I can do it easily if people agree. >> > >> >> use BUS(), PCI_DEVICE() etc. to hide this. >> >>=20 >> >> Andreas >> >>=20 >> >> --=20 >> >> SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=C3=BCrnberg, Germany >> >> GF: Jeff Hawn, Jennifer Guild, Felix Imend=C3=B6rffer; HRB 16746 AG N= =C3=BCrnberg