From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:35920) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T63so-0005SJ-VC for qemu-devel@nongnu.org; Mon, 27 Aug 2012 14:17:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T63sj-0002jP-9f for qemu-devel@nongnu.org; Mon, 27 Aug 2012 14:17:54 -0400 Received: from goliath.siemens.de ([192.35.17.28]:25712) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T63sj-0002iz-0Q for qemu-devel@nongnu.org; Mon, 27 Aug 2012 14:17:49 -0400 Message-ID: <503BB9C5.3030605@siemens.com> Date: Mon, 27 Aug 2012 20:17:41 +0200 From: Jan Kiszka 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> In-Reply-To: <503BB7E7.4050709@redhat.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: Avi Kivity Cc: Paolo Bonzini , Liu Ping Fan , liu ping fan , Anthony Liguori , "qemu-devel@nongnu.org" 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. Jan -- Siemens AG, Corporate Technology, CT RTC ITP SDP-DE Corporate Competence Center Embedded Linux