[PATCH] hw/nvme: set DNR on compare failure

2022-08-24 Thread Klaus Jensen
From: Klaus Jensen Even if the host is somehow using compare to do compare-and-write, the host should be notified immediately about the compare failure and not have to wait for the driver to potentially retry the command. Reported-by: Jim Harris Signed-off-by: Klaus Jensen --- hw/nvme/ctrl.c

Re: [PATCH v7 4/8] block: add block layer APIs resembling Linux ZonedBlockDevice ioctls

2022-08-24 Thread Damien Le Moal
On 2022/08/24 16:46, Damien Le Moal wrote: > On 2022/08/22 21:12, Sam Li wrote: >> Stefan Hajnoczi 于2022年8月23日周二 08:49写道: >>> >>> On Tue, Aug 16, 2022 at 02:25:18PM +0800, Sam Li wrote: [...] +blkz = (struct blk_zone *)(rep + 1); +while (n < nrz) { +memset(rep, 0, rep

Re: [PATCH v7 4/8] block: add block layer APIs resembling Linux ZonedBlockDevice ioctls

2022-08-24 Thread Damien Le Moal
On 2022/08/22 21:12, Sam Li wrote: > Stefan Hajnoczi 于2022年8月23日周二 08:49写道: >> >> On Tue, Aug 16, 2022 at 02:25:18PM +0800, Sam Li wrote: >>> By adding zone management operations in BlockDriver, storage controller >>> emulation can use the new block layer APIs including Report Zone and >>> four zo

Re: [PATCH v1 2/5] virtio-blk: move config space sizing code to virtio-blk-common

2022-08-24 Thread Daniil Tatianin
On 8/24/22 9:13 PM, Stefan Hajnoczi wrote: On Wed, Aug 24, 2022 at 12:18:34PM +0300, Daniil Tatianin wrote: +size_t virtio_blk_common_get_config_size(uint64_t host_features) +{ +size_t config_size = MAX(VIRTIO_BLK_CFG_SIZE, +virtio_feature_get_config_size(feature_sizes, host_featu

Re: [PATCH v1 3/5] vhost-user-blk: make it possible to disable write-zeroes/discard

2022-08-24 Thread Daniil Tatianin
On 8/24/22 9:00 PM, Stefan Hajnoczi wrote: On Wed, Aug 24, 2022 at 12:18:35PM +0300, Daniil Tatianin wrote: diff --git a/hw/block/vhost-user-blk.c b/hw/block/vhost-user-blk.c index 9117222456..e89164c358 100644 --- a/hw/block/vhost-user-blk.c +++ b/hw/block/vhost-user-blk.c @@ -251,6 +251,8 @@ s

Re: [PATCH v1 5/5] vhost-user-blk: dynamically resize config space based on features

2022-08-24 Thread Stefan Hajnoczi
On Wed, Aug 24, 2022 at 12:18:37PM +0300, Daniil Tatianin wrote: > Make vhost-user-blk backwards compatible when migrating from older VMs > running with modern features turned off, the same way it was done for > virtio-blk in 20764be0421c ("virtio-blk: set config size depending on the > features e

Re: [PATCH v1 2/5] virtio-blk: move config space sizing code to virtio-blk-common

2022-08-24 Thread Stefan Hajnoczi
On Wed, Aug 24, 2022 at 12:18:34PM +0300, Daniil Tatianin wrote: > +size_t virtio_blk_common_get_config_size(uint64_t host_features) > +{ > +size_t config_size = MAX(VIRTIO_BLK_CFG_SIZE, > +virtio_feature_get_config_size(feature_sizes, host_features)); > + > +assert(config_size <= s

Re: [PATCH v1 3/5] vhost-user-blk: make it possible to disable write-zeroes/discard

2022-08-24 Thread Stefan Hajnoczi
On Wed, Aug 24, 2022 at 12:18:35PM +0300, Daniil Tatianin wrote: > diff --git a/hw/block/vhost-user-blk.c b/hw/block/vhost-user-blk.c > index 9117222456..e89164c358 100644 > --- a/hw/block/vhost-user-blk.c > +++ b/hw/block/vhost-user-blk.c > @@ -251,6 +251,8 @@ static uint64_t vhost_user_blk_get_fe

Re: [PATCH 07/51] tests: Avoid using hardcoded /tmp in test cases

2022-08-24 Thread Dr. David Alan Gilbert
* Bin Meng (bmeng...@gmail.com) wrote: > From: Bin Meng > > Use g_get_tmp_dir() to get the directory to use for temporary files. > > Signed-off-by: Bin Meng > --- > > tests/qtest/fuzz/generic_fuzz_configs.h | 6 -- > tests/qtest/ahci-test.c | 15 +++ > tests/q

Re: [PATCH v1 4/5] vhost-user-blk: make 'config_wce' part of 'host_features'

2022-08-24 Thread Stefan Hajnoczi
On Wed, Aug 24, 2022 at 12:18:36PM +0300, Daniil Tatianin wrote: > @@ -591,7 +588,8 @@ static Property vhost_user_blk_properties[] = { > DEFINE_PROP_UINT16("num-queues", VHostUserBlk, num_queues, > VHOST_USER_BLK_AUTO_NUM_QUEUES), > DEFINE_PROP_UINT32("queue-size",

Re: EBUSY when using NVMe Block Driver with multiple devices in the same IOMMU group

2022-08-24 Thread Stefan Hajnoczi
On Tue, Aug 23, 2022 at 10:36:00PM +, Martin Oliveira wrote: > Hello, > > I'm trying to use the QEMU NVMe userspace driver and I'm hitting an error > when trying to use more than one device from an IOMMU group: > > Failed to open VFIO group file: /dev/vfio/39: Device or resource busy >

Re: EBUSY when using NVMe Block Driver with multiple devices in the same IOMMU group

2022-08-24 Thread Martin Oliveira
> On Aug 24, 2022, at 4:36 PM, Martin Oliveira > wrote: >-drive file=nvme://:26:00.0,if=none,id=drive0,format=raw >-device virtio-blk,drive=drive0,id=virtio0,serial=nvme0 Small typo above, I missed the /1, it should read: -drive file=nvme://:26:00.0/1,if=none,id=drive0,forma

[PATCH v1 3/5] vhost-user-blk: make it possible to disable write-zeroes/discard

2022-08-24 Thread Daniil Tatianin
It is useful to have the ability to disable these features for compatibility with older VMs that don't have these implemented. Signed-off-by: Daniil Tatianin --- hw/block/vhost-user-blk.c | 8 ++-- include/hw/virtio/vhost-user-blk.h | 2 ++ 2 files changed, 8 insertions(+), 2 deleti

[PATCH v1 5/5] vhost-user-blk: dynamically resize config space based on features

2022-08-24 Thread Daniil Tatianin
Make vhost-user-blk backwards compatible when migrating from older VMs running with modern features turned off, the same way it was done for virtio-blk in 20764be0421c ("virtio-blk: set config size depending on the features enabled") It's currently impossible to migrate from an older VM with vhos

[PATCH v1 0/5] vhost-user-blk: dynamically resize config space based on features

2022-08-24 Thread Daniil Tatianin
This patch set attempts to align vhost-user-blk with virtio-blk in terms of backward compatibility and flexibility. In particular it adds the following things: - Ability to disable modern features like discard/write-zeroes. - Dynamic configuration space resizing based on enabled features, by reu

[PATCH v1 4/5] vhost-user-blk: make 'config_wce' part of 'host_features'

2022-08-24 Thread Daniil Tatianin
No reason to have this be a separate field. This also makes it more akin to what the virtio-blk device does. Signed-off-by: Daniil Tatianin --- hw/block/vhost-user-blk.c | 6 ++ include/hw/virtio/vhost-user-blk.h | 1 - 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/

[PATCH v1 1/5] virtio-blk: decouple config size determination code from VirtIOBlock

2022-08-24 Thread Daniil Tatianin
Make it more stand-alone so that we can reuse it for other virtio-blk devices that are not VirtIOBlock in the future commits. Signed-off-by: Daniil Tatianin --- hw/block/virtio-blk.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/hw/block/virtio-blk.c b/hw/block/vir

Re: [PATCH 02/51] tests/qtest: Use g_mkdtemp()

2022-08-24 Thread Thomas Huth
On 24/08/2022 11.39, Bin Meng wrote: From: Bin Meng Windows does not provide a mkdtemp() API, but glib does. Replace mkdtemp() call with the glib version. Signed-off-by: Bin Meng --- tests/qtest/fuzz/generic_fuzz_configs.h | 2 +- tests/qtest/cdrom-test.c| 2 +- tests/qte

Re: [PATCH 4/4] hw/nvme: add MSI-x mask handlers for irqfd

2022-08-24 Thread Jinhao Fan
On 8/24/2022 7:22 PM, Klaus Jensen wrote: What are the implications if we drop it? That is, if we go back to your version that did not include this? If it doesnt impact the kvm irqchip logic, then I'd rather that we rip it out and leave the device without masking/unmasking support, keeping irqfd

Re: [PATCH 4/4] hw/nvme: add MSI-x mask handlers for irqfd

2022-08-24 Thread Klaus Jensen
On Aug 23 22:43, Jinhao Fan wrote: > On 8/16/2022 6:46 PM, Klaus Jensen wrote: > > Did qtest work out for you for testing? If so, it would be nice to add a > > simple test case as well. > > Since MSI-x masking handlers are only implemented for IO queues, if we want > to use qtest we need to implem

[PATCH 2/2] block: add missed block_acct_setup with new block device init procedure

2022-08-24 Thread Denis V. Lunev
Commit 5f76a7aac156ca75680dad5df4a385fd0b58f6b1 is looking harmless from the first glance, but it has changed things a lot. 'libvirt' uses it to detect that it should follow new initialization way and this changes things considerably. With this procedure followed, blockdev_init() is not called anym

[PATCH 33/51] tests/qtest: {ahci, ide}-test: Use relative path for temporary files

2022-08-24 Thread Bin Meng
From: Bin Meng These test cases uses "blkdebug:path/to/config:path/to/image" for testing. On Windows, absolute file paths contain the delimiter ':' which causes the blkdebug filename parser fail to parse filenames. Signed-off-by: Bin Meng --- tests/qtest/ahci-test.c | 19 ---

[PATCH 32/51] tests/qtest: Fix ERROR_SHARING_VIOLATION for win32

2022-08-24 Thread Bin Meng
From: Bin Meng On Windows, the MinGW provided mkstemp() API opens the file with exclusive access, denying other processes to read/write the file. Such behavior prevents the QEMU executable from opening the file, (e.g.: CreateFile returns ERROR_SHARING_VIOLATION). This can be fixed by closing the

[PATCH 1/2] block: pass OnOffAuto instead of bool to block_acct_setup()

2022-08-24 Thread Denis V. Lunev
We would have one more place for block_acct_setup() calling, which should not corrupt original value. Signed-off-by: Denis V. Lunev Reviewed-by: Vladimir Sementsov-Ogievskiy CC: Peter Krempa CC: Markus Armbruster CC: John Snow CC: Kevin Wolf CC: Hanna Reitz --- block/accounting.c |

[PATCH v5 0/2] block: add missed block_acct_setup with new block device init procedure

2022-08-24 Thread Denis V. Lunev
Commit 5f76a7aac156ca75680dad5df4a385fd0b58f6b1 is looking harmless from the first glance, but it has changed things a lot. 'libvirt' uses it to detect that it should follow new initialization way and this changes things considerably. With this procedure followed, blockdev_init() is not called anym

[PATCH 30/51] tests: Skip iotests and qtest when '--without-default-devices'

2022-08-24 Thread Bin Meng
From: Bin Meng When QEMU is configured with '--without-default-devices', we should not build and run iotests and qtest because devices used by these test cases are not built in. Signed-off-by: Bin Meng --- tests/qemu-iotests/meson.build | 5 + tests/qtest/meson.build| 5 + 2 f

[PATCH 38/51] tests/qtest: {ahci,ide}-test: Open file in binary mode

2022-08-24 Thread Bin Meng
From: Xuzhou Cheng By default Windows opens file in text mode, while a POSIX compliant implementation treats text files and binary files the same. The fopen() 'mode' string can include the letter 'b' to indicate binary mode shall be used. POSIX spec says the character 'b' shall have no effect, b

[PATCH 08/51] block/vvfat: Unify the mkdir() call

2022-08-24 Thread Bin Meng
From: Bin Meng There is a difference in the mkdir() call for win32 and non-win32 platforms, and currently is handled in the codes with #ifdefs. glib provides a portable g_mkdir_with_parents() API and we can use it to unify the codes without #ifdefs. Signed-off-by: Bin Meng --- block/vvfat.c

[PATCH 03/51] block: Unify the get_tmp_filename() implementation

2022-08-24 Thread Bin Meng
From: Bin Meng At present get_tmp_filename() has platform specific implementations to get the directory to use for temporary files. Switch over to use g_get_tmp_dir() which works on all supported platforms. Signed-off-by: Bin Meng --- block.c | 16 ++-- 1 file changed, 2 insertion

[PATCH 00/51] tests/qtest: Enable running qtest on Windows

2022-08-24 Thread Bin Meng
In prepartion to adding virtio-9p support on Windows, this series enables running qtest on Windows, so that we can run the virtio-9p tests on Windows to make sure it does not break accidently. Patch 1-22 updates various components (mostly test cases) so that they can build on Windows with the same

[PATCH 07/51] tests: Avoid using hardcoded /tmp in test cases

2022-08-24 Thread Bin Meng
From: Bin Meng Use g_get_tmp_dir() to get the directory to use for temporary files. Signed-off-by: Bin Meng --- tests/qtest/fuzz/generic_fuzz_configs.h | 6 -- tests/qtest/ahci-test.c | 15 +++ tests/qtest/aspeed_smc-test.c | 4 +++- tests/qtest/boo

[PATCH 02/51] tests/qtest: Use g_mkdtemp()

2022-08-24 Thread Bin Meng
From: Bin Meng Windows does not provide a mkdtemp() API, but glib does. Replace mkdtemp() call with the glib version. Signed-off-by: Bin Meng --- tests/qtest/fuzz/generic_fuzz_configs.h | 2 +- tests/qtest/cdrom-test.c| 2 +- tests/qtest/cxl-test.c | 6 +++---

[PATCH v3 3/3] util/aio-win32: Correct the event array size in aio_poll()

2022-08-24 Thread Bin Meng
From: Bin Meng WaitForMultipleObjects() can only wait for MAXIMUM_WAIT_OBJECTS object handles. Correct the event array size in aio_poll() and add a assert() to ensure it does not cause out of bound access. Signed-off-by: Bin Meng Reviewed-by: Stefan Weil Reviewed-by: Marc-André Lureau --- (n

Re: [PATCH v5 1/9] parallels: Out of image offset in BAT leads to image inflation

2022-08-24 Thread Vladimir Sementsov-Ogievskiy
On 8/23/22 13:11, Denis V. Lunev wrote: On 23.08.2022 11:58, Vladimir Sementsov-Ogievskiy wrote: On 8/23/22 12:20, Denis V. Lunev wrote: On 23.08.2022 09:23, Alexander Ivanov wrote: On 23.08.2022 08:58, Vladimir Sementsov-Ogievskiy wrote: On 8/22/22 12:05, Alexander Ivanov wrote: data_end f