Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MrAZl-0000pl-7h for qemu-devel@nongnu.org; Fri, 25 Sep 2009 09:11:05 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MrAZg-0000kM-O6 for qemu-devel@nongnu.org; Fri, 25 Sep 2009 09:11:04 -0400 Received: from [199.232.76.173] (port=57436 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MrAZg-0000kB-Dm for qemu-devel@nongnu.org; Fri, 25 Sep 2009 09:11:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:30816) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MrAZg-0000O4-0L for qemu-devel@nongnu.org; Fri, 25 Sep 2009 09:11:00 -0400 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n8PDAwjq031805 for ; Fri, 25 Sep 2009 09:10:58 -0400 Subject: Re: [Qemu-devel] [PATCH 10/13] Implement scsi device destruction References: <1253611767-6483-1-git-send-email-kraxel@redhat.com> <1253611767-6483-11-git-send-email-kraxel@redhat.com> <8763b8b1dh.fsf@pike.pond.sub.org> <4ABC7503.70200@redhat.com> From: Markus Armbruster Date: Fri, 25 Sep 2009 15:10:57 +0200 In-Reply-To: <4ABC7503.70200@redhat.com> (Gerd Hoffmann's message of "Fri\, 25 Sep 2009 09\:45\:07 +0200") Message-ID: <87iqf72mqm.fsf@pike.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: qemu-devel@nongnu.org Gerd Hoffmann writes: > Hi, > >> If I understand this correctly, SCSI devices "overwrite": if you add a >> new one with an existing SCSI ID, the old one gets disconnected >> automatically. Isn't that inconsistent with other buses? PCI, >> specifically. Question applies before your patch already. > > Yes, this is correct. > I've just maintained current behavior. > > To extend that question: While playing with that I've noticed linux > does not automagically find the a scsi disk hot-plugged in. After > reboot (and the scsi bus rescan triggered by that) it finds the > disk. Reloading the driver module probably would have worked too. We > don't signal the guest in any way it got a new disk, so this isn't > exactly surprising. Is this just a emulation limitation? Or a > limitation of the emulated scsi host adapters? What appens when you hotplug or just switch on a real SCSI device? Does Linux pick it up automatically? Long ago when I last tried that, I think I had to do a magic write to sysfs to make it look for the device. >>> +static int scsi_qdev_exit(DeviceState *qdev) >>> +{ >>> + SCSIDevice *dev = DO_UPCAST(SCSIDevice, qdev, qdev); >>> + SCSIBus *bus = DO_UPCAST(SCSIBus, qbus, dev->qdev.parent_bus); >>> + >>> + assert(bus->devs[dev->id] != NULL); >>> + if (bus->devs[dev->id]->info->destroy) { >>> + bus->devs[dev->id]->info->destroy(bus->devs[dev->id]); >>> + } >>> + bus->devs[dev->id] = NULL; >>> + return 0; >>> } >> >> You have scsi_qdev_exit() as qdev callback exit(). It does the generic >> stuff, then runs the SCSIDevice callback destroy() for the specific >> stuff. Shouldn't the two callbacks be named the same, to make their >> relation more obvious? > > I'm just using the existing callbacks and windup stuff correctly in > the qdev_free() paths. Make the naming more consistent would be > useful indeed, but that is IMHO a job for a separate patch. And we > should agree on a naming convention first ;) Fair enough. Tasteful naming *is* important.