Message ID | 7A85DF989CAE8F42902CF7B31A7D94A1487D6D13@shsmsx102.ccr.corp.intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | The WCE issue in guest when i enable WCE in Qemu side. | expand |
On 23/07/19 14:17, Zhong, Yang wrote: > When I set config-wce=true or false, the below value never change > root@unicorn ~ # cat /sys/block/vda/cache_type > write back > root@unicorn ~ # cat /sys/block/vda/device/features > 0010 0010 0110 0110 0000 0000 0000 1000 1000 0000 0000 0000 0000 0000 0000 0000 > From left to right, bit 11=0, which show there is no WCE feature in vhost-user-blk device. Does your backend expose the feature in the VHOST_GET_FEATURES message? > I also did one simple patch to add config_wce value into s->blkcfg.wce, but the result is same. config_wce doesn't tell you if you are in writeback or writethrough mode, it tells you if you can *change* the mode. If your backend did not expose the feature, try changing that and then "echo write through > /sys/block/vda/cache_type" should work? Paolo
On Tue, Jul 23, 2019 at 05:32:12PM +0200, Paolo Bonzini wrote: > On 23/07/19 14:17, Zhong, Yang wrote: > > When I set config-wce=true or false, the below value never change > > root@unicorn ~ # cat /sys/block/vda/cache_type > > write back > > root@unicorn ~ # cat /sys/block/vda/device/features > > 0010 0010 0110 0110 0000 0000 0000 1000 1000 0000 0000 0000 0000 0000 0000 0000 > > From left to right, bit 11=0, which show there is no WCE feature in vhost-user-blk device. > > Does your backend expose the feature in the VHOST_GET_FEATURES message? Paolo, thanks for your comments. The get features value in vhost-user-blk is 0x154007646(bit 11 is 0), which does not include WCE feature in default of SPDK vhost-blk module. > > I also did one simple patch to add config_wce value into s->blkcfg.wce, but the result is same. > > config_wce doesn't tell you if you are in writeback or writethrough > mode, it tells you if you can *change* the mode. > > If your backend did not expose the feature, try changing that and then > "echo write through > /sys/block/vda/cache_type" should work? > Paolo, yes, i enabled WCE feature in the backend code(SPDK), and did the test config-wce= true or false as below (1).config-wce=true in qemu command for vhosr-user-blk's perporty ##root@unicorn ~ # cat /sys/block/vda/device/features 0010 0010 0111 0110 000000000000100010000000000000000000000000000000 ---> bit 11 is "1", which support WCE feature. ##set the "write through" echo write through > /sys/block/vda/cache_type root@unicorn ~ # cat /sys/block/vda/cache_type write through (2).config-wce=false in qemu command for vhost-ser-blk root@unicorn ~ # cat /sys/block/vda/cache_type write back root@unicorn ~ # cat /sys/block/vda/device/features 0010 0010 0110 0110 0000 0000 0000 1000 1000 0000 0000 00000000000000000000 ---> bit 11 is "0" because of config-wce=false root@unicorn ~ # echo "write through" > /sys/block/vda/cache_type -bash: /sys/block/vda/cache_type: Permission denied Only config-wce=true can change the cache mode, thanks. The SPDK code i am using is latest version, So, i feel we should enable WCE feature in SPDK side by default. thanks for your help! Yang > Paolo
On 24/07/19 08:55, Yang Zhong wrote: > > The SPDK code i am using is latest version, So, i feel we should > enable WCE feature in SPDK side by default. thanks for your help! Note that enabling the CONFIG_WCE feature has some consequences. According to the spec: - if the VIRTIO_BLK_F_CONFIG_WCE feature was negotiated and the writeback field in configuration space was 0 all the time between the submission of the write and its completion, the device MUST ensure that stable writes are committed to persistent storage before reporting completion of the write. This means using FUA writes or something like that - the device MUST offset VIRTIO_BLK_F_FLUSH if they offer VIRTIO_BLK_F_CONFIG_WCE - if VIRTIO_BLK_F_CONFIG_WCE is negotiated but VIRTIO_BLK_F_FLUSH is not, the device MUST initialize writeback to 0 Paolo
On Wed, Jul 24, 2019 at 10:57:30AM +0200, Paolo Bonzini wrote: > On 24/07/19 08:55, Yang Zhong wrote: > > > > The SPDK code i am using is latest version, So, i feel we should > > enable WCE feature in SPDK side by default. thanks for your help! > > Note that enabling the CONFIG_WCE feature has some consequences. > According to the spec: > > - if the VIRTIO_BLK_F_CONFIG_WCE feature was negotiated and the > writeback field in configuration space was 0 all the time between the > submission of the write and its completion, the device MUST ensure that > stable writes are committed to persistent storage before reporting > completion of the write. This means using FUA writes or something like that > > - the device MUST offset VIRTIO_BLK_F_FLUSH if they offer > VIRTIO_BLK_F_CONFIG_WCE > > - if VIRTIO_BLK_F_CONFIG_WCE is negotiated but VIRTIO_BLK_F_FLUSH is > not, the device MUST initialize writeback to 0 > Paolo, thanks for your reminder, these info are very helpful to me:), thanks, Yang. > Paolo
diff --git a/hw/block/vhost-user-blk.c b/hw/block/vhost-user-blk.c index 9cb61336a6..0e3f490c82 100644 --- a/hw/block/vhost-user-blk.c +++ b/hw/block/vhost-user-blk.c @@ -447,6 +447,9 @@ reconnect: s->blkcfg.num_queues = s->num_queues; } + if (s->blkcfg.wce != s->config_wce) { + s->blkcfg.wce = s->config_wce; + } return; It seems the config-wce property setting in Qemu is not working, and I am not sure if this is a bug or vhost-user-blk only support write back mode ?