Re: [PATCH v14 5/8] qmp: decode feature & status bits in virtio-status

2022-06-09 Thread Michael S. Tsirkin
On Thu, May 19, 2022 at 02:30:43AM -0400, Jonah Palmer wrote: > > On 5/16/22 16:26, Michael S. Tsirkin wrote: > > On Fri, Apr 01, 2022 at 09:23:22AM -0400, Jonah Palmer wrote: > > From: Laurent Vivier > > Display feature names instead of bitmaps for host, guest, and >

[PATCH] tests/qtest: Reduce npcm7xx_sdhci test image size

2022-06-09 Thread Hao Wu
Creating 1GB image for a simple qtest is unnecessary and could lead to failures. We reduce the image size to 1MB to reduce the test overhead. Signed-off-by: Hao Wu --- tests/qtest/npcm7xx_sdhci-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

Re: [PULL 00/18] Block layer patches

2022-06-09 Thread Richard Henderson
On 6/9/22 10:21, Kevin Wolf wrote: The following changes since commit 028f2361d0c2d28d6f918fe618f389228ac22b60: Merge tag 'pull-target-arm-20220609' of https://git.linaro.org/people/pmaydell/qemu-arm into staging (2022-06-09 06:47:03 -0700) are available in the Git repository at: git

Re: [PATCH v2 1/2] hw: m25p80: add WP# pin and SRWD bit for write protection

2022-06-09 Thread Peter Delevoryas
> On Jun 9, 2022, at 12:22 PM, Francisco Iglesias > wrote: > > Hi Iris, > > Looks good some, a couple of comments below. > > On [2022 Jun 08] Wed 20:13:19, Iris Chen wrote: >> From: Iris Chen >> >> Signed-off-by: Iris Chen >> --- >> Addressed all comments from V1. The biggest change:

Re: [PATCH 2/2] linux-aio: explain why max batch is checked in laio_io_unplug()

2022-06-09 Thread Stefano Garzarella
On Thu, Jun 09, 2022 at 05:47:12PM +0100, Stefan Hajnoczi wrote: It may not be obvious why laio_io_unplug() checks max batch. I discussed this with Stefano and have added a comment summarizing the reason. Cc: Stefano Garzarella Cc: Kevin Wolf Signed-off-by: Stefan Hajnoczi ---

[PULL 01/18] block: drop unused bdrv_co_drain() API

2022-06-09 Thread Kevin Wolf
From: Stefan Hajnoczi bdrv_co_drain() has not been used since commit 9a0cec664eef ("mirror: use bdrv_drained_begin/bdrv_drained_end") in 2016. Remove it so there are fewer drain scenarios to worry about. Use bdrv_drained_begin()/bdrv_drained_end() instead. They are "mixed" functions that can be

[PULL 02/18] block: get rid of blk->guest_block_size

2022-06-09 Thread Kevin Wolf
From: Stefan Hajnoczi Commit 1b7fd729559c ("block: rename buffer_alignment to guest_block_size") noted: At this point, the field is set by the device emulation, but completely ignored by the block layer. The last time the value of buffer_alignment/guest_block_size was actually used was

[PULL 05/18] block: simplify handling of try to merge different sized bitmaps

2022-06-09 Thread Kevin Wolf
From: Vladimir Sementsov-Ogievskiy We have too much logic to simply check that bitmaps are of the same size. Let's just define that hbitmap_merge() and bdrv_dirty_bitmap_merge_internal() require their argument bitmaps be of same size, this simplifies things. Let's look through the callers: For

Re: [PATCH v2 1/2] hw: m25p80: add WP# pin and SRWD bit for write protection

2022-06-09 Thread Francisco Iglesias
Hi Iris, Looks good some, a couple of comments below. On [2022 Jun 08] Wed 20:13:19, Iris Chen wrote: > From: Iris Chen > > Signed-off-by: Iris Chen > --- > Addressed all comments from V1. The biggest change: removed > object_class_property_add. > > hw/block/m25p80.c | 37

[PULL 14/18] qsd: document vduse-blk exports

2022-06-09 Thread Kevin Wolf
From: Stefan Hajnoczi Document vduse-blk exports in qemu-storage-daemon --help and the qemu-storage-daemon(1) man page. Based-on: <20220523084611.91-1-xieyon...@bytedance.com> Cc: Xie Yongji Signed-off-by: Stefan Hajnoczi Message-Id: <20220525121947.859820-1-stefa...@redhat.com>

[PULL 07/18] block/export: Fix incorrect length passed to vu_queue_push()

2022-06-09 Thread Kevin Wolf
From: Xie Yongji Now the req->size is set to the correct value only when handling VIRTIO_BLK_T_GET_ID request. This patch fixes it. Signed-off-by: Xie Yongji Message-Id: <20220523084611.91-3-xieyon...@bytedance.com> Reviewed-by: Stefan Hajnoczi Signed-off-by: Kevin Wolf ---

[PULL 12/18] vduse-blk: Add vduse-blk resize support

2022-06-09 Thread Kevin Wolf
From: Xie Yongji To support block resize, this uses vduse_dev_update_config() to update the capacity field in configuration space and inject config interrupt on the block resize callback. Signed-off-by: Xie Yongji Reviewed-by: Stefan Hajnoczi Message-Id:

[PULL 08/18] block/export: Abstract out the logic of virtio-blk I/O process

2022-06-09 Thread Kevin Wolf
From: Xie Yongji Abstract the common logic of virtio-blk I/O process to a function named virtio_blk_process_req(). It's needed for the following commit. Signed-off-by: Xie Yongji Message-Id: <20220523084611.91-4-xieyon...@bytedance.com> Reviewed-by: Stefan Hajnoczi Signed-off-by: Kevin Wolf

Re: [PATCH 19/20] migration: remove the QEMUFileOps 'get_return_path' callback

2022-06-09 Thread Dr. David Alan Gilbert
* Daniel P. Berrangé (berra...@redhat.com) wrote: > This directly implements the get_return_path logic using QIOChannel APIs. > > Signed-off-by: Daniel P. Berrangé Reviewed-by: Dr. David Alan Gilbert > --- > migration/qemu-file-channel.c | 16 > migration/qemu-file.c

[PULL 13/18] libvduse: Add support for reconnecting

2022-06-09 Thread Kevin Wolf
From: Xie Yongji To support reconnecting after restart or crash, VDUSE backend might need to resubmit inflight I/Os. This stores the metadata such as the index of inflight I/O's descriptors to a shm file so that VDUSE backend can restore them during reconnecting. Signed-off-by: Xie Yongji

Re: [PATCH 1/2] linux-aio: fix unbalanced plugged counter in laio_io_unplug()

2022-06-09 Thread Stefano Garzarella
On Thu, Jun 09, 2022 at 05:47:11PM +0100, Stefan Hajnoczi wrote: Every laio_io_plug() call has a matching laio_io_unplug() call. There is a plugged counter that tracks the number of levels of plugging and allows for nesting. The plugged counter must reflect the balance between laio_io_plug()

[PULL 10/18] libvduse: Add VDUSE (vDPA Device in Userspace) library

2022-06-09 Thread Kevin Wolf
From: Xie Yongji VDUSE [1] is a linux framework that makes it possible to implement software-emulated vDPA devices in userspace. This adds a library as a subproject to help implementing VDUSE backends in QEMU. [1] https://www.kernel.org/doc/html/latest/userspace-api/vduse.html Signed-off-by:

Re: [PATCH 20/20] migration: remove the QEMUFileOps abstraction

2022-06-09 Thread Dr. David Alan Gilbert
* Daniel P. Berrangé (berra...@redhat.com) wrote: > Now that all QEMUFile callbacks are removed, the entire concept can be > deleted. > > Signed-off-by: Daniel P. Berrangé I think that's OK, there's one nit - you remove qemu_get_fd from one of the headers; I think that probably belongs in an

[PULL 15/18] block/rbd: report a better error when namespace does not exist

2022-06-09 Thread Kevin Wolf
From: Stefano Garzarella If the namespace does not exist, rbd_create() fails with -ENOENT and QEMU reports a generic "error rbd create: No such file or directory": $ qemu-img create rbd:rbd/namespace/image 1M Formatting 'rbd:rbd/namespace/image', fmt=raw size=1048576 qemu-img:

[PULL 00/18] Block layer patches

2022-06-09 Thread Kevin Wolf
The following changes since commit 028f2361d0c2d28d6f918fe618f389228ac22b60: Merge tag 'pull-target-arm-20220609' of https://git.linaro.org/people/pmaydell/qemu-arm into staging (2022-06-09 06:47:03 -0700) are available in the Git repository at: git://repo.or.cz/qemu/kevin.git tags

[PULL 17/18] aio_wait_kick: add missing memory barrier

2022-06-09 Thread Kevin Wolf
From: Emanuele Giuseppe Esposito It seems that aio_wait_kick always required a memory barrier or atomic operation in the caller, but nobody actually took care of doing it. Let's put the barrier in the function instead, and pair it with another one in AIO_WAIT_WHILE. Read aio_wait_kick() comment

[PULL 04/18] block: improve block_dirty_bitmap_merge(): don't allocate extra bitmap

2022-06-09 Thread Kevin Wolf
From: Vladimir Sementsov-Ogievskiy We don't need extra bitmap. All we need is to backup the original bitmap when we do first merge. So, drop extra temporary bitmap and work directly with target and backup. Still to keep old semantics, that on failure target is unchanged and user don't need to

[PULL 11/18] vduse-blk: Implement vduse-blk export

2022-06-09 Thread Kevin Wolf
From: Xie Yongji This implements a VDUSE block backends based on the libvduse library. We can use it to export the BDSs for both VM and container (host) usage. The new command-line syntax is: $ qemu-storage-daemon \ --blockdev file,node-name=drive0,filename=test.img \ --export

[PULL 06/18] block: Support passing NULL ops to blk_set_dev_ops()

2022-06-09 Thread Kevin Wolf
From: Xie Yongji This supports passing NULL ops to blk_set_dev_ops() so that we can remove stale ops in some cases. Signed-off-by: Xie Yongji Reviewed-by: Stefan Hajnoczi Message-Id: <20220523084611.91-2-xieyon...@bytedance.com> Signed-off-by: Kevin Wolf --- block/block-backend.c | 2 +- 1

Re: [PATCH 20/20] migration: remove the QEMUFileOps abstraction

2022-06-09 Thread Daniel P . Berrangé
On Thu, Jun 09, 2022 at 05:59:00PM +0100, Dr. David Alan Gilbert wrote: > * Daniel P. Berrangé (berra...@redhat.com) wrote: > > Now that all QEMUFile callbacks are removed, the entire concept can be > > deleted. > > > > Signed-off-by: Daniel P. Berrangé > > I think that's OK, there's one nit -

Re: [PATCH 17/20] migration: remove the QEMUFileOps 'get_buffer' callback

2022-06-09 Thread Daniel P . Berrangé
On Thu, Jun 09, 2022 at 05:46:29PM +0100, Dr. David Alan Gilbert wrote: > * Daniel P. Berrangé (berra...@redhat.com) wrote: > > This directly implements the get_buffer logic using QIOChannel APIs. > > > > Signed-off-by: Daniel P. Berrangé > > --- > > migration/qemu-file-channel.c | 29

[PULL 09/18] linux-headers: Add vduse.h

2022-06-09 Thread Kevin Wolf
From: Xie Yongji This adds vduse header to linux headers so that the relevant VDUSE API can be used in subsequent patches. Signed-off-by: Xie Yongji Reviewed-by: Stefan Hajnoczi Message-Id: <20220523084611.91-5-xieyon...@bytedance.com> Signed-off-by: Kevin Wolf ---

[PULL 16/18] block/gluster: correctly set max_pdiscard

2022-06-09 Thread Kevin Wolf
From: Fabian Ebner On 64-bit platforms, assigning SIZE_MAX to the int64_t max_pdiscard results in a negative value, and the following assertion would trigger down the line (it's not the same max_pdiscard, but computed from the other one): qemu-system-x86_64: ../block/io.c:3166: bdrv_co_pdiscard:

[PULL 18/18] nbd: Drop dead code spotted by Coverity

2022-06-09 Thread Kevin Wolf
From: Eric Blake CID 1488362 points out that the second 'rc >= 0' check is now dead code. Reported-by: Peter Maydell Fixes: 172f5f1a40(nbd: remove peppering of nbd_client_connected) Signed-off-by: Eric Blake Message-Id: <20220516210519.76135-1-ebl...@redhat.com> Reviewed-by: Peter Maydell

Re: [PATCH 18/20] migration: remove the QEMUFileOps 'writev_buffer' callback

2022-06-09 Thread Dr. David Alan Gilbert
* Daniel P. Berrangé (berra...@redhat.com) wrote: > This directly implements the writev_buffer logic using QIOChannel APIs. > > Signed-off-by: Daniel P. Berrangé > --- > migration/qemu-file-channel.c | 43 --- > migration/qemu-file.c | 24

[PATCH 2/2] linux-aio: explain why max batch is checked in laio_io_unplug()

2022-06-09 Thread Stefan Hajnoczi
It may not be obvious why laio_io_unplug() checks max batch. I discussed this with Stefano and have added a comment summarizing the reason. Cc: Stefano Garzarella Cc: Kevin Wolf Signed-off-by: Stefan Hajnoczi --- block/linux-aio.c | 6 ++ 1 file changed, 6 insertions(+) diff --git

[PATCH 1/2] linux-aio: fix unbalanced plugged counter in laio_io_unplug()

2022-06-09 Thread Stefan Hajnoczi
Every laio_io_plug() call has a matching laio_io_unplug() call. There is a plugged counter that tracks the number of levels of plugging and allows for nesting. The plugged counter must reflect the balance between laio_io_plug() and laio_io_unplug() calls accurately. Otherwise I/O stalls occur

Re: [PATCH 14/20] migration: remove the QEMUFileOps 'shut_down' callback

2022-06-09 Thread Daniel P . Berrangé
On Thu, Jun 09, 2022 at 05:12:41PM +0100, Dr. David Alan Gilbert wrote: > * Daniel P. Berrangé (berra...@redhat.com) wrote: > > This directly implements the shutdown logic using QIOChannel APIs. > > > > Signed-off-by: Daniel P. Berrangé > > --- > > migration/qemu-file-channel.c | 27

Re: [PATCH 13/20] migration: remove unused QEMUFileGetFD typedef

2022-06-09 Thread Dr. David Alan Gilbert
* Daniel P. Berrangé (berra...@redhat.com) wrote: > Signed-off-by: Daniel P. Berrangé Reviewed-by: Dr. David Alan Gilbert > --- > migration/qemu-file.h | 4 > 1 file changed, 4 deletions(-) > > diff --git a/migration/qemu-file.h b/migration/qemu-file.h > index 07c86bfea3..674c2c409b

[PATCH 0/2] linux-aio: fix unbalanced plugged counter in laio_io_unplug()

2022-06-09 Thread Stefan Hajnoczi
An unlucky I/O pattern can result in stalled Linux AIO requests when the plugged counter becomes unbalanced. See Patch 1 for details. Patch 2 adds a comment to explain why the laio_io_unplug() even checks max batch in the first place. Stefan Hajnoczi (2): linux-aio: fix unbalanced plugged

[PULL 03/18] block: block_dirty_bitmap_merge(): fix error path

2022-06-09 Thread Kevin Wolf
From: Vladimir Sementsov-Ogievskiy At the end we ignore failure of bdrv_merge_dirty_bitmap() and report success. And still set errp. That's wrong. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Nikita Lapshin Reviewed-by: Kevin Wolf Message-Id:

Re: [PATCH 16/20] migration: remove the QEMUFileOps 'close' callback

2022-06-09 Thread Dr. David Alan Gilbert
* Daniel P. Berrangé (berra...@redhat.com) wrote: > This directly implements the close logic using QIOChannel APIs. > > Signed-off-by: Daniel P. Berrangé Reviewed-by: Dr. David Alan Gilbert > --- > migration/qemu-file-channel.c | 12 > migration/qemu-file.c | 12

Re: [PATCH] main loop: add missing documentation links to GS/IO macros

2022-06-09 Thread Stefan Hajnoczi
On Thu, Jun 09, 2022 at 08:22:06AM -0400, Emanuele Giuseppe Esposito wrote: > If we go directly to GLOBAL_STATE_CODE, IO_CODE or IO_OR_GS_CODE > definition, we just find that they "mark and check that the function > is part of the {category} API". > However, ther is no definition on what

Re: [PATCH 14/20] migration: remove the QEMUFileOps 'shut_down' callback

2022-06-09 Thread Dr. David Alan Gilbert
* Daniel P. Berrangé (berra...@redhat.com) wrote: > This directly implements the shutdown logic using QIOChannel APIs. > > Signed-off-by: Daniel P. Berrangé > --- > migration/qemu-file-channel.c | 27 --- > migration/qemu-file.c | 10 +++--- >

Re: [PATCH 17/20] migration: remove the QEMUFileOps 'get_buffer' callback

2022-06-09 Thread Dr. David Alan Gilbert
* Daniel P. Berrangé (berra...@redhat.com) wrote: > This directly implements the get_buffer logic using QIOChannel APIs. > > Signed-off-by: Daniel P. Berrangé > --- > migration/qemu-file-channel.c | 29 - > migration/qemu-file.c | 18 -- >

Re: [PATCH 12/20] migration: introduce new constructors for QEMUFile

2022-06-09 Thread Dr. David Alan Gilbert
* Daniel P. Berrangé (berra...@redhat.com) wrote: > Prepare for the elimination of QEMUFileOps by introducing a pair of new > constructors. This lets us distinguish between an input and output file > object explicitly rather than via the existance of specific callbacks. > > Signed-off-by: Daniel

[PATCH v5 08/10] block: Add bdrv_co_pwrite_sync()

2022-06-09 Thread Alberto Faria
Also convert bdrv_pwrite_sync() to being implemented using generated_co_wrapper. Signed-off-by: Alberto Faria Reviewed-by: Eric Blake Reviewed-by: Stefan Hajnoczi --- block/io.c | 9 + include/block/block-io.h | 8 ++-- 2 files changed, 11 insertions(+), 6

[PATCH v5 05/10] block: Make bdrv_co_pwrite() take a const buffer

2022-06-09 Thread Alberto Faria
It does not mutate the buffer. Signed-off-by: Alberto Faria Reviewed-by: Paolo Bonzini Reviewed-by: Stefan Hajnoczi --- include/block/block_int-io.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/block/block_int-io.h b/include/block/block_int-io.h index

[PATCH v5 02/10] block: Change bdrv_{pread, pwrite, pwrite_sync}() param order

2022-06-09 Thread Alberto Faria
Swap 'buf' and 'bytes' around for consistency with bdrv_co_{pread,pwrite}(), and in preparation to implement these functions using generated_co_wrapper. Callers were updated using this Coccinelle script: @@ expression child, offset, buf, bytes, flags; @@ - bdrv_pread(child, offset, buf,

[PATCH v5 09/10] block: Use bdrv_co_pwrite_sync() when caller is coroutine_fn

2022-06-09 Thread Alberto Faria
Convert uses of bdrv_pwrite_sync() into bdrv_co_pwrite_sync() when the callers are already coroutine_fn. Signed-off-by: Alberto Faria Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Stefan Hajnoczi --- block/parallels.c | 2 +- block/qcow2-snapshot.c | 6 +++--- block/qcow2.c

Re: [PATCH 15/20] migration: remove the QEMUFileOps 'set_blocking' callback

2022-06-09 Thread Dr. David Alan Gilbert
* Daniel P. Berrangé (berra...@redhat.com) wrote: > This directly implements the set_blocking logic using QIOChannel APIs. > > Signed-off-by: Daniel P. Berrangé Reviewed-by: Dr. David Alan Gilbert > --- > migration/qemu-file-channel.c | 14 -- > migration/qemu-file.c | 4

Re: [PATCH 14/20] migration: remove the QEMUFileOps 'shut_down' callback

2022-06-09 Thread Dr. David Alan Gilbert
* Daniel P. Berrangé (berra...@redhat.com) wrote: > On Thu, Jun 09, 2022 at 05:12:41PM +0100, Dr. David Alan Gilbert wrote: > > * Daniel P. Berrangé (berra...@redhat.com) wrote: > > > This directly implements the shutdown logic using QIOChannel APIs. > > > > > > Signed-off-by: Daniel P. Berrangé

[PATCH v4 05/10] block: Make bdrv_co_pwrite() take a const buffer

2022-06-09 Thread Alberto Faria
It does not mutate the buffer. Signed-off-by: Alberto Faria Reviewed-by: Paolo Bonzini --- include/block/block_int-io.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/block/block_int-io.h b/include/block/block_int-io.h index bb454200e5..d4d3bed783 100644 ---

[PATCH v4 04/10] crypto: Make block callbacks return 0 on success

2022-06-09 Thread Alberto Faria
They currently return the value of their headerlen/buflen parameter on success. Returning 0 instead makes it clear that short reads/writes are not possible. Signed-off-by: Alberto Faria Reviewed-by: Eric Blake --- block/crypto.c | 52 +-

[PATCH v5 00/10] Implement bdrv_{pread, pwrite, pwrite_sync, pwrite_zeroes}() using generated_co_wrapper

2022-06-09 Thread Alberto Faria
Start by making the interfaces of analogous non-coroutine and coroutine functions consistent with each other, then implement the non-coroutine ones using generated_co_wrapper. For the bdrv_pwrite_sync() case, also add the missing bdrv_co_pwrite_sync() function. Changes v4 --> v5: - Picking up a

[PATCH v4 03/10] block: Make bdrv_{pread, pwrite}() return 0 on success

2022-06-09 Thread Alberto Faria
They currently return the value of their 'bytes' parameter on success. Make them return 0 instead, for consistency with other I/O functions and in preparation to implement them using generated_co_wrapper. This also makes it clear that short reads/writes are not possible. The few callers that

[PATCH v5 10/10] block/qcow2: Use bdrv_pwrite_sync() in qcow2_mark_dirty()

2022-06-09 Thread Alberto Faria
Use bdrv_pwrite_sync() instead of calling bdrv_pwrite() and bdrv_flush() separately. Signed-off-by: Alberto Faria Reviewed-by: Eric Blake Reviewed-by: Stefan Hajnoczi --- block/qcow2.c | 9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/block/qcow2.c b/block/qcow2.c

Re: [PATCH 11/20] migration: hardcode assumption that QEMUFile is backed with QIOChannel

2022-06-09 Thread Dr. David Alan Gilbert
* Daniel P. Berrangé (berra...@redhat.com) wrote: > The only callers of qemu_fopen_ops pass 'true' for the 'has_ioc' > parameter, so hardcode this assumption in QEMUFile, by passing in > the QIOChannel object as a non-opaque parameter. > > Signed-off-by: Daniel P. Berrangé Reviewed-by: Dr.

Re: [PATCH 10/20] migration: stop passing 'opaque' parameter to QEMUFile hooks

2022-06-09 Thread Dr. David Alan Gilbert
* Daniel P. Berrangé (berra...@redhat.com) wrote: > The only user of the hooks is RDMA which provides a QIOChannel backed > impl of QEMUFile. It can thus use the qemu_file_get_ioc() method. > > Signed-off-by: Daniel P. Berrangé Reviewed-by: Dr. David Alan Gilbert > --- >

Re: [PATCH 09/20] migration: convert savevm to use QIOChannelBlock for VMState

2022-06-09 Thread Dr. David Alan Gilbert
* Daniel P. Berrangé (berra...@redhat.com) wrote: > With this change, all QEMUFile usage is backed by QIOChannel at > last. > > Signed-off-by: Daniel P. Berrangé Reviewed-by: Dr. David Alan Gilbert > --- > migration/savevm.c | 42 -- > 1 file changed,

Re: [PATCH v5 21/45] block: add bdrv_try_set_aio_context_tran transaction action

2022-06-09 Thread Vladimir Sementsov-Ogievskiy
On 6/8/22 14:49, Hanna Reitz wrote: On 30.03.22 23:28, Vladimir Sementsov-Ogievskiy wrote: To be used in further commit. Signed-off-by: Vladimir Sementsov-Ogievskiy ---   block.c | 48   1 file changed, 48 insertions(+) Looking at

[PATCH v5 07/10] block: Implement bdrv_{pread, pwrite, pwrite_zeroes}() using generated_co_wrapper

2022-06-09 Thread Alberto Faria
bdrv_{pread,pwrite}() now return -EIO instead of -EINVAL when 'bytes' is negative, making them consistent with bdrv_{preadv,pwritev}() and bdrv_co_{pread,pwrite,preadv,pwritev}(). bdrv_pwrite_zeroes() now also calls trace_bdrv_co_pwrite_zeroes() and clears the BDRV_REQ_MAY_UNMAP flag when

[PATCH v5 04/10] crypto: Make block callbacks return 0 on success

2022-06-09 Thread Alberto Faria
They currently return the value of their headerlen/buflen parameter on success. Returning 0 instead makes it clear that short reads/writes are not possible. Signed-off-by: Alberto Faria Reviewed-by: Eric Blake Reviewed-by: Stefan Hajnoczi --- block/crypto.c | 52

[PATCH v4 06/10] block: Make 'bytes' param of bdrv_co_{pread, pwrite, preadv, pwritev}() an int64_t

2022-06-09 Thread Alberto Faria
For consistency with other I/O functions, and in preparation to implement bdrv_{pread,pwrite}() using generated_co_wrapper. unsigned int fits in int64_t, so all callers remain correct. bdrv_check_request32() is called further down the stack and causes -EIO to be returned if 'bytes' is negative

[PATCH v4 00/10] Implement bdrv_{pread, pwrite, pwrite_sync, pwrite_zeroes}() using generated_co_wrapper

2022-06-09 Thread Alberto Faria
Start by making the interfaces of analogous non-coroutine and coroutine functions consistent with each other, then implement the non-coroutine ones using generated_co_wrapper. For the bdrv_pwrite_sync() case, also add the missing bdrv_co_pwrite_sync() function. Changes v3 --> v4: - Removed

[PATCH v4 10/10] block/qcow2: Use bdrv_pwrite_sync() in qcow2_mark_dirty()

2022-06-09 Thread Alberto Faria
Use bdrv_pwrite_sync() instead of calling bdrv_pwrite() and bdrv_flush() separately. Signed-off-by: Alberto Faria Reviewed-by: Eric Blake --- block/qcow2.c | 9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/block/qcow2.c b/block/qcow2.c index f2fb54c51f..90a2dd406b

[PATCH v4 09/10] block: Use bdrv_co_pwrite_sync() when caller is coroutine_fn

2022-06-09 Thread Alberto Faria
Convert uses of bdrv_pwrite_sync() into bdrv_co_pwrite_sync() when the callers are already coroutine_fn. Signed-off-by: Alberto Faria Reviewed-by: Vladimir Sementsov-Ogievskiy --- block/parallels.c | 2 +- block/qcow2-snapshot.c | 6 +++--- block/qcow2.c | 4 ++-- 3 files

[PATCH v4 07/10] block: Implement bdrv_{pread, pwrite, pwrite_zeroes}() using generated_co_wrapper

2022-06-09 Thread Alberto Faria
bdrv_{pread,pwrite}() now return -EIO instead of -EINVAL when 'bytes' is negative, making them consistent with bdrv_{preadv,pwritev}() and bdrv_co_{pread,pwrite,preadv,pwritev}(). bdrv_pwrite_zeroes() now also calls trace_bdrv_co_pwrite_zeroes() and clears the BDRV_REQ_MAY_UNMAP flag when

Re: [PATCH v5 14/45] block/snapshot: drop indirection around bdrv_snapshot_fallback_ptr

2022-06-09 Thread Vladimir Sementsov-Ogievskiy
On 6/7/22 18:58, Hanna Reitz wrote: On 30.03.22 23:28, Vladimir Sementsov-Ogievskiy wrote: Now the indirection is not actually used, we can safely reduce it to simple pointer. Signed-off-by: Vladimir Sementsov-Ogievskiy ---   block/snapshot.c | 39 +--   1

[PATCH v4 02/10] block: Change bdrv_{pread, pwrite, pwrite_sync}() param order

2022-06-09 Thread Alberto Faria
Swap 'buf' and 'bytes' around for consistency with bdrv_co_{pread,pwrite}(), and in preparation to implement these functions using generated_co_wrapper. Callers were updated using this Coccinelle script: @@ expression child, offset, buf, bytes, flags; @@ - bdrv_pread(child, offset, buf,

[PATCH v5 06/10] block: Make 'bytes' param of bdrv_co_{pread, pwrite, preadv, pwritev}() an int64_t

2022-06-09 Thread Alberto Faria
For consistency with other I/O functions, and in preparation to implement bdrv_{pread,pwrite}() using generated_co_wrapper. unsigned int fits in int64_t, so all callers remain correct. bdrv_check_request32() is called further down the stack and causes -EIO to be returned if 'bytes' is negative

[PATCH 4/8] virtio: categorize callbacks in GS

2022-06-09 Thread Emanuele Giuseppe Esposito
All the callbacks below are always running in the main loop. The callbacks are the following: - start/stop_ioeventfd: these are the callbacks where blk_set_aio_context(iothread) is done, so they are called in the main loop. - save and load: called during migration, when VM is stopped from

[PATCH 2/8] block-backend: enable_write_cache should be atomic

2022-06-09 Thread Emanuele Giuseppe Esposito
It is read from IO_CODE and written with BQL held, so setting it as atomic should be enough. Also remove the aiocontext lock that was sporadically taken around the set. Signed-off-by: Emanuele Giuseppe Esposito --- block/block-backend.c | 6 +++--- hw/block/virtio-blk.c | 4 2 files

[PATCH v5 03/10] block: Make bdrv_{pread, pwrite}() return 0 on success

2022-06-09 Thread Alberto Faria
They currently return the value of their 'bytes' parameter on success. Make them return 0 instead, for consistency with other I/O functions and in preparation to implement them using generated_co_wrapper. This also makes it clear that short reads/writes are not possible. The few callers that

[PATCH 3/8] virtio_blk_process_queued_requests: always run in a bh

2022-06-09 Thread Emanuele Giuseppe Esposito
This function in virtio_blk_data_plane_start is directly invoked, accessing the queued requests from the main loop, while the device has already switched to the iothread context. The only place where calling virtio_blk_process_queued_requests from the main loop is allowed is when

[PATCH v5 01/10] block: Add a 'flags' param to bdrv_{pread, pwrite, pwrite_sync}()

2022-06-09 Thread Alberto Faria
For consistency with other I/O functions, and in preparation to implement them using generated_co_wrapper. Callers were updated using this Coccinelle script: @@ expression child, offset, buf, bytes; @@ - bdrv_pread(child, offset, buf, bytes) + bdrv_pread(child, offset, buf, bytes, 0)

Re: [PATCH v4 0/7] copy-before-write: on-cbw-error and cbw-timeout

2022-06-09 Thread Vladimir Sementsov-Ogievskiy
On 5/26/22 21:51, Vladimir Sementsov-Ogievskiy wrote: On 5/26/22 19:46, Vladimir Sementsov-Ogievskiy wrote: On 4/7/22 16:27, Vladimir Sementsov-Ogievskiy wrote: Hi all! v4: Now based on master 01: add assertion and r-b 02: s/7.0/7.1/ and r-b 03: switch to QEMUMachine, touch-up pylintrc,  drop

[PATCH v4 08/10] block: Add bdrv_co_pwrite_sync()

2022-06-09 Thread Alberto Faria
Also convert bdrv_pwrite_sync() to being implemented using generated_co_wrapper. Signed-off-by: Alberto Faria Reviewed-by: Eric Blake --- block/io.c | 9 + include/block/block-io.h | 8 ++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/block/io.c

[PATCH v4 01/10] block: Add a 'flags' param to bdrv_{pread, pwrite, pwrite_sync}()

2022-06-09 Thread Alberto Faria
For consistency with other I/O functions, and in preparation to implement them using generated_co_wrapper. Callers were updated using this Coccinelle script: @@ expression child, offset, buf, bytes; @@ - bdrv_pread(child, offset, buf, bytes) + bdrv_pread(child, offset, buf, bytes, 0)

[PULL 3/3] include/hw/ide: Unexport pci_piix3_xen_ide_unplug()

2022-06-09 Thread Anthony PERARD via
From: Bernhard Beschow This function was declared in a generic and public header, implemented in a device-specific source file but only used in xen_platform. Given its 'aux' parameter, this function is more xen-specific than piix-specific. Also, the hardcoded magic constants seem to be generic

[PULL 1/3] hw/ide/piix: Remove redundant "piix3-ide-xen" device class

2022-06-09 Thread Anthony PERARD via
From: Bernhard Beschow Commit 0f8445820f11a69154309863960328dda3dc1ad4 'xen: piix reuse pci generic class init function' already resolved redundant code which in turn rendered piix3-ide-xen redundant. Signed-off-by: Bernhard Beschow Reviewed-by: Anthony PERARD Message-Id:

Re: [PATCH v3 07/10] block: Implement bdrv_{pread, pwrite, pwrite_zeroes}() using generated_co_wrapper

2022-06-09 Thread Alberto Faria
On Wed, Jun 8, 2022 at 1:50 PM Stefan Hajnoczi wrote: > Yes, that's fine. My main concern is that callers have been audited when > errnos are changed. If you switch bdrv_{pread,pwrite}() to -EIO and have > audited callers, then I'm happy. > > Consistent -EINVAL would be nice in the future, but I

[PATCH 6/8] virtio-blk: mark IO_CODE functions

2022-06-09 Thread Emanuele Giuseppe Esposito
Just as done in the block API, mark functions in virtio-blk that are called also from iothread(s). We know such functions are IO because many are blk_* callbacks, running always in the device iothread, and remaining are propagated from the leaf IO functions (if a function calls a IO_CODE

[PATCH 5/8] virtio-blk: mark GLOBAL_STATE_CODE functions

2022-06-09 Thread Emanuele Giuseppe Esposito
Just as done in the block API, mark functions in virtio-blk that are always called in the main loop with BQL held. We know such functions are GS because they all are callbacks from virtio.c API that has already classified them as GS. Signed-off-by: Emanuele Giuseppe Esposito ---

[PATCH 7/8] VirtIOBlock: protect rq with its own lock

2022-06-09 Thread Emanuele Giuseppe Esposito
s->rq is pointing to the the VirtIOBlockReq list, and this list is read/written in: virtio_blk_reset = main loop, but caller calls ->stop_ioeventfd() and drains, so no iothread runs in parallel virtio_blk_save_device = main loop, but VM is stopped (migration), so iothread has no work on request

[PATCH 1/8] virtio_queue_aio_attach_host_notifier: remove AioContext lock

2022-06-09 Thread Emanuele Giuseppe Esposito
virtio_queue_aio_attach_host_notifier() and virtio_queue_aio_attach_host_notifier_nopoll() run always in the main loop, so there is no need to protect them with AioContext lock. On the other side, virtio_queue_aio_detach_host_notifier() runs in a bh in the iothread context, but it is always

[PATCH 8/8] virtio-blk: remove unnecessary AioContext lock from function already safe

2022-06-09 Thread Emanuele Giuseppe Esposito
AioContext lock was introduced in b9e413dd375 and in this instance it is used to protect these 3 functions: - virtio_blk_handle_rw_error - virtio_blk_req_complete - block_acct_done Now that all three of the above functions are protected with their own locks, we can get rid of the AioContext lock.

[PATCH 0/8] virtio-blk: removal of AioContext lock

2022-06-09 Thread Emanuele Giuseppe Esposito
This serie aims to free virtio-blk (and in the future all virtio devices) from the AioContext lock. First step is to understand which functions are running in the main loop and which are in iothreads. Because many functions in virtio-blk are callbacks called in some other virtio (pci, mmio, bus

[PULL 2/3] hw/ide/piix: Add some documentation to pci_piix3_xen_ide_unplug()

2022-06-09 Thread Anthony PERARD via
From: Bernhard Beschow The comment is based on commit message ae4d2eb273b167dad748ea4249720319240b1ac2 'xen-platform: add missing disk unplug option'. Since it seems to describe design decisions and limitations that still apply it seems worth having. Signed-off-by: Bernhard Beschow

Re: [PATCH v5 04/45] test-bdrv-graph-mod: update test_parallel_perm_update test case

2022-06-09 Thread Vladimir Sementsov-Ogievskiy
On 6/7/22 13:53, Hanna Reitz wrote: On 30.03.22 23:28, Vladimir Sementsov-Ogievskiy wrote: test_parallel_perm_update() does two things that we are going to restrict in the near future: 1. It updates bs->file field by hand. bs->file will be managed     automatically by generic code (together

[PATCH 0/2] AioContext removal: LinuxAioState and ThreadPool

2022-06-09 Thread Emanuele Giuseppe Esposito
Just remove some AioContext lock in LinuxAioState and ThreadPool. Not related to anything specific, so I decided to send it as a separate patch. These patches are taken from Paolo's old draft series. Emanuele Giuseppe Esposito (1): thread-pool: use ThreadPool from the running thread Paolo

[PATCH 2/2] thread-pool: use ThreadPool from the running thread

2022-06-09 Thread Emanuele Giuseppe Esposito
Remove usage of aio_context_acquire by always submitting work items to the current thread's ThreadPool. Signed-off-by: Paolo Bonzini Signed-off-by: Emanuele Giuseppe Esposito --- block/file-posix.c| 19 +-- block/file-win32.c| 2 +- block/qcow2-threads.c | 2 +-

[PATCH 1/2] linux-aio: use LinuxAioState from the running thread

2022-06-09 Thread Emanuele Giuseppe Esposito
From: Paolo Bonzini Remove usage of aio_context_acquire by always submitting asynchronous AIO to the current thread's LinuxAioState. Signed-off-by: Paolo Bonzini Signed-off-by: Emanuele Giuseppe Esposito --- block/file-posix.c | 3 ++- block/linux-aio.c | 13 ++---

Re: [PATCH v5 13/45] block: Manipulate bs->file / bs->backing pointers in .attach/.detach

2022-06-09 Thread Vladimir Sementsov-Ogievskiy
On 6/7/22 18:55, Hanna Reitz wrote: On 30.03.22 23:28, Vladimir Sementsov-Ogievskiy wrote: bs->file and bs->backing are a kind of duplication of part of bs->children. But very useful diplication, so let's not drop them at all:) We should manage bs->file and bs->backing in same place, where we

[PATCH] qsd: Do not use error_report() before monitor_init

2022-06-09 Thread Hanna Reitz
error_report() only works once monitor_init_globals_core() has been called, which is not the case when parsing the --daemonize option. Use fprintf(stderr, ...) instead. Fixes: 2525edd85fec53e23fda98974a15e3b3c8957596 ("qsd: Add --daemonize") Signed-off-by: Hanna Reitz ---

[PATCH 3/3] vl: Unlink absolute PID file path

2022-06-09 Thread Hanna Reitz
After writing the PID file, we register an exit notifier to unlink it when the process terminates. However, if the process has changed its working directory in the meantime (e.g. in os_setup_post() when daemonizing), this will not work when the PID file path was relative. Therefore, pass the

[PATCH 1/3] qsd: Unlink absolute PID file path

2022-06-09 Thread Hanna Reitz
After writing the PID file, we register an atexit() handler to unlink it when the process terminates. However, if the process has changed its working directory in the meantime (e.g. in os_setup_post() when daemonizing), this will not work when the PID file path was relative. Therefore, pass the

[PATCH 0/3] qemu/qsd: Unlink absolute PID file path

2022-06-09 Thread Hanna Reitz
Hi, QEMU (the system emulator) and the storage daemon (QSD) write their PID to the given file when you specify --pidfile. They keep the path around and register exit handlers (QEMU uses an exit notifier, QSD an atexit() function) to unlink this file when the process terminates. These handlers

Re: [PATCH 07/20] migration: rename qemu_update_position to qemu_file_credit_transfer

2022-06-09 Thread Dr. David Alan Gilbert
* Daniel P. Berrangé (berra...@redhat.com) wrote: > On Thu, Jun 09, 2022 at 01:56:00PM +0100, Peter Maydell wrote: > > On Tue, 24 May 2022 at 12:46, Daniel P. Berrangé > > wrote: > > > > > > The qemu_update_position method name gives the misleading impression > > > that it is changing the

Re: [PATCH 07/20] migration: rename qemu_update_position to qemu_file_credit_transfer

2022-06-09 Thread Daniel P . Berrangé
On Thu, Jun 09, 2022 at 01:56:00PM +0100, Peter Maydell wrote: > On Tue, 24 May 2022 at 12:46, Daniel P. Berrangé wrote: > > > > The qemu_update_position method name gives the misleading impression > > that it is changing the current file offset. Most of the files are > > just streams, however,

Re: [PATCH 07/20] migration: rename qemu_update_position to qemu_file_credit_transfer

2022-06-09 Thread Peter Maydell
On Tue, 24 May 2022 at 12:46, Daniel P. Berrangé wrote: > > The qemu_update_position method name gives the misleading impression > that it is changing the current file offset. Most of the files are > just streams, however, so there's no concept of a file offset in the > general case. > > What

[PATCH 2/3] vl: Conditionally register PID file unlink notifier

2022-06-09 Thread Hanna Reitz
Currently, the exit notifier for unlinking the PID file is registered unconditionally. Limit it to only when we actually do create a PID file. Signed-off-by: Hanna Reitz --- softmmu/vl.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/softmmu/vl.c

Re: [PATCH v2 1/2] hw: m25p80: add WP# pin and SRWD bit for write protection

2022-06-09 Thread Cédric Le Goater
On 6/9/22 05:13, Iris Chen wrote: From: Iris Chen Signed-off-by: Iris Chen --- Addressed all comments from V1. The biggest change: removed object_class_property_add. Reviewed-by: Cédric Le Goater Thanks, C. hw/block/m25p80.c | 37 +++

[PATCH] main loop: add missing documentation links to GS/IO macros

2022-06-09 Thread Emanuele Giuseppe Esposito
If we go directly to GLOBAL_STATE_CODE, IO_CODE or IO_OR_GS_CODE definition, we just find that they "mark and check that the function is part of the {category} API". However, ther is no definition on what {category} API is, they are in include/block/block-*.h Therefore, add a comment that refers

Re: [PATCH 07/20] migration: rename qemu_update_position to qemu_file_credit_transfer

2022-06-09 Thread Dr. David Alan Gilbert
* Daniel P. Berrangé (berra...@redhat.com) wrote: > The qemu_update_position method name gives the misleading impression > that it is changing the current file offset. Most of the files are > just streams, however, so there's no concept of a file offset in the > general case. > > What this method

  1   2   >