From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=40385 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OFM4r-0007fv-L5 for qemu-devel@nongnu.org; Fri, 21 May 2010 02:51:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OFM4m-0001dU-1I for qemu-devel@nongnu.org; Fri, 21 May 2010 02:51:25 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55439) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OFM4l-0001dM-Py for qemu-devel@nongnu.org; Fri, 21 May 2010 02:51:19 -0400 Message-ID: <4BF62D5B.9050809@redhat.com> Date: Fri, 21 May 2010 08:51:07 +0200 From: Gerd Hoffmann MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH v2] Release usb devices on shutdown and usb_del command References: <20100519181031.GA19410@redhat.com> <4BF4314F.6000904@cisco.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: Shahar Havivi , qemu-devel@nongnu.org, "David S. Ahern" Hi, > What about the existing callbacks? Could handle_destroy do? For hot-unplug it should do. >>> --- a/vl.c >>> +++ b/vl.c >>> @@ -3914,6 +3914,7 @@ int main(int argc, char **argv, char **envp) >>> main_loop(); >>> quit_timers(); >>> net_cleanup(); >>> + usb_cleanup(); >>> >>> return 0; >>> } > > Figure we'd have to clean up the qdev tree on exit. Gerd? Hmm, yes. Question is how to do that best. There is qdev_free(). Today this is used for hot-unplug only. Using it on exit() too could have unwanted guest-visible side effects as it doesn't just release ressources, but also unplugs the device if possible. Maybe it is better to add a exit notifier ... cheers, Gerd