From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=34479 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OmZi8-0006b8-Nc for qemu-devel@nongnu.org; Fri, 20 Aug 2010 18:05:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OmZi7-0007Z9-GF for qemu-devel@nongnu.org; Fri, 20 Aug 2010 18:05:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:13283) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OmZi7-0007Z5-8I for qemu-devel@nongnu.org; Fri, 20 Aug 2010 18:05:15 -0400 Subject: Re: [Qemu-devel] [PATCH] qdev: Reset hotplugged devices From: Alex Williamson In-Reply-To: <4C6EC5AA.6050502@codemonkey.ws> References: <20100803161914.15514.59304.stgit@localhost6.localdomain6> <1282308092.3860.0.camel@x201> <4C6EA5C9.8080700@codemonkey.ws> <4C6EC5AA.6050502@codemonkey.ws> Content-Type: text/plain; charset="UTF-8" Date: Fri, 20 Aug 2010 16:05:09 -0600 Message-ID: <1282341909.24138.1.camel@x201> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: glommer@redhat.com, Markus Armbruster , qemu-devel@nongnu.org On Fri, 2010-08-20 at 13:12 -0500, Anthony Liguori wrote: > On 08/20/2010 11:14 AM, Markus Armbruster wrote: > >> The real problem is how we do reset. We shouldn't register a reset > >> handler for every qdev device but rather register a single reset > >> handler that walks the device tree and calls reset on every reachable > >> device. > >> > >> Then we can always call reset in init() and there's no need to have a > >> dev->hotplugged check. The qdev device tree reset handler should not > >> be registered until *after* we call qemu_system_reset() after creating > >> the device model which will ensure that we don't do a double reset. > >> > > Fine with me. > > > > But we need to merge something short term (pre 0.13) to fix hot plug of > > e1000 et al. Use Alex's patch as such a stop-gap? > > > > No, we're accumulating crud in base qdev at an alarming rate. It's > important to fix these things now before it gets prohibitively hard to > take care of. > > Can you and Alex review/try the following patch? It seems to work for > me although I'm not sure how to trigger the original bug. Yep, that works. The test is simply to hot add an e1000, much of the register state is setup in the reset function so the guest won't be able to make use of the device unless reset is called somewhere along the way. Acked-by: Alex Williamson