[PATCH v4 03/20] virtio-scsi: avoid race between unplug and transport event

2023-04-25 Thread Stefan Hajnoczi
by: Daniil Tatianin Signed-off-by: Stefan Hajnoczi --- hw/scsi/scsi-bus.c| 3 ++- hw/scsi/virtio-scsi.c | 18 +- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c index 07275fb631..64d7311757 100644 --- a/hw/scsi/scsi-b

[PATCH v4 16/20] virtio: make it possible to detach host notifier from any thread

2023-04-25 Thread Stefan Hajnoczi
: Stefan Hajnoczi --- hw/block/dataplane/virtio-blk.c | 2 ++ hw/scsi/virtio-scsi-dataplane.c | 9 + 2 files changed, 11 insertions(+) diff --git a/hw/block/dataplane/virtio-blk.c b/hw/block/dataplane/virtio-blk.c index b28d81737e..bd7cc6e76b 100644 --- a/hw/block/dataplane/virtio-blk.c +++ b

[PATCH v4 06/20] block/export: wait for vhost-user-blk requests when draining

2023-04-25 Thread Stefan Hajnoczi
when there are requests in flight. The in-flight counter needs to be atomic. Signed-off-by: Stefan Hajnoczi --- include/qemu/vhost-user-server.h | 4 +++- block/export/vhost-user-blk-server.c | 16 util/vhost-user-server.c | 14 ++ 3 files c

[PATCH v4 02/20] hw/qdev: introduce qdev_is_realized() helper

2023-04-25 Thread Stefan Hajnoczi
-off-by: Stefan Hajnoczi --- include/hw/qdev-core.h | 17 ++--- hw/scsi/scsi-bus.c | 3 +-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index bd50ad5ee1..4d734cf35e 100644 --- a/include/hw/qdev-core.h +++ b/include

[PATCH v4 05/20] util/vhost-user-server: rename refcount to in_flight counter

2023-04-25 Thread Stefan Hajnoczi
e are no more requests. Avoid confusing by renaming refcount and ref/unref to in_flight and inc/dec. Reviewed-by: Paolo Bonzini Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Stefan Hajnoczi --- include/qemu/vhost-user-server.h | 6 +++--- block/export/vhost-user-blk-server.c

[PATCH v4 12/20] hw/xen: do not set is_external=true on evtchn fds

2023-04-25 Thread Stefan Hajnoczi
o use BlockDevOps .drained_begin/end() callbacks. It no longer relies on is_external=true so it is safe to pass is_external=false. This is part of ongoing work to remove the aio_disable_external() API. Signed-off-by: Stefan Hajnoczi --- hw/xen/xen-bus.c | 8 1 file changed, 4 insertions(

[PATCH v4 08/20] hw/xen: do not use aio_set_fd_handler(is_external=true) in xen_xenstore

2023-04-25 Thread Stefan Hajnoczi
ff-by: Stefan Hajnoczi --- hw/i386/kvm/xen_xenstore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/i386/kvm/xen_xenstore.c b/hw/i386/kvm/xen_xenstore.c index 900679af8a..6e81bc8791 100644 --- a/hw/i386/kvm/xen_xenstore.c +++ b/hw/i386/kvm/xen_xenstore.c @@ -133,7 +

[PATCH v4 01/20] block-backend: split blk_do_set_aio_context()

2023-04-25 Thread Stefan Hajnoczi
oot_set_aio_ctx_commit() being invoked as part of the AioContext change propagation. This can be solved by temporarily setting blk->allow_aio_context_change to true. Future patches call blk_get_aio_context() from BlockDevOps->drained_end(), so this patch will become necessary. Signed-off-by: Stefa

[PATCH v4 10/20] block: drain from main loop thread in bdrv_co_yield_to_drain()

2023-04-25 Thread Stefan Hajnoczi
. Signed-off-by: Stefan Hajnoczi --- include/sysemu/block-backend-common.h | 25 + block/io.c| 3 ++- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/include/sysemu/block-backend-common.h b/include/sysemu/block-backend-common.h index

[PATCH v4 11/20] xen-block: implement BlockDevOps->drained_begin()

2023-04-25 Thread Stefan Hajnoczi
depend on the dataplane instance, so move the blk_set_dev_ops() call after xen_block_dataplane_create(). Signed-off-by: Stefan Hajnoczi --- hw/block/dataplane/xen-block.h | 2 ++ hw/block/dataplane/xen-block.c | 42 +- hw/block/xen-block.c

[PATCH v4 09/20] block: add blk_in_drain() API

2023-04-25 Thread Stefan Hajnoczi
The BlockBackend quiesce_counter is greater than zero during drained sections. Add an API to check whether the BlockBackend is in a drained section. The next patch will use this API. Signed-off-by: Stefan Hajnoczi --- include/sysemu/block-backend-global-state.h | 1 + block/block-backend.c

[PATCH v4 20/20] aio: remove aio_disable_external() API

2023-04-25 Thread Stefan Hajnoczi
, is_external, io_read, io_poll, io_poll_ready; @@ - aio_set_event_notifier(ctx, notifier, is_external, io_read, io_poll, io_poll_ready) + aio_set_event_notifier(ctx, notifier, io_read, io_poll, io_poll_ready) Reviewed-by: Juan Quintela Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Stefan

[PATCH v4 19/20] virtio: do not set is_external=true on host notifiers

2023-04-25 Thread Stefan Hajnoczi
Host notifiers can now use is_external=false since virtio-blk and virtio-scsi no longer rely on is_external=true for drained sections. Signed-off-by: Stefan Hajnoczi --- hw/virtio/virtio.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/virtio/virtio.c b/hw/virtio

[PATCH v4 13/20] block/export: rewrite vduse-blk drain code

2023-04-25 Thread Stefan Hajnoczi
resume them in .drained_end(). This eliminates the need for the aio_set_fd_handler(is_external=true) flag, which is being removed from QEMU. This is a long list but splitting it into individual commits would probably lead to git bisect failures - the changes are all related. Signed-off-by:

[PATCH v4 18/20] virtio-scsi: implement BlockDevOps->drained_begin()

2023-04-25 Thread Stefan Hajnoczi
sees one pair of .drained_begin/end() calls. After this commit, virtio-scsi no longer depends on hw/virtio's ioeventfd aio_set_event_notifier(is_external=true). This commit is a step towards removing the aio_disable_external() API. Signed-off-by: Stefan Hajnoczi --- include/hw/scsi/s

[PATCH v4 15/20] block/fuse: do not set is_external=true on FUSE fd

2023-04-25 Thread Stefan Hajnoczi
This is part of ongoing work to remove the aio_disable_external() API. Use BlockDevOps .drained_begin/end/poll() instead of aio_set_fd_handler(is_external=true). As a side-effect the FUSE export now follows AioContext changes like the other export types. Signed-off-by: Stefan Hajnoczi

[PATCH v4 00/20] block: remove aio_disable_external() API

2023-04-25 Thread Stefan Hajnoczi
ily stop file descriptor handlers. This ensures that new I/O requests are not submitted in drained sections. The first two virtio-scsi patches were already sent as a separate series. I included them because they are necessary in order to fully remove aio_disable_external(). Stefan Hajnoczi (20):

[PATCH v4 07/20] block/export: stop using is_external in vhost-user-blk server

2023-04-25 Thread Stefan Hajnoczi
d the aio_disable_external() API cannot be used since multiple AioContext may be processing I/O, not just one. Switch to BlockDevOps->drained_begin/end() callbacks. Signed-off-by: Stefan Hajnoczi --- block/export/vhost-user-blk-server.c | 43 ++-- util/vhost-user-server.c

[PATCH v4 04/20] virtio-scsi: stop using aio_disable_external() during unplug

2023-04-25 Thread Stefan Hajnoczi
simple_device_unplug_cb() returns. Thanks to these two conditions we don't need aio_disable_external() anymore. Cc: Zhengui Li Reviewed-by: Paolo Bonzini Reviewed-by: Daniil Tatianin Signed-off-by: Stefan Hajnoczi --- hw/scsi/scsi-disk.c | 1 + hw/scsi/virtio-scsi.c | 3 --- 2 file

Re: [PATCH v3 13/20] block/export: rewrite vduse-blk drain code

2023-04-25 Thread Stefan Hajnoczi
On Fri, Apr 21, 2023 at 11:36:02AM +0800, Yongji Xie wrote: > Hi Stefan, > > On Thu, Apr 20, 2023 at 7:39 PM Stefan Hajnoczi wrote: > > > > vduse_blk_detach_ctx() waits for in-flight requests using > > AIO_WAIT_WHILE(). This is not allowe

Re: [PATCH v3 00/20] block: remove aio_disable_external() API

2023-04-25 Thread Stefan Hajnoczi
On Thu, Apr 20, 2023 at 03:39:59PM +0200, Philippe Mathieu-Daudé wrote: > Hi Stefan, > > On 20/4/23 13:37, Stefan Hajnoczi wrote: > > v3: > > - Resend full patch series. v2 was sent in the middle of a git rebase and > > was > >missing patches. [E

Re: [PATCH v3 20/20] aio: remove aio_disable_external() API

2023-04-25 Thread Stefan Hajnoczi
On Thu, Apr 20, 2023 at 03:44:06PM +0200, Philippe Mathieu-Daudé wrote: > On 20/4/23 13:37, Stefan Hajnoczi wrote: > > All callers now pass is_external=false to aio_set_fd_handler() and > > aio_set_event_notifier(). The aio_disable_external() API that > > temporarily disables

Re: [RFC PATCH 13/13] HACK: schedule fence return on main AIO context

2023-04-25 Thread Stefan Hajnoczi
On Fri, 21 Apr 2023 at 19:21, Gurchetan Singh wrote: > > On Fri, Apr 21, 2023 at 9:00 AM Stefan Hajnoczi wrote: > > > > On Thu, 20 Apr 2023 at 21:13, Gurchetan Singh > > wrote: > > > > > > gfxstream and both cross-domain (and ev

[PULL 1/2] block/dmg: Declare a type definition for DMG uncompress function

2023-04-24 Thread Stefan Hajnoczi
Signed-off-by: Stefan Hajnoczi --- block/dmg.h | 8 block/dmg.c | 7 ++- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/block/dmg.h b/block/dmg.h index e488601b62..dcd6165e63 100644 --- a/block/dmg.h +++ b/block/dmg.h @@ -51,10 +51,10 @@ typedef struct BDRVDMGState

[PULL 2/2] tracetool: use relative paths for '#line' preprocessor directives

2023-04-24 Thread Stefan Hajnoczi
From: Thomas De Schampheleire The event filename is an absolute path. Convert it to a relative path when writing '#line' directives, to preserve reproducibility of the generated output when different base paths are used. Signed-off-by: Thomas De Schampheleire Signed-off-by: Stefa

[PULL 0/2] Block patches

2023-04-24 Thread Stefan Hajnoczi
The following changes since commit ac5f7bf8e208cd7893dbb1a9520559e569a4677c: Merge tag 'migration-20230424-pull-request' of https://gitlab.com/juan.quintela/qemu into staging (2023-04-24 15:00:39 +0100) are available in the Git repository at: https://gitlab.com/stefanha/qemu.git tags/block-

Re: [PULL 00/20] Block patches

2023-04-24 Thread Stefan Hajnoczi
On Fri, Apr 21, 2023 at 08:01:56PM +0100, Richard Henderson wrote: > On 4/20/23 13:09, Stefan Hajnoczi wrote: > > The following changes since commit c1eb2ddf0f8075faddc5f7c3d39feae3e8e9d6b4: > > > >Update version for v8.0.0 release (2023-04-19 17:27:13 +0100) > > &

Re: [PULL 00/20] Block patches

2023-04-24 Thread Stefan Hajnoczi
On Fri, Apr 21, 2023 at 08:01:56PM +0100, Richard Henderson wrote: > On 4/20/23 13:09, Stefan Hajnoczi wrote: > > The following changes since commit c1eb2ddf0f8075faddc5f7c3d39feae3e8e9d6b4: > > > >Update version for v8.0.0 release (2023-04-19 17:27:13 +0100) > > &

Re: [PATCH] async: Suppress GCC13 false positive in aio_bh_poll()

2023-04-22 Thread Stefan Hajnoczi
ocal variable 'slice' is removed from the global context list > in following loop of the same routine. Add a pragma to silent GCC. > > Cc: Stefan Hajnoczi > Cc: Paolo Bonzini > Cc: Daniel P. Berrangé > Signed-off-by: Cédric Le Goater > --- > util/async.c | 14

Re: [RFC PATCH 00/13] gfxstream + rutabaga_gfx: a surprising delight or startling epiphany?

2023-04-21 Thread Stefan Hajnoczi
On Thu, 20 Apr 2023 at 21:13, Gurchetan Singh wrote: > > From: Gurchetan Singh > > Rationale: > > - gfxstream [a] is good for the Android Emulator/upstream QEMU > alignment > - Wayland passhthrough [b] via the cross-domain context type is good > for Linux on Linux display virtualization > - r

Re: [RFC PATCH 13/13] HACK: schedule fence return on main AIO context

2023-04-21 Thread Stefan Hajnoczi
On Thu, 20 Apr 2023 at 21:13, Gurchetan Singh wrote: > > gfxstream and both cross-domain (and even newer versions > virglrenderer: see VIRGL_RENDERER_ASYNC_FENCE_CB) like to signal > fence completion on threads ("callback threads") that are > different from the thread that processes the command qu

[PATCH] vhost-user: send SET_STATUS 0 after GET_VRING_BASE

2023-04-20 Thread Stefan Hajnoczi
ode searches to identify vhost-user backends implementing SET_STATUS. It seems only DPDK implements SET_STATUS and Yajun Wu has confirmed that it is safe to make this change. Cc: Michael S. Tsirkin Cc: Cindy Lu Signed-off-by: Stefan Hajnoczi --- hw/virtio/vhost-user.c | 13 - 1 f

[PULL 08/20] docs/zoned-storage: add zoned device documentation

2023-04-20 Thread Stefan Hajnoczi
From: Sam Li Add the documentation about the zoned device support to virtio-blk emulation. Signed-off-by: Sam Li Reviewed-by: Stefan Hajnoczi Reviewed-by: Damien Le Moal Reviewed-by: Dmitry Fomichev Acked-by: Kevin Wolf Message-id: 20230324090605.28361-9-faithilike...@gmail.com [Add index

[PULL 09/20] block/dmg: Declare a type definition for DMG uncompress function

2023-04-20 Thread Stefan Hajnoczi
Signed-off-by: Stefan Hajnoczi --- block/dmg.h | 8 block/dmg.c | 7 ++- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/block/dmg.h b/block/dmg.h index e488601b62..dcd6165e63 100644 --- a/block/dmg.h +++ b/block/dmg.h @@ -51,10 +51,10 @@ typedef struct BDRVDMGState

[PULL 11/20] file-posix: add tracking of the zone write pointers

2023-04-20 Thread Stefan Hajnoczi
zone - write to a zone - zone append Signed-off-by: Sam Li Message-id: 20230407081657.17947-2-faithilike...@gmail.com Signed-off-by: Stefan Hajnoczi --- include/block/block-common.h | 14 +++ include/block/block_int-common.h | 5 + block/file-posix.c

[PULL 14/20] block: add some trace events for zone append

2023-04-20 Thread Stefan Hajnoczi
From: Sam Li Signed-off-by: Sam Li Reviewed-by: Dmitry Fomichev Reviewed-by: Stefan Hajnoczi Message-id: 20230407081657.17947-5-faithilike...@gmail.com Signed-off-by: Stefan Hajnoczi --- block/file-posix.c | 3 +++ block/trace-events | 2 ++ 2 files changed, 5 insertions(+) diff --git a

[PULL 20/20] tracing: install trace events file only if necessary

2023-04-20 Thread Stefan Hajnoczi
From: Carlos Santos It is not useful when configuring with --enable-trace-backends=nop. Signed-off-by: Carlos Santos Signed-off-by: Stefan Hajnoczi Message-Id: <20230408010410.281263-1-casan...@redhat.com> --- trace/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)

[PULL 05/20] block: add zoned BlockDriver check to block layer

2023-04-20 Thread Stefan Hajnoczi
From: Sam Li Putting zoned/non-zoned BlockDrivers on top of each other is not allowed. Signed-off-by: Sam Li Reviewed-by: Stefan Hajnoczi Reviewed-by: Hannes Reinecke Reviewed-by: Dmitry Fomichev Acked-by: Kevin Wolf Message-id: 20230324090605.28361-6-faithilike...@gmail.com [Adjust commit

[PULL 17/20] block: add accounting for zone append operation

2023-04-20 Thread Stefan Hajnoczi
From: Sam Li Taking account of the new zone append write operation for zoned devices, BLOCK_ACCT_ZONE_APPEND enum is introduced as other I/O request type (read, write, flush). Signed-off-by: Sam Li Message-id: 20230407082528.18841-4-faithilike...@gmail.com Signed-off-by: Stefan Hajnoczi

[PULL 19/20] docs/zoned-storage:add zoned emulation use case

2023-04-20 Thread Stefan Hajnoczi
. --Stefan] Signed-off-by: Stefan Hajnoczi --- docs/devel/zoned-storage.rst | 25 ++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/docs/devel/zoned-storage.rst b/docs/devel/zoned-storage.rst index 6a36133e51..e02500c8a3 100644 --- a/docs/devel/zoned

[PULL 16/20] virtio-blk: add zoned storage emulation for zoned devices

2023-04-20 Thread Stefan Hajnoczi
Message-id: 20230407082528.18841-3-faithilike...@gmail.com Signed-off-by: Stefan Hajnoczi --- hw/block/virtio-blk-common.c | 2 + hw/block/virtio-blk.c| 389 +++ hw/virtio/virtio-qmp.c | 2 + 3 files changed, 393 insertions(+) diff --git a/hw

[PULL 13/20] qemu-iotests: test zone append operation

2023-04-20 Thread Stefan Hajnoczi
From: Sam Li The patch tests zone append writes by reporting the zone wp after the completion of the call. "zap -p" option can print the sector offset value after completion, which should be the start sector where the append write begins. Signed-off-by: Sam Li Reviewed-by: Stefa

[PULL 10/20] tracetool: use relative paths for '#line' preprocessor directives

2023-04-20 Thread Stefan Hajnoczi
From: Thomas De Schampheleire The event filename is an absolute path. Convert it to a relative path when writing '#line' directives, to preserve reproducibility of the generated output when different base paths are used. Signed-off-by: Thomas De Schampheleire Signed-off-by: Stefa

[PULL 01/20] block/block-common: add zoned device structs

2023-04-20 Thread Stefan Hajnoczi
From: Sam Li Signed-off-by: Sam Li Reviewed-by: Stefan Hajnoczi Reviewed-by: Damien Le Moal Reviewed-by: Hannes Reinecke Reviewed-by: Dmitry Fomichev Acked-by: Kevin Wolf Message-id: 20230324090605.28361-2-faithilike...@gmail.com [Adjust commit message prefix as suggested by Philippe

[PULL 04/20] block/raw-format: add zone operations to pass through requests

2023-04-20 Thread Stefan Hajnoczi
From: Sam Li raw-format driver usually sits on top of file-posix driver. It needs to pass through requests of zone commands. Signed-off-by: Sam Li Reviewed-by: Stefan Hajnoczi Reviewed-by: Damien Le Moal Reviewed-by: Hannes Reinecke Reviewed-by: Dmitry Fomichev Acked-by: Kevin Wolf

[PULL 00/20] Block patches

2023-04-20 Thread Stefan Hajnoczi
The following changes since commit c1eb2ddf0f8075faddc5f7c3d39feae3e8e9d6b4: Update version for v8.0.0 release (2023-04-19 17:27:13 +0100) are available in the Git repository at: https://gitlab.com/stefanha/qemu.git tags/block-pull-request for you to fetch changes up to 36e5e9b22abe56aa00ca

[PULL 02/20] block/file-posix: introduce helper functions for sysfs attributes

2023-04-20 Thread Stefan Hajnoczi
Reviewed-by: Stefan Hajnoczi Reviewed-by: Damien Le Moal Reviewed-by: Dmitry Fomichev Acked-by: Kevin Wolf Message-id: 20230324090605.28361-3-faithilike...@gmail.com [Adjust commit message prefix as suggested by Philippe Mathieu-Daudé . --Stefan] Signed-off-by: Stefan Hajnoczi --- include/block

[PULL 18/20] virtio-blk: add some trace events for zoned emulation

2023-04-20 Thread Stefan Hajnoczi
From: Sam Li Signed-off-by: Sam Li Reviewed-by: Stefan Hajnoczi Message-id: 20230407082528.18841-5-faithilike...@gmail.com Signed-off-by: Stefan Hajnoczi --- hw/block/virtio-blk.c | 12 hw/block/trace-events | 7 +++ 2 files changed, 19 insertions(+) diff --git a/hw/block

[PULL 15/20] include: update virtio_blk headers to v6.3-rc1

2023-04-20 Thread Stefan Hajnoczi
From: Sam Li Use scripts/update-linux-headers.sh to update headers to 6.3-rc1. Signed-off-by: Sam Li Reviewed-by: Stefan Hajnoczi Reviewed-by: Dmitry Fomichev Message-id: 20230407082528.18841-2-faithilike...@gmail.com Signed-off-by: Stefan Hajnoczi --- include/standard-headers/drm

[PULL 12/20] block: introduce zone append write for zoned devices

2023-04-20 Thread Stefan Hajnoczi
completion the device will respond with the position where the data has been written in the zone. Signed-off-by: Sam Li Reviewed-by: Dmitry Fomichev Reviewed-by: Stefan Hajnoczi Message-id: 20230407081657.17947-3-faithilike...@gmail.com Signed-off-by: Stefan Hajnoczi --- include/block/block

[PULL 06/20] iotests: test new zone operations

2023-04-20 Thread Stefan Hajnoczi
From: Sam Li The new block layer APIs of zoned block devices can be tested by: $ tests/qemu-iotests/check zoned Run each zone operation on a newly created null_blk device and see whether it outputs the same zone information. Signed-off-by: Sam Li Reviewed-by: Stefan Hajnoczi Acked-by: Kevin

[PULL 07/20] block: add some trace events for new block layer APIs

2023-04-20 Thread Stefan Hajnoczi
From: Sam Li Signed-off-by: Sam Li Reviewed-by: Stefan Hajnoczi Reviewed-by: Dmitry Fomichev Acked-by: Kevin Wolf Message-id: 20230324090605.28361-8-faithilike...@gmail.com Signed-off-by: Stefan Hajnoczi --- block/file-posix.c | 3 +++ block/trace-events | 2 ++ 2 files changed, 5

[PULL 03/20] block/block-backend: add block layer APIs resembling Linux ZonedBlockDevice ioctls

2023-04-20 Thread Stefan Hajnoczi
=host_device, filename=/dev/nullb0 -c "zrp offset nr_zones" Signed-off-by: Sam Li Reviewed-by: Hannes Reinecke Reviewed-by: Stefan Hajnoczi Reviewed-by: Dmitry Fomichev Acked-by: Kevin Wolf Message-id: 20230324090605.28361-4-faithilike...@gmail.com [Adjust commit message prefix as su

[PATCH v3 07/20] block/export: stop using is_external in vhost-user-blk server

2023-04-20 Thread Stefan Hajnoczi
d the aio_disable_external() API cannot be used since multiple AioContext may be processing I/O, not just one. Switch to BlockDevOps->drained_begin/end() callbacks. Signed-off-by: Stefan Hajnoczi --- block/export/vhost-user-blk-server.c | 43 ++-- util/vhost-user-server.c

[PATCH v3 19/20] virtio: do not set is_external=true on host notifiers

2023-04-20 Thread Stefan Hajnoczi
Host notifiers can now use is_external=false since virtio-blk and virtio-scsi no longer rely on is_external=true for drained sections. Signed-off-by: Stefan Hajnoczi --- hw/virtio/virtio.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/virtio/virtio.c b/hw/virtio

[PATCH v3 05/20] util/vhost-user-server: rename refcount to in_flight counter

2023-04-20 Thread Stefan Hajnoczi
e are no more requests. Avoid confusing by renaming refcount and ref/unref to in_flight and inc/dec. Reviewed-by: Paolo Bonzini Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Stefan Hajnoczi --- include/qemu/vhost-user-server.h | 6 +++--- block/export/vhost-user-blk-server.c

[PATCH v3 12/20] hw/xen: do not set is_external=true on evtchn fds

2023-04-20 Thread Stefan Hajnoczi
o use BlockDevOps .drained_begin/end() callbacks. It no longer relies on is_external=true so it is safe to pass is_external=false. This is part of ongoing work to remove the aio_disable_external() API. Signed-off-by: Stefan Hajnoczi --- hw/xen/xen-bus.c | 8 1 file changed, 4 insertions(

[PATCH v3 17/20] virtio-blk: implement BlockDevOps->drained_begin()

2023-04-20 Thread Stefan Hajnoczi
attaching/detaching ioeventfds if the data plane is started/stopped during a drained section. This should be rare, but maybe the mirror block job can trigger it. Signed-off-by: Stefan Hajnoczi --- hw/block/dataplane/virtio-blk.c | 17 +-- hw/block/virtio-blk.c | 38

[PATCH v3 10/20] block: drain from main loop thread in bdrv_co_yield_to_drain()

2023-04-20 Thread Stefan Hajnoczi
. Signed-off-by: Stefan Hajnoczi --- include/sysemu/block-backend-common.h | 25 + block/io.c| 3 ++- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/include/sysemu/block-backend-common.h b/include/sysemu/block-backend-common.h index

[PATCH v3 06/20] block/export: wait for vhost-user-blk requests when draining

2023-04-20 Thread Stefan Hajnoczi
when there are requests in flight. The in-flight counter needs to be atomic. Signed-off-by: Stefan Hajnoczi --- include/qemu/vhost-user-server.h | 4 +++- block/export/vhost-user-blk-server.c | 19 +++ util/vhost-user-server.c | 14 ++ 3 files c

[PATCH v3 16/20] virtio: make it possible to detach host notifier from any thread

2023-04-20 Thread Stefan Hajnoczi
: Stefan Hajnoczi --- hw/block/dataplane/virtio-blk.c | 2 ++ hw/scsi/virtio-scsi-dataplane.c | 9 + 2 files changed, 11 insertions(+) diff --git a/hw/block/dataplane/virtio-blk.c b/hw/block/dataplane/virtio-blk.c index b28d81737e..bd7cc6e76b 100644 --- a/hw/block/dataplane/virtio-blk.c +++ b

[PATCH v3 14/20] block/export: don't require AioContext lock around blk_exp_ref/unref()

2023-04-20 Thread Stefan Hajnoczi
The FUSE export calls blk_exp_ref/unref() without the AioContext lock. Instead of fixing the FUSE export, adjust blk_exp_ref/unref() so they work without the AioContext lock. This way it's less error-prone. Suggested-by: Paolo Bonzini Signed-off-by: Stefan Hajnoczi --- include/block/exp

[PATCH v3 13/20] block/export: rewrite vduse-blk drain code

2023-04-20 Thread Stefan Hajnoczi
resume them in .drained_end(). This eliminates the need for the aio_set_fd_handler(is_external=true) flag, which is being removed from QEMU. This is a long list but splitting it into individual commits would probably lead to git bisect failures - the changes are all related. Signed-off-by:

[PATCH v3 11/20] xen-block: implement BlockDevOps->drained_begin()

2023-04-20 Thread Stefan Hajnoczi
depend on the dataplane instance, so move the blk_set_dev_ops() call after xen_block_dataplane_create(). Signed-off-by: Stefan Hajnoczi --- hw/block/dataplane/xen-block.h | 2 ++ hw/block/dataplane/xen-block.c | 42 +- hw/block/xen-block.c

[PATCH v3 18/20] virtio-scsi: implement BlockDevOps->drained_begin()

2023-04-20 Thread Stefan Hajnoczi
sees one pair of .drained_begin/end() calls. After this commit, virtio-scsi no longer depends on hw/virtio's ioeventfd aio_set_event_notifier(is_external=true). This commit is a step towards removing the aio_disable_external() API. Signed-off-by: Stefan Hajnoczi --- include/hw/scsi/s

[PATCH v3 04/20] block/export: only acquire AioContext once for vhost_user_server_stop()

2023-04-20 Thread Stefan Hajnoczi
vhost_user_server_stop() uses AIO_WAIT_WHILE(). AIO_WAIT_WHILE() requires that AioContext is only acquired once. Since blk_exp_request_shutdown() already acquires the AioContext it shouldn't be acquired again in vhost_user_server_stop(). Signed-off-by: Stefan Hajnoczi --- util/vhost

[PATCH v3 15/20] block/fuse: do not set is_external=true on FUSE fd

2023-04-20 Thread Stefan Hajnoczi
This is part of ongoing work to remove the aio_disable_external() API. Use BlockDevOps .drained_begin/end/poll() instead of aio_set_fd_handler(is_external=true). As a side-effect the FUSE export now follows AioContext changes like the other export types. Signed-off-by: Stefan Hajnoczi

[PATCH v3 03/20] virtio-scsi: stop using aio_disable_external() during unplug

2023-04-20 Thread Stefan Hajnoczi
simple_device_unplug_cb() returns. Thanks to these two conditions we don't need aio_disable_external() anymore. Cc: Zhengui Li Reviewed-by: Paolo Bonzini Reviewed-by: Daniil Tatianin Signed-off-by: Stefan Hajnoczi --- hw/scsi/scsi-disk.c | 1 + hw/scsi/virtio-scsi.c | 3 --- 2 file

[PATCH v3 08/20] hw/xen: do not use aio_set_fd_handler(is_external=true) in xen_xenstore

2023-04-20 Thread Stefan Hajnoczi
ff-by: Stefan Hajnoczi --- hw/i386/kvm/xen_xenstore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/i386/kvm/xen_xenstore.c b/hw/i386/kvm/xen_xenstore.c index 900679af8a..6e81bc8791 100644 --- a/hw/i386/kvm/xen_xenstore.c +++ b/hw/i386/kvm/xen_xenstore.c @@ -133,7 +

[PATCH v3 20/20] aio: remove aio_disable_external() API

2023-04-20 Thread Stefan Hajnoczi
, is_external, io_read, io_poll, io_poll_ready; @@ - aio_set_event_notifier(ctx, notifier, is_external, io_read, io_poll, io_poll_ready) + aio_set_event_notifier(ctx, notifier, io_read, io_poll, io_poll_ready) Reviewed-by: Juan Quintela Signed-off-by: Stefan Hajnoczi --- include/block/aio.h

[PATCH v3 01/20] hw/qdev: introduce qdev_is_realized() helper

2023-04-20 Thread Stefan Hajnoczi
-off-by: Stefan Hajnoczi --- include/hw/qdev-core.h | 17 ++--- hw/scsi/scsi-bus.c | 3 +-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index bd50ad5ee1..4d734cf35e 100644 --- a/include/hw/qdev-core.h +++ b/include

[PATCH v3 09/20] block: add blk_in_drain() API

2023-04-20 Thread Stefan Hajnoczi
The BlockBackend quiesce_counter is greater than zero during drained sections. Add an API to check whether the BlockBackend is in a drained section. The next patch will use this API. Signed-off-by: Stefan Hajnoczi --- include/sysemu/block-backend-global-state.h | 1 + block/block-backend.c

[PATCH v3 02/20] virtio-scsi: avoid race between unplug and transport event

2023-04-20 Thread Stefan Hajnoczi
by: Daniil Tatianin Signed-off-by: Stefan Hajnoczi --- hw/scsi/scsi-bus.c| 3 ++- hw/scsi/virtio-scsi.c | 18 +- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c index 07275fb631..64d7311757 100644 --- a/hw/scsi/scsi-b

[PATCH v3 00/20] block: remove aio_disable_external() API

2023-04-20 Thread Stefan Hajnoczi
were already sent as a separate series. I included them because they are necessary in order to fully remove aio_disable_external(). Based-on: 087bc644b7634436ca9d52fe58ba9234e2bef026 (kevin/block-next) Stefan Hajnoczi (20): hw/qdev: introduce qdev_is_realized() helper virtio-scsi: avoid

Re: [PATCH v2 16/16] virtio: make it possible to detach host notifier from any thread

2023-04-20 Thread Stefan Hajnoczi
On Wed, 19 Apr 2023 at 14:52, Eric Blake wrote: > > On Wed, Apr 19, 2023 at 01:28:17PM -0400, Stefan Hajnoczi wrote: > > virtio_queue_aio_detach_host_notifier() does two things: > > 1. It removes the fd handler from the event loop. > > 2. It processes the virtqueue on

[PATCH v2 04/16] block/export: only acquire AioContext once for vhost_user_server_stop()

2023-04-19 Thread Stefan Hajnoczi
vhost_user_server_stop() uses AIO_WAIT_WHILE(). AIO_WAIT_WHILE() requires that AioContext is only acquired once. Since blk_exp_request_shutdown() already acquires the AioContext it shouldn't be acquired again in vhost_user_server_stop(). Signed-off-by: Stefan Hajnoczi --- util/vhost

[PATCH v2 05/16] util/vhost-user-server: rename refcount to in_flight counter

2023-04-19 Thread Stefan Hajnoczi
e are no more requests. Avoid confusing by renaming refcount and ref/unref to in_flight and inc/dec. Reviewed-by: Paolo Bonzini Signed-off-by: Stefan Hajnoczi --- include/qemu/vhost-user-server.h | 6 +++--- block/export/vhost-user-blk-server.c | 11 +++ util/vhost-user-ser

[PATCH v2 00/16] block: remove aio_disable_external() API

2023-04-19 Thread Stefan Hajnoczi
Based-on: 087bc644b7634436ca9d52fe58ba9234e2bef026 (kevin/block-next) Stefan Hajnoczi (16): hw/qdev: introduce qdev_is_realized() helper virtio-scsi: avoid race between unplug and transport event virtio-scsi: stop using aio_disable_external() during unplug block/export: only acquire AioCo

[PATCH v2 02/16] virtio-scsi: avoid race between unplug and transport event

2023-04-19 Thread Stefan Hajnoczi
by: Daniil Tatianin Signed-off-by: Stefan Hajnoczi --- hw/scsi/scsi-bus.c| 3 ++- hw/scsi/virtio-scsi.c | 18 +- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c index 07275fb631..64d7311757 100644 --- a/hw/scsi/scsi-b

[PATCH v2 13/16] block/export: rewrite vduse-blk drain code

2023-04-19 Thread Stefan Hajnoczi
resume them in .drained_end(). This eliminates the need for the aio_set_fd_handler(is_external=true) flag, which is being removed from QEMU. This is a long list but splitting it into individual commits would probably lead to git bisect failures - the changes are all related. Signed-off-by:

[PATCH v2 03/16] virtio-scsi: stop using aio_disable_external() during unplug

2023-04-19 Thread Stefan Hajnoczi
simple_device_unplug_cb() returns. Thanks to these two conditions we don't need aio_disable_external() anymore. Cc: Zhengui Li Reviewed-by: Paolo Bonzini Reviewed-by: Daniil Tatianin Signed-off-by: Stefan Hajnoczi --- hw/scsi/scsi-disk.c | 1 + hw/scsi/virtio-scsi.c | 3 --- 2 file

[PATCH v2 15/16] block/fuse: do not set is_external=true on FUSE fd

2023-04-19 Thread Stefan Hajnoczi
This is part of ongoing work to remove the aio_disable_external() API. Use BlockDevOps .drained_begin/end/poll() instead of aio_set_fd_handler(is_external=true). As a side-effect the FUSE export now follows AioContext changes like the other export types. Signed-off-by: Stefan Hajnoczi

[PATCH v2 11/16] xen-block: implement BlockDevOps->drained_begin()

2023-04-19 Thread Stefan Hajnoczi
depend on the dataplane instance, so move the blk_set_dev_ops() call after xen_block_dataplane_create(). Signed-off-by: Stefan Hajnoczi --- hw/block/dataplane/xen-block.h | 2 ++ hw/block/dataplane/xen-block.c | 42 +- hw/block/xen-block.c

[PATCH v2 14/16] block/export: don't require AioContext lock around blk_exp_ref/unref()

2023-04-19 Thread Stefan Hajnoczi
The FUSE export calls blk_exp_ref/unref() without the AioContext lock. Instead of fixing the FUSE export, adjust blk_exp_ref/unref() so they work without the AioContext lock. This way it's less error-prone. Suggested-by: Paolo Bonzini Signed-off-by: Stefan Hajnoczi --- include/block/exp

[PATCH v2 07/16] block/export: stop using is_external in vhost-user-blk server

2023-04-19 Thread Stefan Hajnoczi
d the aio_disable_external() API cannot be used since multiple AioContext may be processing I/O, not just one. Switch to BlockDevOps->drained_begin/end() callbacks. Signed-off-by: Stefan Hajnoczi --- block/export/vhost-user-blk-server.c | 43 ++-- util/vhost-user-server.c

[PATCH v2 08/16] hw/xen: do not use aio_set_fd_handler(is_external=true) in xen_xenstore

2023-04-19 Thread Stefan Hajnoczi
There is no need to suspend activity between aio_disable_external() and aio_enable_external(), which is mainly used for the block layer's drain operation. This is part of ongoing work to remove the aio_disable_external() API. Reviewed-by: David Woodhouse Signed-off-by: Stefan Hajnoczi --

[PATCH v2 06/16] block/export: wait for vhost-user-blk requests when draining

2023-04-19 Thread Stefan Hajnoczi
when there are requests in flight. The in-flight counter needs to be atomic. Signed-off-by: Stefan Hajnoczi --- include/qemu/vhost-user-server.h | 4 +++- block/export/vhost-user-blk-server.c | 19 +++ util/vhost-user-server.c | 14 ++ 3 files c

[PATCH v2 16/16] virtio: make it possible to detach host notifier from any thread

2023-04-19 Thread Stefan Hajnoczi
: Stefan Hajnoczi --- hw/block/dataplane/virtio-blk.c | 2 ++ hw/scsi/virtio-scsi-dataplane.c | 9 + 2 files changed, 11 insertions(+) diff --git a/hw/block/dataplane/virtio-blk.c b/hw/block/dataplane/virtio-blk.c index b28d81737e..bd7cc6e76b 100644 --- a/hw/block/dataplane/virtio-blk.c +++ b

[PATCH v2 12/16] hw/xen: do not set is_external=true on evtchn fds

2023-04-19 Thread Stefan Hajnoczi
o use BlockDevOps .drained_begin/end() callbacks. It no longer relies on is_external=true so it is safe to pass is_external=false. This is part of ongoing work to remove the aio_disable_external() API. Signed-off-by: Stefan Hajnoczi --- hw/xen/xen-bus.c | 8 1 file changed, 4 insertions(

[PATCH v2 10/16] block: drain from main loop thread in bdrv_co_yield_to_drain()

2023-04-19 Thread Stefan Hajnoczi
. Signed-off-by: Stefan Hajnoczi --- include/sysemu/block-backend-common.h | 25 + block/io.c| 3 ++- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/include/sysemu/block-backend-common.h b/include/sysemu/block-backend-common.h index

[PATCH v2 01/16] hw/qdev: introduce qdev_is_realized() helper

2023-04-19 Thread Stefan Hajnoczi
Add a helper function to check whether the device is realized without requiring the Big QEMU Lock. The next patch adds a second caller. The goal is to avoid spreading DeviceState field accesses throughout the code. Suggested-by: Philippe Mathieu-Daudé Signed-off-by: Stefan Hajnoczi --- include

[PATCH v2 09/16] block: add blk_in_drain() API

2023-04-19 Thread Stefan Hajnoczi
The BlockBackend quiesce_counter is greater than zero during drained sections. Add an API to check whether the BlockBackend is in a drained section. The next patch will use this API. Signed-off-by: Stefan Hajnoczi --- include/sysemu/block-backend-global-state.h | 1 + block/block-backend.c

Re: [Virtio-fs] [PATCH 2/4] vhost-user: Interface for migration state transfer

2023-04-19 Thread Stefan Hajnoczi
On Wed, 19 Apr 2023 at 07:16, Hanna Czenczek wrote: > > On 19.04.23 13:10, Stefan Hajnoczi wrote: > > On Wed, 19 Apr 2023 at 06:57, Hanna Czenczek wrote: > >> On 18.04.23 19:59, Stefan Hajnoczi wrote: > >>> On Tue, Apr 18, 2023 at 10:09:30AM +0200, Eugenio Perez

Re: [PATCH 2/4] vhost-user: Interface for migration state transfer

2023-04-19 Thread Stefan Hajnoczi
On Wed, 19 Apr 2023 at 07:10, Hanna Czenczek wrote: > > On 18.04.23 09:54, Eugenio Perez Martin wrote: > > On Mon, Apr 17, 2023 at 9:21 PM Stefan Hajnoczi wrote: > >> On Mon, 17 Apr 2023 at 15:08, Eugenio Perez Martin > >> wrote: > >>> On Mo

Re: [Virtio-fs] [PATCH 2/4] vhost-user: Interface for migration state transfer

2023-04-19 Thread Stefan Hajnoczi
On Wed, 19 Apr 2023 at 06:57, Hanna Czenczek wrote: > > On 18.04.23 19:59, Stefan Hajnoczi wrote: > > On Tue, Apr 18, 2023 at 10:09:30AM +0200, Eugenio Perez Martin wrote: > >> On Mon, Apr 17, 2023 at 9:33 PM Stefan Hajnoczi wrote: > >>> On Mon, 17 Apr 20

Re: [PATCH 2/4] vhost-user: Interface for migration state transfer

2023-04-19 Thread Stefan Hajnoczi
On Wed, 19 Apr 2023 at 06:45, Hanna Czenczek wrote: > > On 14.04.23 17:17, Eugenio Perez Martin wrote: > > On Thu, Apr 13, 2023 at 7:55 PM Hanna Czenczek wrote: > > [...] > > >> Basically, what I’m hearing is that I need to implement a different > >> feature that has no practical impact right now

Re: [PATCH 2/4] vhost-user: Interface for migration state transfer

2023-04-18 Thread Stefan Hajnoczi
On Tue, 18 Apr 2023 at 14:31, Eugenio Perez Martin wrote: > > On Tue, Apr 18, 2023 at 7:59 PM Stefan Hajnoczi wrote: > > > > On Tue, Apr 18, 2023 at 10:09:30AM +0200, Eugenio Perez Martin wrote: > > > On Mon, Apr 17, 2023 at 9:33 PM Stefan Hajnoczi > > > w

Status of "block: Mark drain related functions GRAPH_RDLOCK"?

2023-04-18 Thread Stefan Hajnoczi
Hi Emanuele and Kevin, The following commit is not in qemu.git/master or Kevin's block-next tree: https://repo.or.cz/qemu/kevin.git/commitdiff/b4959a8028f417a269168e1570b5e502123e64ed Do you what the status of that patch is? Multi-queue block layer code I'm working on depends on this change to bd

Re: [PATCH V4] tracing: install trace events file only if necessary

2023-04-18 Thread Stefan Hajnoczi
On Fri, 7 Apr 2023 at 21:05, wrote: > > From: Carlos Santos > > It is not useful when configuring with --enable-trace-backends=nop. > > Signed-off-by: Carlos Santos > --- > Changes v1->v2: > Install based on chosen trace backend, not on chosen emulators. > Changes v2->v3: > Add missing comma

Re: [PATCH 2/4] vhost-user: Interface for migration state transfer

2023-04-18 Thread Stefan Hajnoczi
On Tue, Apr 18, 2023 at 10:09:30AM +0200, Eugenio Perez Martin wrote: > On Mon, Apr 17, 2023 at 9:33 PM Stefan Hajnoczi wrote: > > > > On Mon, 17 Apr 2023 at 15:10, Eugenio Perez Martin > > wrote: > > > > > > On Mon, Apr 17, 2023 at 5:38 PM Stefan Hajnocz

<    11   12   13   14   15   16   17   18   19   20   >