Re: [PATCH 1/5] vhost-user-blk: Don't reconnect during initialisation

2021-04-23 Thread Denis Plotnikov
Reviewed-by: Denis Plotnikov On 22.04.2021 20:02, Kevin Wolf wrote: This is a partial revert of commits 77542d43149 and bc79c87bcde. Usually, an error during initialisation means that the configuration was wrong. Reconnecting won't make the error go away, but just turn the error condition into

Re: [PATCH v3 00/36] block: update graph permissions update

2021-04-23 Thread Kevin Wolf
Am 18.03.2021 um 09:04 hat Vladimir Sementsov-Ogievskiy geschrieben: > 17.03.2021 20:33, Eric Blake wrote: > > On 3/17/21 10:38 AM, Vladimir Sementsov-Ogievskiy wrote: > > > > > > 6/36 Checking commit 5780b805277e (block: drop ctx argument from > > > > bdrv_root_attach_child) > > > > 7/36 Checking

Re: [PATCH v2 1/2] block: Add BDRV_O_NO_SHARE for blk_new_open()

2021-04-23 Thread Vladimir Sementsov-Ogievskiy
22.04.2021 19:43, Kevin Wolf wrote: Normally, blk_new_open() just shares all permissions. This was fine originally when permissions only protected against uses in the same process because no other part of the code would actually get to access the block nodes opened with blk_new_open(). However, s

Re: [PATCH v3 06/33] util/async: aio_co_schedule(): support reschedule in same ctx

2021-04-23 Thread Roman Kagan
On Fri, Apr 16, 2021 at 11:08:44AM +0300, Vladimir Sementsov-Ogievskiy wrote: > With the following patch we want to call wake coroutine from thread. > And it doesn't work with aio_co_wake: > Assume we have no iothreads. > Assume we have a coroutine A, which waits in the yield point for > external a

Re: [PATCH for-6.0 v2 0/2] hw/block/nvme: fix msix uninit

2021-04-23 Thread Klaus Jensen
On Apr 23 07:21, Klaus Jensen wrote: From: Klaus Jensen First patch fixes a regression where msix is not correctly uninit'ed when an nvme device is hotplugged with device_del. When viewed in conjunction with the commit that introduced the bug (commit 1901b4967c3f), I think the fix looks relativ

Re: [PATCH for-6.0 v2 0/2] hw/block/nvme: fix msix uninit

2021-04-23 Thread Peter Maydell
On Fri, 23 Apr 2021 at 11:38, Klaus Jensen wrote: > > On Apr 23 07:21, Klaus Jensen wrote: > >From: Klaus Jensen > > > >First patch fixes a regression where msix is not correctly uninit'ed > >when an nvme device is hotplugged with device_del. When viewed in > >conjunction with the commit that int

Re: [PATCH v3 01/36] tests/test-bdrv-graph-mod: add test_parallel_exclusive_write

2021-04-23 Thread Kevin Wolf
Am 17.03.2021 um 15:34 hat Vladimir Sementsov-Ogievskiy geschrieben: > Add the test that shows that concept of ignore_children is incomplete. > Actually, when we want to update something, ignoring permission of some > existing BdrvChild, we should ignore also the propagated effect of this > child t

Re: [PATCH v3 01/36] tests/test-bdrv-graph-mod: add test_parallel_exclusive_write

2021-04-23 Thread Vladimir Sementsov-Ogievskiy
23.04.2021 15:25, Kevin Wolf wrote: Am 17.03.2021 um 15:34 hat Vladimir Sementsov-Ogievskiy geschrieben: Add the test that shows that concept of ignore_children is incomplete. Actually, when we want to update something, ignoring permission of some existing BdrvChild, we should ignore also the pr

[PATCH] qapi: deprecate drive-backup

2021-04-23 Thread Vladimir Sementsov-Ogievskiy
Modern way is using blockdev-add + blockdev-backup, which provides a lot more control on how target is opened. As example of drive-backup problems consider the following: User of drive-backup expects that target will be opened in the same cache and aio mode as source. Corresponding logic is in dr

Re: [PATCH v3 01/36] tests/test-bdrv-graph-mod: add test_parallel_exclusive_write

2021-04-23 Thread Kevin Wolf
Am 23.04.2021 um 14:46 hat Vladimir Sementsov-Ogievskiy geschrieben: > 23.04.2021 15:25, Kevin Wolf wrote: > > Am 17.03.2021 um 15:34 hat Vladimir Sementsov-Ogievskiy geschrieben: > > > Add the test that shows that concept of ignore_children is incomplete. > > > Actually, when we want to update som

Re: [PATCH v3 01/36] tests/test-bdrv-graph-mod: add test_parallel_exclusive_write

2021-04-23 Thread Vladimir Sementsov-Ogievskiy
23.04.2021 15:59, Kevin Wolf wrote: Am 23.04.2021 um 14:46 hat Vladimir Sementsov-Ogievskiy geschrieben: 23.04.2021 15:25, Kevin Wolf wrote: Am 17.03.2021 um 15:34 hat Vladimir Sementsov-Ogievskiy geschrieben: Add the test that shows that concept of ignore_children is incomplete. Actually, whe

Re: [PATCH] qapi: deprecate drive-backup

2021-04-23 Thread Daniel P . Berrangé
On Fri, Apr 23, 2021 at 03:59:00PM +0300, Vladimir Sementsov-Ogievskiy wrote: > Modern way is using blockdev-add + blockdev-backup, which provides a > lot more control on how target is opened. > > As example of drive-backup problems consider the following: > > User of drive-backup expects that ta

Re: [PATCH for-6.0 v2 2/2] hw/block/nvme: disable hotplugging for subsystem-linked controllers

2021-04-23 Thread Peter Maydell
On Fri, 23 Apr 2021 at 06:21, Klaus Jensen wrote: > > From: Klaus Jensen > > If a controller is linked to a subsystem, do not allow it to be > hotplugged since this will mess up the (possibly shared) namespaces. > > Signed-off-by: Klaus Jensen > --- > hw/block/nvme.c | 4 > 1 file changed,

Re: [PATCH] qapi: deprecate drive-backup

2021-04-23 Thread Vladimir Sementsov-Ogievskiy
23.04.2021 16:09, Daniel P. Berrangé wrote: On Fri, Apr 23, 2021 at 03:59:00PM +0300, Vladimir Sementsov-Ogievskiy wrote: Modern way is using blockdev-add + blockdev-backup, which provides a lot more control on how target is opened. As example of drive-backup problems consider the following: U

Re: [PATCH for-6.0 v2 2/2] hw/block/nvme: disable hotplugging for subsystem-linked controllers

2021-04-23 Thread Klaus Jensen
On Apr 23 14:21, Peter Maydell wrote: On Fri, 23 Apr 2021 at 06:21, Klaus Jensen wrote: From: Klaus Jensen If a controller is linked to a subsystem, do not allow it to be hotplugged since this will mess up the (possibly shared) namespaces. Signed-off-by: Klaus Jensen --- hw/block/nvme.c |

Re: [PATCH for-6.0 v2 2/2] hw/block/nvme: disable hotplugging for subsystem-linked controllers

2021-04-23 Thread Peter Maydell
On Fri, 23 Apr 2021 at 14:25, Klaus Jensen wrote: > > On Apr 23 14:21, Peter Maydell wrote: > >On Fri, 23 Apr 2021 at 06:21, Klaus Jensen wrote: > >> > >> From: Klaus Jensen > >> > >> If a controller is linked to a subsystem, do not allow it to be > >> hotplugged since this will mess up the (pos

Re: [PATCH for-6.0 v2 2/2] hw/block/nvme: disable hotplugging for subsystem-linked controllers

2021-04-23 Thread Klaus Jensen
On Apr 23 14:25, Peter Maydell wrote: On Fri, 23 Apr 2021 at 14:25, Klaus Jensen wrote: On Apr 23 14:21, Peter Maydell wrote: >On Fri, 23 Apr 2021 at 06:21, Klaus Jensen wrote: >> >> From: Klaus Jensen >> >> If a controller is linked to a subsystem, do not allow it to be >> hotplugged since

[PATCH v2] monitor: hmp_qemu_io: acquire aio contex, fix crash

2021-04-23 Thread Vladimir Sementsov-Ogievskiy
Max reported the following bug: $ ./qemu-img create -f raw src.img 1G $ ./qemu-img create -f raw dst.img 1G $ (echo ' {"execute":"qmp_capabilities"} {"execute":"blockdev-mirror", "arguments":{"job-id":"mirror", "device":"source", "target":"target",

Re: [PATCH v2 1/2] block: Add BDRV_O_NO_SHARE for blk_new_open()

2021-04-23 Thread Kevin Wolf
Am 23.04.2021 um 11:43 hat Vladimir Sementsov-Ogievskiy geschrieben: > 22.04.2021 19:43, Kevin Wolf wrote: > > Normally, blk_new_open() just shares all permissions. This was fine > > originally when permissions only protected against uses in the same > > process because no other part of the code wo

Re: [PATCH v3 04/36] block: bdrv_append(): don't consume reference

2021-04-23 Thread Kevin Wolf
Am 17.03.2021 um 15:34 hat Vladimir Sementsov-Ogievskiy geschrieben: > We have too much comments for this feature. It seems better just don't > do it. Most of real users (tests don't count) have to create additional > reference. > > Drop also comment in external_snapshot_prepare: > - bdrv_append

Re: [PATCH v3 08/36] util: add transactions.c

2021-04-23 Thread Kevin Wolf
Am 17.03.2021 um 15:35 hat Vladimir Sementsov-Ogievskiy geschrieben: > Add simple transaction API to use in further update of block graph > operations. > > Supposed usage is: > > - "prepare" is main function of the action and it should make the main > effect of the action to be visible for the

Re: [PATCH v2 2/2] qemu-img convert: Unshare write permission for source

2021-04-23 Thread Vladimir Sementsov-Ogievskiy
22.04.2021 19:43, Kevin Wolf wrote: For a successful conversion of an image, we must make sure that its content doesn't change during the conversion. A special case of this is using the same image file both as the source and as the destination. If both input and output format are raw, the operat

Re: [PATCH for-6.0 v2 1/2] hw/block/nvme: fix invalid msix exclusive uninit

2021-04-23 Thread Peter Maydell
On Fri, 23 Apr 2021 at 06:21, Klaus Jensen wrote: > > From: Klaus Jensen > > Commit 1901b4967c3f changed the nvme device from using a bar exclusive > for MSI-x to sharing it on bar0. > > Unfortunately, the msix_uninit_exclusive_bar() call remains in > nvme_exit() which causes havoc when the devic

Re: [PATCH v3 00/36] block: update graph permissions update

2021-04-23 Thread Kevin Wolf
Am 17.03.2021 um 15:34 hat Vladimir Sementsov-Ogievskiy geschrieben: > Hi all! > > Finally, I finished v3. Phew. > > Missed a soft-freeze. Should we consider it a bugfix? There are bugfixes > here but they are mostly theoretical. So, up to Kevin, should it go to > current release or to the next..

[PATCH 00/11] qemu-io-cmds: move to coroutine

2021-04-23 Thread Vladimir Sementsov-Ogievskiy
Hi! I've done this by accident. I decided that it is needed to make a nice fix for a problem with aio context locking in hmp_qemu_io(). Still, the problem is fixed without this series, so it's based on on the fix instead of being preparation for it: Based-on: <20210423134233.51495-1-vsement...@vi

[PATCH 01/11] block-coroutine-wrapper: allow non bdrv_ prefix

2021-04-23 Thread Vladimir Sementsov-Ogievskiy
We are going to reuse the script to generate a qcow2_ function in further commit. Prepare the script now. Signed-off-by: Vladimir Sementsov-Ogievskiy --- scripts/block-coroutine-wrapper.py | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/block-coroutine-wrapper.

[PATCH 03/11] block/block-gen.h: bind monitor

2021-04-23 Thread Vladimir Sementsov-Ogievskiy
If we have current monitor, let's bind it to wrapper coroutine too. Signed-off-by: Vladimir Sementsov-Ogievskiy --- block/block-gen.h | 10 ++ 1 file changed, 10 insertions(+) diff --git a/block/block-gen.h b/block/block-gen.h index c1fd3f40de..61f055a8cc 100644 --- a/block/block-gen.h

[PATCH 06/11] block: drop unused bdrv_debug_is_suspended()

2021-04-23 Thread Vladimir Sementsov-Ogievskiy
Now it's actually substituted by coroutine based bdrv_debug_wait_break(). Signed-off-by: Vladimir Sementsov-Ogievskiy --- include/block/block.h | 1 - include/block/block_int.h | 1 - block.c | 13 - block/blkdebug.c | 1 - 4 files changed, 16 deleti

[PATCH 10/11] qemu-io-cmds: drop do_co_readv() and do_co_writev() helpers

2021-04-23 Thread Vladimir Sementsov-Ogievskiy
They don't make much sense. Call blk_co_ functions directly and also drop some redundant variables. Signed-off-by: Vladimir Sementsov-Ogievskiy --- qemu-io-cmds.c | 38 ++ 1 file changed, 6 insertions(+), 32 deletions(-) diff --git a/qemu-io-cmds.c b/qemu-io-

[PATCH 08/11] qemu-io-cmds: refactor read_f(): drop extra helpers and variables

2021-04-23 Thread Vladimir Sementsov-Ogievskiy
Now all commands are in coroutines, so we want to move to _co_ functions. Let's just drop helpers and use blk_co_ functions directly. Note that count is checked at start of read_f anyway. Both blk_co_pread and blk_co_load_vmstate returns 0 on success, so we should not care to set ret to 0 explicitl

[PATCH 09/11] qemu-io-cmds: refactor write_f(): drop extra helpers and variables

2021-04-23 Thread Vladimir Sementsov-Ogievskiy
We are in coroutine context. Let's call blk_co_ functions directly and drop all these helpers. Note that count is checked earlier in write_f, so we don't need the check in helpers. Also, both blk_co_save_vmstate() and blk_co_pwrite() return 0 on success, so we should not care to set ret to 0 explic

[PATCH 05/11] qemu-io-cmds: move qemu-io commands to coroutine

2021-04-23 Thread Vladimir Sementsov-Ogievskiy
Move qemuio_command to coroutine with all qemu io commands to simplify the code and avoid extra explicit polling loops. Signed-off-by: Vladimir Sementsov-Ogievskiy --- include/qemu-io.h | 9 +++- qemu-io-cmds.c| 110 ++ block/meson.build | 3 +-

[PATCH 02/11] block-coroutine-wrapper: support BlockBackend first argument

2021-04-23 Thread Vladimir Sementsov-Ogievskiy
We'll need to wrap functions with first argument of BlockBackend * type. For this let's generalize core function and struct to work with pure AioContext. Signed-off-by: Vladimir Sementsov-Ogievskiy --- block/block-gen.h | 12 ++-- scripts/block-coroutine-wrapper.py | 23

[PATCH 04/11] block: introduce bdrv_debug_wait_break

2021-04-23 Thread Vladimir Sementsov-Ogievskiy
Add a handler to wait for the break to happen in coroutine context. It will be used in further commit. Signed-off-by: Vladimir Sementsov-Ogievskiy --- include/block/block.h | 1 + include/block/block_int.h | 1 + block.c | 11 +++ block/blkdebug.c | 16 ++

[PATCH 11/11] block-backend: drop unused blk_save_vmstate() and blk_load_vmstate()

2021-04-23 Thread Vladimir Sementsov-Ogievskiy
Signed-off-by: Vladimir Sementsov-Ogievskiy --- include/sysemu/block-backend.h | 3 --- block/block-backend.c | 30 -- 2 files changed, 33 deletions(-) diff --git a/include/sysemu/block-backend.h b/include/sysemu/block-backend.h index 8676bbde5a..14cc410244

[PATCH 07/11] block-backend: add _co_ versions of blk_save_vmstate / blk_load_vmstate

2021-04-23 Thread Vladimir Sementsov-Ogievskiy
To be used in further commit. Don't worry about some duplication with existing blk_save_vmstate() and blk_load_vmstate(): they will be removed soon. Note the difference: new functions returns 0 on success. Signed-off-by: Vladimir Sementsov-Ogievskiy --- include/sysemu/block-backend.h | 3 +++

Re: [PATCH 03/11] block/block-gen.h: bind monitor

2021-04-23 Thread Markus Armbruster
Vladimir Sementsov-Ogievskiy writes: > If we have current monitor, let's bind it to wrapper coroutine too. > > Signed-off-by: Vladimir Sementsov-Ogievskiy > --- > block/block-gen.h | 10 ++ > 1 file changed, 10 insertions(+) > > diff --git a/block/block-gen.h b/block/block-gen.h > index