From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50004) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WnUSK-0002D5-O1 for qemu-devel@nongnu.org; Thu, 22 May 2014 10:59:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WnUSA-0003hX-Tg for qemu-devel@nongnu.org; Thu, 22 May 2014 10:58:52 -0400 Received: from mail-pb0-x22c.google.com ([2607:f8b0:400e:c01::22c]:32847) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WnUSA-0003gy-Jv for qemu-devel@nongnu.org; Thu, 22 May 2014 10:58:42 -0400 Received: by mail-pb0-f44.google.com with SMTP id rq2so2617703pbb.3 for ; Thu, 22 May 2014 07:58:41 -0700 (PDT) Message-ID: <537E108F.3010901@gmail.com> Date: Thu, 22 May 2014 22:58:23 +0800 From: Jun Li MIME-Version: 1.0 References: <1400511808-16929-1-git-send-email-junmuzi@gmail.com> <537A23DF.30807@suse.de> <20140519155703.GC31595@redhat.com> <537C601F.6020509@suse.de> In-Reply-To: <537C601F.6020509@suse.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH v3] Add remove_boot_device_path() function for hot-unplug device List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?ISO-8859-1?Q?Andreas_F=E4rber?= , "Michael S. Tsirkin" Cc: kwolf@redhat.com, famz@redhat.com, stefanha@redhat.com, marcel.a@redhat.com, juli@redhat.com, qemu-devel@nongnu.org, Gerd Hoffmann , aliguori@amazon.com, pbonzini@redhat.com On 05/21/2014 04:13 PM, Andreas Färber wrote: > Am 19.05.2014 17:57, schrieb Michael S. Tsirkin: >> On Mon, May 19, 2014 at 05:31:43PM +0200, Andreas Färber wrote: >>> Hi, >>> >>> Am 19.05.2014 17:03, schrieb Jun Li: >>>> Add remove_boot_device_path() function to remove bootindex when hot-unplug >>>> a device. This patch fixed virtio-blk/virtio-net/scsi-disk/scsi-generic device. >>>> >>>> Signed-off-by: Jun Li >>>> --- >>>> This patch also fixed bug1086603, ref: >>>> https://bugzilla.redhat.com/show_bug.cgi?id=1086603 >>>> >>>> This version of patch delete dev and suffix parameter from function remove_boot_device_path(). >>>> --- >>>> hw/block/virtio-blk.c | 1 + >>>> hw/net/virtio-net.c | 1 + >>>> hw/scsi/scsi-disk.c | 1 + >>>> hw/scsi/scsi-generic.c | 1 + >>> On v1 I believe I reminded you of spapr_llan. Your patch is adding a new >>> remove_*() function, but is using it only for roughly half of the >>> devices that currently call add_boot_device_path(). Why? I can >>> understand that ISA devices will not be hot-unpluggable, but all PCI and >>> USB devices are. >> Can we remove the device from boot path automatically >> when it's going away? > I'm not familiar with that code myself; assuming that only one path gets > registered per device, I guess we could add a field to DeviceState and > if non-NULL call the unregistration from device_set_unrealize(). > > Jun, if that works it would save you some work. Hi Andreas, Add a field to DeviceState is another method to fix this issue. But when using this method, should delete add_boot_device_path() and add boot path in register per device. I can not estimate the potential issues. Could any guy give your opinion? I will do some researches this weekend. Thx. Add remove_boot_device_path(), we can call this function where it needs. It's easy to realize. :-) Best Regards, Jun Li