[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 6/9] virtio-blk: add "discard" and "write-zeroes" pro
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-block] [PULL 6/9] virtio-blk: add "discard" and "write-zeroes" properties |
Date: |
Mon, 11 Feb 2019 13:50:37 +0800 |
From: Stefano Garzarella <address@hidden>
In order to avoid migration issues, we enable DISCARD and
WRITE_ZEROES features only for machine type >= 4.0
As discussed with Michael S. Tsirkin and Stefan Hajnoczi on the
list [1], DISCARD operation should not have security implications
(eg. page cache attacks), so we can enable it by default.
[1] https://lists.gnu.org/archive/html/qemu-devel/2019-02/msg00504.html
Suggested-by: Dr. David Alan Gilbert <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Reviewed-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: Stefano Garzarella <address@hidden>
Acked-by: Pankaj Gupta <address@hidden>
Message-id: address@hidden
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
hw/block/virtio-blk.c | 4 ++++
hw/core/machine.c | 2 ++
2 files changed, 6 insertions(+)
diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
index 6526b94910..feeaf77965 100644
--- a/hw/block/virtio-blk.c
+++ b/hw/block/virtio-blk.c
@@ -1022,6 +1022,10 @@ static Property virtio_blk_properties[] = {
DEFINE_PROP_UINT16("queue-size", VirtIOBlock, conf.queue_size, 128),
DEFINE_PROP_LINK("iothread", VirtIOBlock, conf.iothread, TYPE_IOTHREAD,
IOThread *),
+ DEFINE_PROP_BIT64("discard", VirtIOBlock, host_features,
+ VIRTIO_BLK_F_DISCARD, true),
+ DEFINE_PROP_BIT64("write-zeroes", VirtIOBlock, host_features,
+ VIRTIO_BLK_F_WRITE_ZEROES, true),
DEFINE_PROP_END_OF_LIST(),
};
diff --git a/hw/core/machine.c b/hw/core/machine.c
index 077fbd182a..766ca5899d 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -33,6 +33,8 @@ GlobalProperty hw_compat_3_1[] = {
{ "usb-kbd", "serial", "42" },
{ "usb-mouse", "serial", "42" },
{ "usb-kbd", "serial", "42" },
+ { "virtio-blk-device", "discard", "false" },
+ { "virtio-blk-device", "write-zeroes", "false" },
};
const size_t hw_compat_3_1_len = G_N_ELEMENTS(hw_compat_3_1);
--
2.20.1
- [Qemu-block] [PULL 0/9] Block patches, Stefan Hajnoczi, 2019/02/11
- [Qemu-block] [PULL 3/9] virtio-blk: cleanup using VirtIOBlock *s and VirtIODevice *vdev, Stefan Hajnoczi, 2019/02/11
- [Qemu-block] [PULL 4/9] virtio-blk: add acct_failed param to virtio_blk_handle_rw_error(), Stefan Hajnoczi, 2019/02/11
- [Qemu-block] [PULL 5/9] virtio-blk: add host_features field in VirtIOBlock, Stefan Hajnoczi, 2019/02/11
- [Qemu-block] [PULL 6/9] virtio-blk: add "discard" and "write-zeroes" properties,
Stefan Hajnoczi <=
- [Qemu-block] [PULL 7/9] virtio-blk: add DISCARD and WRITE_ZEROES features, Stefan Hajnoczi, 2019/02/11
- [Qemu-block] [PULL 8/9] tests/virtio-blk: change assert on data_size in virtio_blk_request(), Stefan Hajnoczi, 2019/02/11
- [Qemu-block] [PULL 9/9] tests/virtio-blk: add test for WRITE_ZEROES command, Stefan Hajnoczi, 2019/02/11
- [Qemu-block] [PULL 1/9] iothread: fix iothread hang when stop too soon, Stefan Hajnoczi, 2019/02/11
- [Qemu-block] [PULL 2/9] qemugdb/coroutine: fix arch_prctl has unknown return type, Stefan Hajnoczi, 2019/02/11
- Re: [Qemu-block] [PULL 0/9] Block patches, Peter Maydell, 2019/02/11