From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33936) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YRNh1-0002sW-24 for qemu-devel@nongnu.org; Fri, 27 Feb 2015 11:23:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YRNgv-0007ch-DK for qemu-devel@nongnu.org; Fri, 27 Feb 2015 11:23:11 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44938) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YRNgv-0007cV-5P for qemu-devel@nongnu.org; Fri, 27 Feb 2015 11:23:05 -0500 Message-ID: <54F099D7.7010206@redhat.com> Date: Fri, 27 Feb 2015 11:22:47 -0500 From: Max Reitz MIME-Version: 1.0 References: <1424087278-49393-1-git-send-email-tumanova@linux.vnet.ibm.com> <1424087278-49393-6-git-send-email-tumanova@linux.vnet.ibm.com> In-Reply-To: <1424087278-49393-6-git-send-email-tumanova@linux.vnet.ibm.com> Content-Type: text/plain; charset=iso-8859-15; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v7 5/5] BlockConf: Call backend functions to detect geometry and blocksizes List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Ekaterina Tumanova , Public KVM Mailing List Cc: kwolf@redhat.com, thuth@linux.vnet.ibm.com, borntraeger@de.ibm.com, armbru@redhat.com, mihajlov@linux.vnet.ibm.com, dahi@linux.vnet.ibm.com, stefanha@redhat.com, cornelia.huck@de.ibm.com On 2015-02-16 at 06:47, Ekaterina Tumanova wrote: > geometry: hd_geometry_guess function autodetects the drive geometry. > This patch adds a block backend call, that probes the backing device > geometry. If the inner driver method is implemented and succeeds > (currently only for DASDs), the blkconf_geometry will pass-through > the backing device geometry. Otherwise will fallback to old logic. > > blocksize: This patch initializes blocksize properties to 0. > In order to set the property a blkconf_blocksizes was introduced. > If user didn't set physical or logical blocksize, it will > retrieve its value from a driver (only succeeds for DASD), otherwise > it will set default 512 value. > > The blkconf_blocksizes call was added to all users of BlkConf. > > Signed-off-by: Ekaterina Tumanova > Reviewed-by: Markus Armbruster > Reviewed-by: Stefan Hajnoczi > --- > hw/block/block.c | 24 ++++++++++++++++++++++++ > hw/block/hd-geometry.c | 10 +++++++++- > hw/block/nvme.c | 1 + > hw/block/virtio-blk.c | 1 + > hw/core/qdev-properties.c | 3 ++- > hw/ide/qdev.c | 1 + > hw/scsi/scsi-disk.c | 2 ++ > hw/usb/dev-storage.c | 1 + > include/hw/block/block.h | 5 +++-- > include/hw/qdev-properties.h | 4 ++-- > 10 files changed, 46 insertions(+), 6 deletions(-) This patch makes qemu segfault if the drive property is not set for a scsi-hd device: $ x86_64-softmmu/qemu-system-x86_64 -device virtio-scsi-pci -device scsi-hd [1] 13368 segmentation fault (core dumped) x86_64-softmmu/qemu-system-x86_64 -device virtio-scsi-pci -device scsi-hd (gdb) bt #0 0x00007f0a77620f50 in blk_probe_blocksizes (blk=0x0, bsz=0x7fffd989f110) at block/block-backend.c:898 #1 0x00007f0a774eb943 in blkconf_blocksizes (conf=conf@entry=0x7f0a7b1e71c0) at hw/block/block.c:34 #2 0x00007f0a7755e5a8 in scsi_hd_realize (dev=0x7f0a7b1e7130, errp=0x7fffd989f150) at hw/scsi/scsi-disk.c:2294 #3 0x00007f0a77564671 in scsi_qdev_realize (errp=0x7fffd989f150, s=0x7f0a7b1e7130) at hw/scsi/scsi-bus.c:50 #4 0x00007f0a77564671 in scsi_qdev_realize (qdev=, errp=0x7fffd989f190) at hw/scsi/scsi-bus.c:197 #5 0x00007f0a77502b71 in device_set_realized (obj=0x7f0a7b1e7130, value=, errp=0x7fffd989f2c8) at hw/core/qdev.c:1047 #6 0x00007f0a775b1e0e in property_set_bool (obj=0x7f0a7b1e7130, v=, opaque=0x7f0a7b1e73e0, name=, errp=0x7fffd989f2c8) at qom/object.c:1514 #7 0x00007f0a775b4707 in object_property_set_qobject (obj=0x7f0a7b1e7130, value=, name=0x7f0a7769e3cd "realized", errp=0x7fffd989f2c8) at qom/qom-qobject.c:24 #8 0x00007f0a775b32a0 in object_property_set_bool (obj=obj@entry=0x7f0a7b1e7130, value=value@entry=true, name=name@entry=0x7f0a7769e3cd "realized", errp=errp@entry=0x7fffd989f2c8) at qom/object.c:905 #9 0x00007f0a774a8ca5 in qdev_device_add (opts=0x7f0a799fa3f0) at qdev-monitor.c:574 #10 0x00007f0a774b1df9 in device_init_func (opts=, opaque=) at qemu/vl.c:2127 #11 0x00007f0a7766803b in qemu_opts_foreach (list=, func=0x7f0a774b1df0 , opaque=0x0, abort_on_failure=) at util/qemu-option.c:1057 #12 0x00007f0a773b96ec in main (argc=, argv=, envp=) at vl.c:4239 Before this patch: $ x86_64-softmmu/qemu-system-x86_64 -device virtio-scsi-pci -device scsi-hd qemu-system-x86_64: -device scsi-hd: drive property not set qemu-system-x86_64: -device scsi-hd: Device 'scsi-hd' could not be initialized Max