qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: Ekaterina Tumanova <tumanova@linux.vnet.ibm.com>,
	Public KVM Mailing List <qemu-devel@nongnu.org>
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
Subject: Re: [Qemu-devel] [PATCH v7 5/5] BlockConf: Call backend functions to detect geometry and blocksizes
Date: Fri, 27 Feb 2015 11:22:47 -0500	[thread overview]
Message-ID: <54F099D7.7010206@redhat.com> (raw)
In-Reply-To: <1424087278-49393-6-git-send-email-tumanova@linux.vnet.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 <tumanova@linux.vnet.ibm.com>
> Reviewed-by: Markus Armbruster <armbru@redhat.com>
> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
>   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=<optimized out>, 
errp=0x7fffd989f190) at hw/scsi/scsi-bus.c:197
#5  0x00007f0a77502b71 in device_set_realized (obj=0x7f0a7b1e7130, 
value=<optimized out>, errp=0x7fffd989f2c8) at hw/core/qdev.c:1047
#6  0x00007f0a775b1e0e in property_set_bool (obj=0x7f0a7b1e7130, 
v=<optimized out>, opaque=0x7f0a7b1e73e0, name=<optimized out>, 
errp=0x7fffd989f2c8) at qom/object.c:1514
#7  0x00007f0a775b4707 in object_property_set_qobject 
(obj=0x7f0a7b1e7130, value=<optimized out>, 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=<optimized out>, 
opaque=<optimized out>) at qemu/vl.c:2127
#11 0x00007f0a7766803b in qemu_opts_foreach (list=<optimized out>, 
func=0x7f0a774b1df0 <device_init_func>, opaque=0x0, 
abort_on_failure=<optimized out>) at util/qemu-option.c:1057
#12 0x00007f0a773b96ec in main (argc=<optimized out>, argv=<optimized 
out>, envp=<optimized out>) 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

  reply	other threads:[~2015-02-27 16:23 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-16 11:47 [Qemu-devel] [PATCH v7 0/5] Geometry and blocksize detection for backing devices Ekaterina Tumanova
2015-02-16 11:47 ` [Qemu-devel] [PATCH v7 1/5] block: add bdrv functions for geometry and blocksize Ekaterina Tumanova
2015-02-16 11:47 ` [Qemu-devel] [PATCH v7 2/5] raw-posix: Factor block size detection out of raw_probe_alignment() Ekaterina Tumanova
2015-02-16 11:47 ` [Qemu-devel] [PATCH v7 3/5] block: Add driver methods to probe blocksizes and geometry Ekaterina Tumanova
2015-02-16 11:47 ` [Qemu-devel] [PATCH v7 4/5] block-backend: Add wrappers for blocksizes and geometry probing Ekaterina Tumanova
2015-02-16 11:47 ` [Qemu-devel] [PATCH v7 5/5] BlockConf: Call backend functions to detect geometry and blocksizes Ekaterina Tumanova
2015-02-27 16:22   ` Max Reitz [this message]
2015-02-27 18:26     ` [Qemu-devel] [PATCH 0/1] Ekaterina Tumanova
2015-02-27 18:26       ` [Qemu-devel] [PATCH 1/1] scsi-hd: fix property unset case Ekaterina Tumanova
2015-02-27 18:29         ` Max Reitz
2015-02-27 18:58           ` Stefan Hajnoczi
2015-03-02  8:46         ` Markus Armbruster
2015-03-02  9:07           ` Ekaterina Tumanova
2015-03-02 12:04             ` Markus Armbruster
2015-03-02  9:28       ` [Qemu-devel] [PATCH 0/1] Kevin Wolf
2015-03-03  8:15         ` [Qemu-devel] [PATCH] Add testcase for scsi-hd devices without drive property Christian Borntraeger
2015-03-03 14:17           ` Christian Borntraeger
2015-03-03 14:31             ` Max Reitz
2015-02-24  9:13 ` [Qemu-devel] [PATCH v7 0/5] Geometry and blocksize detection for backing devices Christian Borntraeger
2015-02-24 10:44 ` Stefan Hajnoczi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54F099D7.7010206@redhat.com \
    --to=mreitz@redhat.com \
    --cc=armbru@redhat.com \
    --cc=borntraeger@de.ibm.com \
    --cc=cornelia.huck@de.ibm.com \
    --cc=dahi@linux.vnet.ibm.com \
    --cc=kwolf@redhat.com \
    --cc=mihajlov@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=thuth@linux.vnet.ibm.com \
    --cc=tumanova@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).