Skip to contentSkip to conversation

vhost-blk: turn on pre-defined RO feature bit

PATCH Superseded Changpeng Liu 2 participants 5 messages May 18, 2018 – May 27, 2018

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vhost-blk: turn on pre-defined RO feature bit

Read only feature shouldn't be negotiable, because if the backend device reported Read only feature supported, QEMU host driver shouldn't change backend's RO attribute.

---
 hw/block/vhost-user-blk.c          | 5 +----
 include/hw/virtio/vhost-user-blk.h | 1 -
 2 files changed, 1 insertion(+), 5 deletions(-)
hw/block/vhost-user-blk.c +1 -4
index 262baca..cdc54dd 100644
@@ -204,13 +204,11 @@ static uint64_t vhost_user_blk_get_features(VirtIODevice *vdev,
     virtio_add_feature(&features, VIRTIO_BLK_F_TOPOLOGY);
     virtio_add_feature(&features, VIRTIO_BLK_F_BLK_SIZE);
     virtio_add_feature(&features, VIRTIO_BLK_F_FLUSH);
+    virtio_add_feature(&features, VIRTIO_BLK_F_RO);
 
     if (s->config_wce) {
         virtio_add_feature(&features, VIRTIO_BLK_F_CONFIG_WCE);
     }
-    if (s->config_ro) {
-        virtio_add_feature(&features, VIRTIO_BLK_F_RO);
-    }
     if (s->num_queues > 1) {
         virtio_add_feature(&features, VIRTIO_BLK_F_MQ);
     }
@@ -322,7 +320,6 @@ static Property vhost_user_blk_properties[] = {
     DEFINE_PROP_UINT16("num-queues", VHostUserBlk, num_queues, 1),
     DEFINE_PROP_UINT32("queue-size", VHostUserBlk, queue_size, 128),
     DEFINE_PROP_BIT("config-wce", VHostUserBlk, config_wce, 0, true),
-    DEFINE_PROP_BIT("config-ro", VHostUserBlk, config_ro, 0, false),
     DEFINE_PROP_END_OF_LIST(),
 };
 
include/hw/virtio/vhost-user-blk.h +0 -1
index 5804cc9..8c7c79b 100644
@@ -34,7 +34,6 @@ typedef struct VHostUserBlk {
     uint16_t num_queues;
     uint32_t queue_size;
     uint32_t config_wce;
-    uint32_t config_ro;
     struct vhost_dev dev;
 } VHostUserBlk;
 
Signature · 1 line
1.9.3
#1 lore raw
Quoted 3 lines · Changpeng Liu

Read only feature shouldn't be negotiable, because if the backend device reported Read only feature supported, QEMU host driver shouldn't change backend's RO attribute.

I don't understand this patch.

Does it make *all* virtio-blk devices read-only?

Or is the idea that the vhost-user slave has to clear the read-only bit if it is a writable device?

Stefan

#2 lore raw
Quoted 9 lines

-----Original Message-----
From: Stefan Hajnoczi [mailto:[email protected]]
Sent: Tuesday, May 22, 2018 6:11 AM
To: Liu, Changpeng <[email protected]>
Cc: [email protected]; [email protected]
Subject: Re: [PATCH] vhost-blk: turn on pre-defined RO feature bit

Quoted 8 lines
Quoted 3 lines · Changpeng Liu

Read only feature shouldn't be negotiable, because if the backend device reported Read only feature supported, QEMU host driver shouldn't change backend's RO attribute.

I don't understand this patch.

Does it make *all* virtio-blk devices read-only?

If the slave target reported RO feature, the disk in OS should be RO, currently users should specify in QEMU command to enable RO.

Quoted 3 lines

Or is the idea that the vhost-user slave has to clear the read-only bit if it is a writable device?

Exactly.

Quoted 2 lines

Stefan

#3 lore raw
Quoted 16 lines · Changpeng
Quoted 16 lines

-----Original Message-----
From: Stefan Hajnoczi [mailto:[email protected]]
Sent: Tuesday, May 22, 2018 6:11 AM
To: Liu, Changpeng <[email protected]>
Cc: [email protected]; [email protected]
Subject: Re: [PATCH] vhost-blk: turn on pre-defined RO feature bit

Quoted 3 lines · Changpeng Liu

Read only feature shouldn't be negotiable, because if the backend device reported Read only feature supported, QEMU host driver shouldn't change backend's RO attribute.

I don't understand this patch.

Quoted 7 lines
Quoted 1 line

Does it make *all* virtio-blk devices read-only?

If the slave target reported RO feature, the disk in OS should be RO, currently users should specify in QEMU command to enable RO.

Quoted 3 lines

Or is the idea that the vhost-user slave has to clear the read-only bit if it is a writable device?

Exactly.

Thanks for explaining!

Please implement the read-only bit in contrib/vhost-user-blk we it can be tested.

Thanks,
Stefan

#4 lore raw
Quoted 30 lines

-----Original Message-----
From: Stefan Hajnoczi [mailto:[email protected]]
Sent: Friday, May 25, 2018 6:20 PM
To: Liu, Changpeng <[email protected]>
Cc: [email protected]; [email protected]
Subject: Re: [PATCH] vhost-blk: turn on pre-defined RO feature bit

Quoted 20 lines · Changpeng
Quoted 9 lines

-----Original Message-----
From: Stefan Hajnoczi [mailto:[email protected]]
Sent: Tuesday, May 22, 2018 6:11 AM
To: Liu, Changpeng <[email protected]>
Cc: [email protected]; [email protected]
Subject: Re: [PATCH] vhost-blk: turn on pre-defined RO feature bit

Quoted 8 lines
Quoted 3 lines · Changpeng Liu

Read only feature shouldn't be negotiable, because if the backend device reported Read only feature supported, QEMU host driver shouldn't change backend's RO attribute.

I don't understand this patch.

Does it make *all* virtio-blk devices read-only?

If the slave target reported RO feature, the disk in OS should be RO, currently users should specify in QEMU command to enable RO.

Quoted 1 line
Quoted 8 lines
Quoted 3 lines
Quoted 2 lines

Or is the idea that the vhost-user slave has to clear the read-only bit if it is a writable device?

Exactly.

Thanks for explaining!

Please implement the read-only bit in contrib/vhost-user-blk we it can be tested.

Sounds good, will add the test together.

Quoted 3 lines

Thanks,
Stefan