Skip to contentSkip to conversation

virtio-blk: no scsi-passthrough by default

PATCH Applied Cornelia Huck 5 participants 14 messages Oct 16, 2015 – Oct 21, 2015

lore
Share & tools
lore
#3 lore raw

PATCH v2 2/3 ppc/spapr: add 2.4 compat props

In reply to Cornelia Huck

HW_COMPAT_2_4 will become non-empty: prepare for it.

---
 hw/ppc/spapr.c | 9 +++++++++
 1 file changed, 9 insertions(+)
hw/ppc/spapr.c +9 -0
index d1b0e53..c216e2c 100644
@@ -2224,7 +2224,11 @@ static const TypeInfo spapr_machine_info = {
     },
 };
 
+#define SPAPR_COMPAT_2_4 \
+        HW_COMPAT_2_4
+
 #define SPAPR_COMPAT_2_3 \
+        SPAPR_COMPAT_2_4 \
         HW_COMPAT_2_3 \
         {\
             .driver   = "spapr-pci-host-bridge",\
@@ -2338,11 +2342,16 @@ static const TypeInfo spapr_machine_2_3_info = {
 
 static void spapr_machine_2_4_class_init(ObjectClass *oc, void *data)
 {
+    static GlobalProperty compat_props[] = {
+        SPAPR_COMPAT_2_4
+        { /* end of list */ }
+    };
     MachineClass *mc = MACHINE_CLASS(oc);
 
     mc->desc = "pSeries Logical Partition (PAPR compliant) v2.4";
     mc->alias = "pseries";
     mc->is_default = 0;
+    mc->compat_props = compat_props;
 }
 
 static const TypeInfo spapr_machine_2_4_info = {
Signature · 1 line
2.3.9
#0 lore raw

v2 cover virtio-blk: no scsi-passthrough by default

Lightly tested on s390x.

Changes v1->v2:
- have the s390x compat hander include HW_COMPAT
- prepare the pseries 2.4 compat handler
- switch compat property at virtio-blk-device instead of the transport level

Cornelia Huck (3):
s390x: include HW_COMPAT_* props ppc/spapr: add 2.4 compat props
virtio-blk: switch off scsi-passthrough by default

 hw/block/virtio-blk.c      | 2 +-
 hw/ppc/spapr.c             | 9 +++++++++
 hw/s390x/s390-virtio-ccw.c | 2 ++
 include/hw/compat.h        | 6 +++++-
 4 files changed, 17 insertions(+), 2 deletions(-)
Signature · 1 line
2.3.9
#4 lore raw

PATCH v2 3/3 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.

---
 hw/block/virtio-blk.c | 2 +-
 include/hw/compat.h   | 6 +++++-
 2 files changed, 6 insertions(+), 2 deletions(-)
hw/block/virtio-blk.c +1 -1
index 8beb26b..999dbd7 100644
@@ -975,7 +975,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),
include/hw/compat.h +5 -1
index 095de5d..93e71af 100644
@@ -2,7 +2,11 @@
 #define HW_COMPAT_H
 
 #define HW_COMPAT_2_4 \
-        /* empty */
+        {\
+            .driver   = "virtio-blk-device",\
+            .property = "scsi",\
+            .value    = "true",\
+        },
 
 #define HW_COMPAT_2_3 \
         {\
Signature · 1 line
2.3.9
#1 lore raw

PATCH v2 1/3 s390x: include HW_COMPAT_* props

In reply to Cornelia Huck

We want to inherit generic hw compat as well.

---
 hw/s390x/s390-virtio-ccw.c | 2 ++
 1 file changed, 2 insertions(+)
hw/s390x/s390-virtio-ccw.c +2 -0
index 20883ff..d09d867 100644
@@ -20,6 +20,7 @@
 #include "qemu/config-file.h"
 #include "s390-pci-bus.h"
 #include "hw/s390x/storage-keys.h"
+#include "hw/compat.h"
 
 #define TYPE_S390_CCW_MACHINE               "s390-ccw-machine"
 
@@ -236,6 +237,7 @@ static const TypeInfo ccw_machine_info = {
 };
 
 #define CCW_COMPAT_2_4 \
+        HW_COMPAT_2_4 \
         {\
             .driver   = TYPE_S390_SKEYS,\
             .property = "migration-enabled",\
Signature · 1 line
2.3.9
Acked-by on v2 1/3
#2 lore raw

Re: [Qemu-devel] [PATCH v2 1/3] s390x: include HW_COMPAT_* props

Am 16.10.2015 um 12:25 schrieb Cornelia Huck:

Quoted 21 lines

We want to inherit generic hw compat as well.

---
 hw/s390x/s390-virtio-ccw.c | 2 ++
 1 file changed, 2 insertions(+)
hw/s390x/s390-virtio-ccw.c +1 -0
index 20883ff..d09d867 100644
@@ -20,6 +20,7 @@
 #include "qemu/config-file.h"
 #include "s390-pci-bus.h"
 #include "hw/s390x/storage-keys.h"
+#include "hw/compat.h"
 
 #define TYPE_S390_CCW_MACHINE               "s390-ccw-machine"
 

hw/s390x/s390-virtio-ccw.c static const TypeInfo ccw_machine_info = { · line 243

Quoted 7 lines
hw/s390x/s390-virtio-ccw.c +1 -0
@@ -236,6 +237,7 @@ static const TypeInfo ccw_machine_info = {
 };
 
 #define CCW_COMPAT_2_4 \
+        HW_COMPAT_2_4 \
         {\
             .driver   = TYPE_S390_SKEYS,\
             .property = "migration-enabled",\
#5 lore raw

Re: [Qemu-devel] [PATCH v2 3/3] virtio-blk: switch off scsi-passthrough by default

In reply to Cornelia Huck

Am 16.10.2015 um 12:25 schrieb Cornelia Huck:

Quoted 30 lines

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.

---
 hw/block/virtio-blk.c | 2 +-
 include/hw/compat.h   | 6 +++++-
 2 files changed, 6 insertions(+), 2 deletions(-)
hw/block/virtio-blk.c +1 -1
index 8beb26b..999dbd7 100644
@@ -975,7 +975,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),
include/hw/compat.h +0 -0
index 095de5d..93e71af 100644

include/hw/compat.h line 8

Quoted 8 lines
include/hw/compat.h +4 -1
@@ -2,7 +2,11 @@
 #define HW_COMPAT_H
 
 #define HW_COMPAT_2_4 \
-        /* empty */
+        {\
+            .driver   = "virtio-blk-device",\
+            .property = "scsi",\
+            .value    = "true",\

does that work?

If yes, would it make sense to convert the things in HW_COMPAT_2_3 from pci to device, e.g.

        {\
-           .driver   = "virtio-blk-pci",\
+           .driver   = "virtio-blk-device",\
            .property = "any_layout",\
            .value    = "off",\

...

#6 lore raw

Re: [Qemu-devel] [PATCH v2 3/3] virtio-blk: switch off scsi-passthrough by default

Quoted 33 lines · On Fri, 16 Oct 2015 12:32:52 +0200 Christian Borntraeger…

Am 16.10.2015 um 12:25 schrieb Cornelia Huck:

Quoted 32 lines

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.

---
 hw/block/virtio-blk.c | 2 +-
 include/hw/compat.h   | 6 +++++-
 2 files changed, 6 insertions(+), 2 deletions(-)
hw/block/virtio-blk.c +1 -1
index 8beb26b..999dbd7 100644
@@ -975,7 +975,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),
include/hw/compat.h +0 -0
index 095de5d..93e71af 100644
@@ -2,7 +2,11 @@
 #define HW_COMPAT_H
 
Quoted 8 lines

include/hw/compat.h line 8

Quoted 6 lines
include/hw/compat.h +4 -1
 #define HW_COMPAT_2_4 \
-        /* empty */
+        {\
+            .driver   = "virtio-blk-device",\
+            .property = "scsi",\
+            .value    = "true",\

does that work?

It did for me :)

Review

Quoted 11 lines

If yes, would it make sense to convert the things in HW_COMPAT_2_3 from pci to device, e.g.

        {\
(quoted diff) +1 -1
-           .driver   = "virtio-blk-pci",\
+           .driver   = "virtio-blk-device",\
            .property = "any_layout",\
            .value    = "off",\
...

Not sure: We don't have 2.3 compat for ccw... but would give a better template for later changes.

#7 lore raw

Re: [Qemu-devel] [PATCH v2 3/3] virtio-blk: switch off scsi-passthrough by default

Am 16.10.2015 um 12:44 schrieb Cornelia Huck:

Quoted 59 lines
Quoted 33 lines · On Fri, 16 Oct 2015 12:32:52 +0200 Christian Borntraeger…

Am 16.10.2015 um 12:25 schrieb Cornelia Huck:

Quoted 32 lines

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.

---
 hw/block/virtio-blk.c | 2 +-
 include/hw/compat.h   | 6 +++++-
 2 files changed, 6 insertions(+), 2 deletions(-)
hw/block/virtio-blk.c +1 -1
index 8beb26b..999dbd7 100644
@@ -975,7 +975,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),
include/hw/compat.h +0 -0
index 095de5d..93e71af 100644
@@ -2,7 +2,11 @@
 #define HW_COMPAT_H
 
Quoted 8 lines

include/hw/compat.h line 8

Quoted 6 lines
include/hw/compat.h +4 -1
 #define HW_COMPAT_2_4 \
-        /* empty */
+        {\
+            .driver   = "virtio-blk-device",\
+            .property = "scsi",\
+            .value    = "true",\

does that work?

It did for me :)

Review

Quoted 11 lines

If yes, would it make sense to convert the things in HW_COMPAT_2_3 from pci to device, e.g.

        {\
(quoted diff) +1 -1
-           .driver   = "virtio-blk-pci",\
+           .driver   = "virtio-blk-device",\
            .property = "any_layout",\
            .value    = "off",\
...
Quoted 2 lines

Not sure: We don't have 2.3 compat for ccw... but would give a better template for later changes.

Yes. But this can be an addon patch.

Lets keep this patch as is to have scsi=off as default for virtio 1.0

(some iotests do fail because of this)

Christian

#12 lore raw
In reply to Cornelia Huck
Quoted 13 lines · Cornelia Huck

Lightly tested on s390x.

Changes v1->v2:
- have the s390x compat hander include HW_COMPAT
- prepare the pseries 2.4 compat handler
- switch compat property at virtio-blk-device instead of the transport level

Cornelia Huck (3):
s390x: include HW_COMPAT_* props ppc/spapr: add 2.4 compat props
virtio-blk: switch off scsi-passthrough by default

Quoted 6 lines
 hw/block/virtio-blk.c      | 2 +-
 hw/ppc/spapr.c             | 9 +++++++++
 hw/s390x/s390-virtio-ccw.c | 2 ++
 include/hw/compat.h        | 6 +++++-
 4 files changed, 17 insertions(+), 2 deletions(-)

Thanks! It all looks good.

Paolo

#8 lore raw

Re: [Qemu-devel] [PATCH v2 3/3] virtio-blk: switch off scsi-passthrough by default

In reply to Christian Borntraeger
Quoted 63 lines · Christian Borntraeger

Am 16.10.2015 um 12:44 schrieb Cornelia Huck:

Quoted 59 lines
Quoted 33 lines · On Fri, 16 Oct 2015 12:32:52 +0200 Christian Borntraeger…

Am 16.10.2015 um 12:25 schrieb Cornelia Huck:

Quoted 32 lines

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.

---
 hw/block/virtio-blk.c | 2 +-
 include/hw/compat.h   | 6 +++++-
 2 files changed, 6 insertions(+), 2 deletions(-)
hw/block/virtio-blk.c +1 -1
index 8beb26b..999dbd7 100644
@@ -975,7 +975,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),
include/hw/compat.h +0 -0
index 095de5d..93e71af 100644
@@ -2,7 +2,11 @@
 #define HW_COMPAT_H
 
Quoted 8 lines

include/hw/compat.h line 8

Quoted 6 lines
include/hw/compat.h +4 -1
 #define HW_COMPAT_2_4 \
-        /* empty */
+        {\
+            .driver   = "virtio-blk-device",\
+            .property = "scsi",\
+            .value    = "true",\

does that work?

It did for me :)

Review

Quoted 11 lines

If yes, would it make sense to convert the things in HW_COMPAT_2_3 from pci to device, e.g.

        {\
(quoted diff) +1 -1
-           .driver   = "virtio-blk-pci",\
+           .driver   = "virtio-blk-device",\
            .property = "any_layout",\
            .value    = "off",\
...
Quoted 2 lines

Not sure: We don't have 2.3 compat for ccw... but would give a better template for later changes.

Quoted 7 lines

Yes. But this can be an addon patch.

Lets keep this patch as is to have scsi=off as default for virtio 1.0

(some iotests do fail because of this)

Christian

What fails, exactly?

#9 lore raw

Re: [Qemu-devel] [PATCH v2 3/3] virtio-blk: switch off scsi-passthrough by default

Quoted 9 lines · On Sun, 18 Oct 2015 10:59:59 +0300 "Michael S. Tsirkin" <[email protected]> wrote:
Quoted 5 lines · Christian Borntraeger

Lets keep this patch as is to have scsi=off as default for virtio 1.0

(some iotests do fail because of this)

Christian

What fails, exactly?

For example, testcase 068 (on s390x, since we default virtio-1 to on):

068.out.bad renamed from data/git/yyy/qemu/tests/qemu-iotests/068.out +3 -4
@@ -3,9 +3,8 @@
 === Saving and reloading a VM state to/from a qcow2 image ===
 
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=131072
+qemu-system-s390x: -hda /data/git/yyy/qemu/build/tests/qemu-iotests/scratch/t.qcow2: Please set scsi=off for virtio-blk devices in order to use virtio 1.0
 QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) savevm 0
-(qemu) quit
+(qemu) qemu-system-s390x: -hda /data/git/yyy/qemu/build/tests/qemu-iotests/scratch/t.qcow2: Please set scsi=off for virtio-blk devices in order to use virtio 1.0
 QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) quit
-*** done
+(qemu) *** done
#10 lore raw

Re: [Qemu-devel] [PATCH v2 3/3] virtio-blk: switch off scsi-passthrough by default

Quoted 7 lines · Cornelia Huck
Quoted 4 lines · On Sun, 18 Oct 2015 10:59:59 +0300 "Michael S. Tsirkin" <[email protected]> wrote:
Quoted 2 lines · Christian Borntraeger

Lets keep this patch as is to have scsi=off as default for virtio 1.0

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

(some iotests do fail because of this)

Christian

What fails, exactly?

For example, testcase 068 (on s390x, since we default virtio-1 to on):

I see, thanks.
So it's just the assertion that we have in code that fires. Sure, scsi must be off by default before virtio 1 is on.

Quoted 15 lines
068.out.bad renamed from data/git/yyy/qemu/tests/qemu-iotests/068.out +3 -4
@@ -3,9 +3,8 @@
 === Saving and reloading a VM state to/from a qcow2 image ===
 
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=131072
+qemu-system-s390x: -hda /data/git/yyy/qemu/build/tests/qemu-iotests/scratch/t.qcow2: Please set scsi=off for virtio-blk devices in order to use virtio 1.0
 QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) savevm 0
-(qemu) quit
+(qemu) qemu-system-s390x: -hda /data/git/yyy/qemu/build/tests/qemu-iotests/scratch/t.qcow2: Please set scsi=off for virtio-blk devices in order to use virtio 1.0
 QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) quit
-*** done
+(qemu) *** done
#11 lore raw

Re: [Qemu-devel] [PATCH v2 3/3] virtio-blk: switch off scsi-passthrough by default

Quoted 12 lines · On Mon, 19 Oct 2015 14:57:31 +0300 "Michael S. Tsirkin" <[email protected]> wrote:
Quoted 11 lines · Cornelia Huck
Quoted 8 lines · On Sun, 18 Oct 2015 10:59:59 +0300 "Michael S. Tsirkin" <[email protected]> wrote:
Quoted 5 lines · Christian Borntraeger

Lets keep this patch as is to have scsi=off as default for virtio 1.0

(some iotests do fail because of this)

Christian

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

What fails, exactly?

For example, testcase 068 (on s390x, since we default virtio-1 to on):

I see, thanks.
So it's just the assertion that we have in code that fires. Sure, scsi must be off by default before virtio 1 is on.

And -hda always assumes defaults...

#13 lore raw
In reply to Cornelia Huck
Quoted 13 lines · Cornelia Huck

Lightly tested on s390x.

Changes v1->v2:
- have the s390x compat hander include HW_COMPAT
- prepare the pseries 2.4 compat handler
- switch compat property at virtio-blk-device instead of the transport level

Cornelia Huck (3):
s390x: include HW_COMPAT_* props ppc/spapr: add 2.4 compat props
virtio-blk: switch off scsi-passthrough by default

Quoted 5 lines
 hw/block/virtio-blk.c      | 2 +-
 hw/ppc/spapr.c             | 9 +++++++++
 hw/s390x/s390-virtio-ccw.c | 2 ++
 include/hw/compat.h        | 6 +++++-
 4 files changed, 17 insertions(+), 2 deletions(-)

Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block

Stefan