From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55478) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vq5yG-0001KM-DC for qemu-devel@nongnu.org; Mon, 09 Dec 2013 13:54:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vq5y8-0002UE-R5 for qemu-devel@nongnu.org; Mon, 09 Dec 2013 13:54:20 -0500 Received: from e06smtp12.uk.ibm.com ([195.75.94.108]:41578) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vq5y8-0002U2-Hn for qemu-devel@nongnu.org; Mon, 09 Dec 2013 13:54:12 -0500 Received: from /spool/local by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 9 Dec 2013 18:54:09 -0000 Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id 8421017D805A for ; Mon, 9 Dec 2013 18:54:00 +0000 (GMT) Received: from d06av06.portsmouth.uk.ibm.com (d06av06.portsmouth.uk.ibm.com [9.149.37.217]) by b06cxnps3074.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id rB9IqcER63701158 for ; Mon, 9 Dec 2013 18:52:39 GMT Received: from d06av06.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av06.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id rB9Iqpcs019095 for ; Mon, 9 Dec 2013 11:52:51 -0700 Date: Mon, 9 Dec 2013 19:52:47 +0100 From: Cornelia Huck Message-ID: <20131209195247.36cda682@gondolin> In-Reply-To: <52A604A3.2030208@redhat.com> References: <1385720262-14107-1-git-send-email-pbonzini@redhat.com> <52A604A3.2030208@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v4 00/30] virtio: cleanup, fix hot-unplug, move to realize List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org, afaerber@suse.de, mst@redhat.com On Mon, 09 Dec 2013 18:57:55 +0100 Paolo Bonzini wrote: > Il 29/11/2013 11:17, Paolo Bonzini ha scritto: > > This series fixes hot-unplug of virtio devices, which can crash due to > > dangling pointer accesses. > > > > The current implementation supports guest-initiated hot-unplug via the > > virtio_bus_destroy_device function, but not hot-unplugging the virtio > > device by virtue of unplugging its parent container device. > > > > The problem is that the callback for the bus implementation to cleanup > > is placed in the wrong place; it is in virtio_bus_destroy_device, which > > should be called by the bus, instead of being somewhere in device code. > > We need to have the callback in device code (for example in dc->exit), > > so that we invoke it on every unplug action, no matter who starts it. > > > > Thus, the series cleans up plugging and unplugging of virtio devices > > so that it does not need any help from the bus (patches 2-5). It then > > stops the virtio devices' overriding of dc->exit, moving their cleanup > > code to the new exit callback in VirtioDeviceClass (patches 6-11). > > Finally, patch 12 can make virtio-pci implement the device_unplugged > > callback. > > > > A similar dangling-pointer bug is exposed by this change in virtio-ccw. > > Patch 1 avoids this; it is kept at the beginning to ensure bisectability. > > > > Patches 13-30 are Andreas's conversion of virtio to realize/unrealize, > > which has better error propagation as shown by the small testcase fix. > > Conny, > > I pushed this to github at git://github.com/bonzini/qemu.git, branch > refs/heads/virtio. > > It would be great if you can give it a test in case I screwed up a rebase. It might have been a good idea to actually cc: me :) But yes, it seems to pass my sniff test.