From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:55439) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sz2RL-0004fo-0e for qemu-devel@nongnu.org; Wed, 08 Aug 2012 05:20:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Sz2RH-000413-GZ for qemu-devel@nongnu.org; Wed, 08 Aug 2012 05:20:30 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47149) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sz2RH-00040j-8X for qemu-devel@nongnu.org; Wed, 08 Aug 2012 05:20:27 -0400 Message-ID: <50222F54.4080108@redhat.com> Date: Wed, 08 Aug 2012 12:20:20 +0300 From: Avi Kivity MIME-Version: 1.0 References: <1344407156-25562-1-git-send-email-qemulist@gmail.com> <1344407156-25562-7-git-send-email-qemulist@gmail.com> In-Reply-To: <1344407156-25562-7-git-send-email-qemulist@gmail.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 06/15] memory: use refcnt to manage MemoryRegion List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Liu Ping Fan Cc: kvm@vger.kernel.org, Jan Kiszka , Marcelo Tosatti , qemu-devel@nongnu.org, Blue Swirl , Anthony Liguori , Stefan Hajnoczi , Paolo Bonzini , =?ISO-8859-1?Q?Andreas_F=E4rber?= On 08/08/2012 09:25 AM, Liu Ping Fan wrote: > From: Liu Ping Fan > > Using refcnt for mr, so we can separate mr's life cycle management > from refered object. > When mr->ref 0->1, inc the refered object. > When mr->ref 1->0, dec the refered object. > > The refered object can be DeviceStae, another mr, or other opaque. Please explain the motivation more fully. Usually a MemoryRegion will be embedded within some DeviceState, or its lifecycle will be managed by the DeviceState. So long as we keep the DeviceState alive all associated MemoryRegions should be alive as well. Why not do this directly? -- error compiling committee.c: too many arguments to function