Re: [PATCH v1 5/9] hw/virtio: introduce virtio_device_should_start

2022-11-22 Thread Christian Borntraeger
Am 21.11.22 um 23:37 schrieb Michael S. Tsirkin: [...] qemu-system-x86_64: ../hw/virtio/vhost-vsock-common.c:203: vhost_vsock_common_pre_save: Assertion `!vhost_dev_is_started(&vvc->vhost_dev)' failed. 2022-11-15 16:38:46.096+: shutting down, reason=crashed Alex were you able to replicate

Re: [RFC 4/7] migration: Split save_live_pending() into state_pending_*

2022-11-22 Thread Dr. David Alan Gilbert
* Juan Quintela (quint...@redhat.com) wrote: > We split the function into to: > > - state_pending_estimate: We estimate the remaining state size without > stopping the machine. > > - state pending_exact: We calculate the exact amount of remaining > state. > > The only "device" that implement

Re: [PATCH] vhost: mask VIRTIO_F_RING_RESET for vhost and vhost-user devices

2022-11-22 Thread Eugenio Perez Martin
On Tue, Nov 22, 2022 at 4:13 AM Jason Wang wrote: > > On Mon, Nov 21, 2022 at 6:11 PM Stefano Garzarella > wrote: > > > > Commit 69e1c14aa2 ("virtio: core: vq reset feature negotation support") > > enabled VIRTIO_F_RING_RESET by default for all virtio devices. > > > > This feature is not current

Re: [RFC 2/7] migration: No save_live_pending() method uses the QEMUFile parameter

2022-11-22 Thread Dr. David Alan Gilbert
* Juan Quintela (quint...@redhat.com) wrote: > So remove it everywhere. > > Signed-off-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert > --- > include/migration/register.h | 6 ++ > migration/savevm.h | 2 +- > hw/s390x/s390-stattrib.c | 2 +- > hw/vfio/migration

Re: [PATCH for-7.2 1/5] hw/nvme: fix aio cancel in format

2022-11-22 Thread Keith Busch
On Tue, Nov 22, 2022 at 09:13:44AM +0100, Klaus Jensen wrote: > There are several bugs in the async cancel code for the Format command. > > Firstly, cancelling a format operation neglects to set iocb->ret as well > as clearing the iocb->aiocb after cancelling the underlying aiocb which > causes th

Re: [PATCH] cleanup: Tweak and re-run return_directly.cocci

2022-11-22 Thread Peter Maydell
On Tue, 22 Nov 2022 at 15:04, Philippe Mathieu-Daudé wrote: > > On 21/11/22 17:42, Max Filippov wrote: > > On Mon, Nov 21, 2022 at 6:01 AM Markus Armbruster wrote: > >> .../xtensa/core-dsp3400/xtensa-modules.c.inc | 136 +- > >> target/xtensa/core-lx106/xtensa-modules.c.inc |

Re: [PATCH v2 2/2] block/vmdk: Simplify vmdk_co_create() to return directly

2022-11-22 Thread Philippe Mathieu-Daudé
On 22/11/22 14:49, Markus Armbruster wrote: Cc: Fam Zheng Cc: Kevin Wolf Cc: Hanna Reitz Cc: qemu-block@nongnu.org Signed-off-by: Markus Armbruster --- block/vmdk.c | 28 +++- 1 file changed, 11 insertions(+), 17 deletions(-) Reviewed-by: Philippe Mathieu-Daudé

Re: [PATCH] cleanup: Tweak and re-run return_directly.cocci

2022-11-22 Thread Philippe Mathieu-Daudé
On 21/11/22 17:42, Max Filippov wrote: On Mon, Nov 21, 2022 at 6:01 AM Markus Armbruster wrote: .../xtensa/core-dsp3400/xtensa-modules.c.inc | 136 +- target/xtensa/core-lx106/xtensa-modules.c.inc | 16 +-- These files are generated and were imported from xtensa configurat

Re: [PATCH] cleanup: Tweak and re-run return_directly.cocci

2022-11-22 Thread Philippe Mathieu-Daudé
On 22/11/22 09:58, Markus Armbruster wrote: Thomas Huth writes: On 21/11/2022 17.32, Markus Armbruster wrote: Philippe Mathieu-Daudé writes: On 21/11/22 15:36, Peter Maydell wrote: On Mon, 21 Nov 2022 at 14:03, Markus Armbruster wrote: Tweak the semantic patch to drop redundant parenth

Re: [RFC 1/7] migration: Remove res_compatible parameter

2022-11-22 Thread Dr. David Alan Gilbert
* Juan Quintela (quint...@redhat.com) wrote: > It was only used for RAM, and in that case, it means that this amount > of data was sent for memory. Just delete the field in all callers. > > Signed-off-by: Juan Quintela > --- > include/migration/register.h | 20 ++-- > migratio

Re: [PATCH v2 2/2] block/vmdk: Simplify vmdk_co_create() to return directly

2022-11-22 Thread Peter Maydell
On Tue, 22 Nov 2022 at 13:51, Markus Armbruster wrote: > > Cc: Fam Zheng > Cc: Kevin Wolf > Cc: Hanna Reitz > Cc: qemu-block@nongnu.org > Signed-off-by: Markus Armbruster > --- > block/vmdk.c | 28 +++- > 1 file changed, 11 insertions(+), 17 deletions(-) > Reviewed-by

[PATCH v2 2/2] block/vmdk: Simplify vmdk_co_create() to return directly

2022-11-22 Thread Markus Armbruster
Cc: Fam Zheng Cc: Kevin Wolf Cc: Hanna Reitz Cc: qemu-block@nongnu.org Signed-off-by: Markus Armbruster --- block/vmdk.c | 28 +++- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/block/vmdk.c b/block/vmdk.c index 26376352b9..bac3d8db50 100644 --- a/bloc

Re: [PATCH] cleanup: Tweak and re-run return_directly.cocci

2022-11-22 Thread Peter Maydell
On Tue, 22 Nov 2022 at 13:27, Markus Armbruster wrote: > > Peter Maydell writes: > > The obvious answer is "you might have got your manual tweaking > > wrong". A purely mechanised patch I can review by looking at > > the script and maybe eyeballing a few instances of the change; > > a change that

Re: [PATCH] cleanup: Tweak and re-run return_directly.cocci

2022-11-22 Thread Markus Armbruster
Peter Maydell writes: > On Tue, 22 Nov 2022 at 08:58, Markus Armbruster wrote: >> I don't think complete detailed review is necessary or even sensible. >> >> Review should start with the Coccinelle script: >> >> // replace 'R = X; return R;' with 'return X;' >> @@ >> identifier VAR;

Re: [PATCH v8 0/4] block: small refactorings

2022-11-22 Thread Kevin Wolf
Am 07.11.2022 um 17:35 hat Vladimir Sementsov-Ogievskiy geschrieben: > Hi all! > > Here is 4-more simple already reviewed patches from > "[PATCH v5 00/45] Transactional block-graph modifying API" [1] > > Called v8 because first part of [1] was recently merged as > "[PATCH v7 for-7.2 00/15] bloc

Re: [PATCH] cleanup: Tweak and re-run return_directly.cocci

2022-11-22 Thread Peter Maydell
On Tue, 22 Nov 2022 at 08:58, Markus Armbruster wrote: > I don't think complete detailed review is necessary or even sensible. > > Review should start with the Coccinelle script: > > // replace 'R = X; return R;' with 'return X;' > @@ > identifier VAR; > expression E; > type T;

[PULL 1/8] vhost: mask VIRTIO_F_RING_RESET for vhost and vhost-user devices

2022-11-22 Thread Michael S. Tsirkin
From: Stefano Garzarella Commit 69e1c14aa2 ("virtio: core: vq reset feature negotation support") enabled VIRTIO_F_RING_RESET by default for all virtio devices. This feature is not currently emulated by QEMU, so for vhost and vhost-user devices we need to make sure it is supported by the offloade

Re: [PATCH v4 11/11] block/dirty-bitmap: convert coroutine-only functions to generated_co_wrapper_simple

2022-11-22 Thread Kevin Wolf
Am 16.11.2022 um 13:22 hat Emanuele Giuseppe Esposito geschrieben: > bdrv_can_store_new_dirty_bitmap and bdrv_remove_persistent_dirty_bitmap > check if they are running in a coroutine, directly calling the > coroutine callback if it's the case. > Except that no coroutine calls such functions, there

Re: [PATCH v4 10/11] block: convert bdrv_create to generated_co_wrapper_simple

2022-11-22 Thread Kevin Wolf
Am 16.11.2022 um 13:22 hat Emanuele Giuseppe Esposito geschrieben: > This function is never called in coroutine context, therefore > instead of manually creating a new coroutine, delegate it to the > block-coroutine-wrapper script, defining it as g_c_w_simple. > > Signed-off-by: Emanuele Giuseppe

Re: [PATCH v4 09/11] block: bdrv_create_file is a coroutine_fn

2022-11-22 Thread Emanuele Giuseppe Esposito
Am 22/11/2022 um 09:58 schrieb Kevin Wolf: > Am 16.11.2022 um 13:22 hat Emanuele Giuseppe Esposito geschrieben: >> It is always called in coroutine_fn callbacks, therefore >> it can directly call bdrv_co_create(). >> >> Signed-off-by: Emanuele Giuseppe Esposito >> --- >> block.c

Re: [PATCH] cleanup: Tweak and re-run return_directly.cocci

2022-11-22 Thread Markus Armbruster
Thomas Huth writes: > On 21/11/2022 17.32, Markus Armbruster wrote: >> Philippe Mathieu-Daudé writes: >> >>> On 21/11/22 15:36, Peter Maydell wrote: On Mon, 21 Nov 2022 at 14:03, Markus Armbruster wrote: > > Tweak the semantic patch to drop redundant parenthesis around the > r

Re: [PATCH v4 09/11] block: bdrv_create_file is a coroutine_fn

2022-11-22 Thread Kevin Wolf
Am 16.11.2022 um 13:22 hat Emanuele Giuseppe Esposito geschrieben: > It is always called in coroutine_fn callbacks, therefore > it can directly call bdrv_co_create(). > > Signed-off-by: Emanuele Giuseppe Esposito > --- > block.c| 6 -- > include/block/block-global

Re: [PATCH v4 08/11] block: distinguish between bdrv_create running in coroutine and not

2022-11-22 Thread Kevin Wolf
Am 16.11.2022 um 13:22 hat Emanuele Giuseppe Esposito geschrieben: > Call two different functions depending on whether bdrv_create > is in coroutine or not, following the same pattern as > generated_co_wrapper functions. > > This allows to also call the coroutine function directly, > without using

Re: [PATCH maybe-7.2 1/3] hw/i2c: only schedule pending master when bus is idle

2022-11-22 Thread Klaus Jensen
On Nov 17 14:40, Cédric Le Goater wrote: > On 11/17/22 12:58, Klaus Jensen wrote: > > On Nov 17 09:01, Cédric Le Goater wrote: > > > On 11/17/22 08:37, Klaus Jensen wrote: > > > > On Nov 17 07:56, Cédric Le Goater wrote: > > > > > On 11/17/22 07:40, Klaus Jensen wrote: > > > > > > On Nov 16 16:58,

Re: [PATCH v4 05/11] block-coroutine-wrapper.py: default to main loop aiocontext if function does not have a BlockDriverState parameter

2022-11-22 Thread Kevin Wolf
Am 21.11.2022 um 16:52 hat Emanuele Giuseppe Esposito geschrieben: > Am 21/11/2022 um 16:30 schrieb Kevin Wolf: > > Am 16.11.2022 um 13:22 hat Emanuele Giuseppe Esposito geschrieben: > >> Basically BdrvPollCo->bs is only used by bdrv_poll_co(), and the > >> functions that it uses are both using bdr

Re: [PATCH for-7.2] block-backend: avoid bdrv_unregister_buf() NULL pointer deref

2022-11-22 Thread Kevin Wolf
Am 21.11.2022 um 22:19 hat Stefan Hajnoczi geschrieben: > bdrv_*() APIs expect a valid BlockDriverState. Calling them with bs=NULL > leads to undefined behavior. > > Jonathan Cameron reported this following NULL pointer dereference when a > VM with a virtio-blk device and a memory-backend-file obj

[PATCH for-7.2 3/5] hw/nvme: fix aio cancel in zone reset

2022-11-22 Thread Klaus Jensen
From: Klaus Jensen If the zone reset operation is cancelled but the block unmap operation completes normally, the callback will continue resetting the next zone since it neglects to check iocb->ret which will have been set to -ECANCELED. Make sure that this is checked and bail out if an error is

[PATCH for-7.2 4/5] hw/nvme: fix aio cancel in dsm

2022-11-22 Thread Klaus Jensen
From: Klaus Jensen When the DSM operation is cancelled asynchronously, we set iocb->ret to -ECANCELED. However, the callback function only checks the return value of the completed aio, which may have completed succesfully prior to the cancellation and thus the callback ends up continuing the dsm

[PATCH for-7.2 2/5] hw/nvme: fix aio cancel in flush

2022-11-22 Thread Klaus Jensen
From: Klaus Jensen Make sure that iocb->aiocb is NULL'ed when cancelling. Fix a potential use-after-free by removing the bottom half and enqueuing the completion directly. Fixes: 38f4ac65ac88 ("hw/nvme: reimplement flush to allow cancellation") Signed-off-by: Klaus Jensen --- hw/nvme/ctrl.c |

[PATCH for-7.2 5/5] hw/nvme: remove copy bh scheduling

2022-11-22 Thread Klaus Jensen
From: Klaus Jensen Fix a potential use-after-free by removing the bottom half and enqueuing the completion directly. Fixes: 796d20681d9b ("hw/nvme: reimplement the copy command to allow aio cancellation") Signed-off-by: Klaus Jensen --- hw/nvme/ctrl.c | 63 +++-

[PATCH for-7.2 1/5] hw/nvme: fix aio cancel in format

2022-11-22 Thread Klaus Jensen
From: Klaus Jensen There are several bugs in the async cancel code for the Format command. Firstly, cancelling a format operation neglects to set iocb->ret as well as clearing the iocb->aiocb after cancelling the underlying aiocb which causes the aio callback to ignore the cancellation. Trivial

[PATCH for-7.2 0/5] hw/nvme: aio cancel fixes

2022-11-22 Thread Klaus Jensen
From: Klaus Jensen A new blktests nvme test unearthed some bad bugs in the asynchronous cancellation handling. Fix this for all commands that implement async_cancel(). The fix is the same for all commands: remove the deferred enqueuing (a bottom half scheduling) of the request completion. Klaus