qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Cornelia Huck <cohuck@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>
Cc: kwolf@redhat.com, fam@euphon.net, Hannes Reinecke <hare@suse.com>,
	ehabkost@redhat.com, mst@redhat.com,
	Markus Armbruster <armbru@redhat.com>,
	qemu-devel@nongnu.org, Denis Plotnikov <dplotnikov@virtuozzo.com>,
	stefanha@redhat.com, Cleber Rosa <crosa@redhat.com>,
	pbonzini@redhat.com, mreitz@redhat.com,
	Christoph Hellwig <hch@lst.de>,
	den@virtuozzo.com
Subject: Re: [PATCH v5 2/2] tests: add virtio-scsi and virtio-blk seg_max_adjust test
Date: Thu, 23 Jan 2020 12:14:23 +0100	[thread overview]
Message-ID: <20200123121423.591c5f5d.cohuck@redhat.com> (raw)
In-Reply-To: <98adffe7-447f-0b9a-6317-29116067e3fe@redhat.com>

On Wed, 22 Jan 2020 22:47:42 +0100
Philippe Mathieu-Daudé <philmd@redhat.com> wrote:


> > This test is failing on OSX:
> > 
> > TestFail: machine type pc-i440fx-2.0: <class 'TypeError'>
> > 
> > Looking at my job-results/job-2020-01-22T17.54-92b7fae/job.log:
> > 
> > Unexpected error in object_property_find() at qom/object.c:1201:
> > qemu-system-x86_64: -device virtio-blk-pci,id=scsi0,drive=drive0: can't 
> > apply global virtio-blk-device.scsi=true: Property '.scsi' not found
> > 
> > Which makes sense looking at hw/block/virtio-blk.c:
> > 
> > 1261 static Property virtio_blk_properties[] = {
> > 1262     DEFINE_BLOCK_PROPERTIES(VirtIOBlock, conf.conf),
> > ...
> > 1268 #ifdef __linux__
> > 1269     DEFINE_PROP_BIT64("scsi", VirtIOBlock, host_features,
> > 1270                       VIRTIO_BLK_F_SCSI, false),
> > 1271 #endif
> > 
> > Except code moved around, origin is:
> > 
> > $ git show 1063b8b15
> > commit 1063b8b15fb49fcf88ffa282b19aaaf7ca9c678c
> > Author: Christoph Hellwig <hch@lst.de>
> > Date:   Mon Apr 27 10:29:14 2009 +0200
> > 
> >      virtio-blk: add SGI_IO passthru support
> > 
> >      Add support for SG_IO passthru (packet commands) to the virtio-blk
> >      backend.  Conceptually based on an older patch from Hannes Reinecke
> >      but largely rewritten to match the code structure and layering in
> >      virtio-blk.
> > 
> >      Note that currently we issue the hose SG_IO synchronously.  We could
> >      easily switch to async I/O, but that would required either bloating
> >      the VirtIOBlockReq by the size of struct sg_io_hdr or an additional
> >      memory allocation for each SG_IO request.
> > 
> > I'm not sure what is the correct way to fix this.  
> 
> ... because of:
> 
> $ git show ed65fd1a27
> commit ed65fd1a2750d24290354cc7ea49caec7c13e30b
> Author: Cornelia Huck <cornelia.huck@de.ibm.com>
> Date:   Fri Oct 16 12:25:54 2015 +0200
> 
>      virtio-blk: switch off scsi-passthrough by default
> 
>      Devices that are compliant with virtio-1 do not support scsi
>      passthrough any more (and it has not been a recommended setup
>      anyway for quite some time). To avoid having to switch it off
>      explicitly in newer qemus that turn on virtio-1 by default, let's
>      switch the default to scsi=false for 2.5.
> 
>      Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
>      Message-id: 1444991154-79217-4-git-send-email-cornelia.huck@de.ibm.com
>      Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> 
> diff --git a/include/hw/compat.h b/include/hw/compat.h
> index 095de5d12f..93e71afb4a 100644
> --- a/include/hw/compat.h
> +++ b/include/hw/compat.h
> @@ -2,7 +2,11 @@
>   #define HW_COMPAT_H
> 
>   #define HW_COMPAT_2_4 \
> -        /* empty */
> +        {\
> +            .driver   = "virtio-blk-device",\
> +            .property = "scsi",\
> +            .value    = "true",\
> +        },

This code has changed a lot in the meantime...

> 
>   #define HW_COMPAT_2_3 \
>           {\
> diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
> index 3e230debb8..45a24e4fa6 100644
> --- a/hw/block/virtio-blk.c
> +++ b/hw/block/virtio-blk.c
> @@ -972,7 +972,7 @@ static Property virtio_blk_properties[] = {
>       DEFINE_PROP_STRING("serial", VirtIOBlock, conf.serial),
>       DEFINE_PROP_BIT("config-wce", VirtIOBlock, conf.config_wce, 0, true),
>   #ifdef __linux__
> -    DEFINE_PROP_BIT("scsi", VirtIOBlock, conf.scsi, 0, true),
> +    DEFINE_PROP_BIT("scsi", VirtIOBlock, conf.scsi, 0, false),
>   #endif
>       DEFINE_PROP_BIT("request-merging", VirtIOBlock, 
> conf.request_merging, 0,
>                       true),
> 
> Should this HW_COMPAT_2_4 entry be guarded with ifdef __linux__?

... so something like the following might do the trick:

diff --git a/hw/core/machine.c b/hw/core/machine.c
index 3e288bfceb7f..d8e30e4895d8 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -148,7 +148,8 @@ GlobalProperty hw_compat_2_5[] = {
 const size_t hw_compat_2_5_len = G_N_ELEMENTS(hw_compat_2_5);
 
 GlobalProperty hw_compat_2_4[] = {
-    { "virtio-blk-device", "scsi", "true" },
+    /* Optional because the 'scsi' property is Linux-only */
+    { "virtio-blk-device", "scsi", "true", .optional = true },
     { "e1000", "extra_mac_registers", "off" },
     { "virtio-pci", "x-disable-pcie", "on" },
     { "virtio-pci", "migrate-extra", "off" },


> 
> Probably nobody ran a pre-2.4 machine out of Linux =)
> 

Yeah. I'm wondering if there's more compat stuff in there that should
be optional. Devices that simply do not exist are not a problem, but
properties that not always exist are.



  reply	other threads:[~2020-01-23 11:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-20 14:09 [PATCH v5 0/2] virtio: make seg_max virtqueue size dependent Denis Plotnikov
2019-12-20 14:09 ` [PATCH v5 1/2] " Denis Plotnikov
2019-12-20 14:09 ` [PATCH v5 2/2] tests: add virtio-scsi and virtio-blk seg_max_adjust test Denis Plotnikov
2020-01-22 20:56   ` Philippe Mathieu-Daudé
2020-01-22 21:47     ` Philippe Mathieu-Daudé
2020-01-23 11:14       ` Cornelia Huck [this message]
2020-01-23 12:43     ` Wainer dos Santos Moschetta
2019-12-22 13:31 ` [PATCH v5 0/2] virtio: make seg_max virtqueue size dependent Michael S. Tsirkin
  -- strict thread matches above, loose matches on Subject: below --
2019-12-20 14:04 Denis Plotnikov
2019-12-20 14:04 ` [PATCH v5 2/2] tests: add virtio-scsi and virtio-blk seg_max_adjust test Denis Plotnikov

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=20200123121423.591c5f5d.cohuck@redhat.com \
    --to=cohuck@redhat.com \
    --cc=armbru@redhat.com \
    --cc=crosa@redhat.com \
    --cc=den@virtuozzo.com \
    --cc=dplotnikov@virtuozzo.com \
    --cc=ehabkost@redhat.com \
    --cc=fam@euphon.net \
    --cc=hare@suse.com \
    --cc=hch@lst.de \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.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).