From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:51778) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T63ve-00074k-0a for qemu-devel@nongnu.org; Mon, 27 Aug 2012 14:20:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T63vZ-0003hR-1K for qemu-devel@nongnu.org; Mon, 27 Aug 2012 14:20:49 -0400 Received: from mx1.redhat.com ([209.132.183.28]:12603) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T63vY-0003hM-OQ for qemu-devel@nongnu.org; Mon, 27 Aug 2012 14:20:44 -0400 Message-ID: <503BBA77.4090006@redhat.com> Date: Mon, 27 Aug 2012 11:20:39 -0700 From: Avi Kivity MIME-Version: 1.0 References: <1345801763-24227-1-git-send-email-qemulist@gmail.com> <1345801763-24227-11-git-send-email-qemulist@gmail.com> <503792F1.4090109@redhat.com> <503B1B4B.6050108@redhat.com> <503B260E.70607@web.de> <503BA9BC.5010207@redhat.com> <503BAAF0.2020103@siemens.com> <503BB7E7.4050709@redhat.com> <503BB9C5.3030605@siemens.com> In-Reply-To: <503BB9C5.3030605@siemens.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 10/10] qdev: fix create in place obj's life cycle problem List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jan Kiszka Cc: Paolo Bonzini , Liu Ping Fan , liu ping fan , Anthony Liguori , "qemu-devel@nongnu.org" On 08/27/2012 11:17 AM, Jan Kiszka wrote: > On 2012-08-27 20:09, Avi Kivity wrote: > > On 08/27/2012 10:14 AM, Jan Kiszka wrote: > >>> > >>> Deregistration is fine, the problem is destruction. > >>> > >> > >> It isn't as you access memory region states that can change after > >> deregistration. Devices can remove memory regions from the mapping, > >> alter and then reinsert them. The last to steps must not happen while > >> anyone is still using a reference to that region. > >> > > > > Why not? If the guest is accessing an mmio region while reconfiguring > > it in a way that changes its meaning, either the previous or the next > > meaning is valid. > > If the memory region owner sets the content to zero or even releases it > (nothing states a memory region can only live inside a device > structure), we will crash. Restricting how a memory region can be > created and handled after it was once registered somewhere is an > unnatural interface, waiting to cause subtle bugs. Using an Object * allows the simple case to be really simple (object == device) and the hard cases to be doable. What would you suggest as a better interface? -- I have a truly marvellous patch that fixes the bug which this signature is too narrow to contain.