[PULL 09/21] cutils: Adjust signature of parse_uint[_full]

2023-06-01 Thread Eric Blake
It's already confusing that we have two very similar functions for wrapping the parse of a 64-bit unsigned value, differing mainly on whether they permit leading '-'. Adjust the signature of parse_uint() and parse_uint_full() to be like all of qemu_strto*(): put the result parameter last, use the

[PULL 19/21] cutils: Use parse_uint in qemu_strtosz for negative rejection

2023-06-01 Thread Eric Blake
Rather than open-coding two different ways to check for an unwanted negative sign, reuse the same code in both functions. That way, if we decide down the road to accept "-0" instead of rejecting it, we have fewer places to change. Also, it means we now get ERANGE instead of EINVAL for negative

[PULL 01/21] iotests: Fix test 104 under NBD

2023-06-01 Thread Eric Blake
In the past, commit a231cb27 ("iotests: Fix 104 for NBD", v2.3.0) added an additional filter to _filter_img_info to rewrite NBD URIs into the expected output form. This recently broke when we tweaked tests to run in a per-format directory, which did not match the regex, because _img_info itself

[PULL 02/21] qcow2: Explicit mention of padding bytes

2023-06-01 Thread Eric Blake
Although we already covered the need for padding bytes with our changes in commit 3ae3fcfa, commit 66fcbca5 (both v5.0.0) added one byte and relied on the rest of the text for implicitly covering 7 padding bytes. For consistency with other parts of the header (such as the header extension format

Re: [PATCH v3 19/19] cutils: Improve qemu_strtosz handling of fractions

2023-06-01 Thread Eric Blake
On Mon, May 22, 2023 at 02:04:41PM -0500, Eric Blake wrote: > We have several limitations and bugs worth fixing; they are > inter-related enough that it is not worth splitting this patch into > smaller pieces: > > +++ b/util/cutils.c > @@ -194,15 +194,18 @@ static int64_t suffix_mul(char suffix,

Re: [PATCH v3 00/19] Fix qemu_strtosz() read-out-of-bounds

2023-06-01 Thread Eric Blake
On Mon, May 22, 2023 at 02:04:22PM -0500, Eric Blake wrote: > v2 was here: > https://lists.gnu.org/archive/html/qemu-devel/2023-05/msg02951.html > > Since then: > - fix another qemu_strtoui bug > - address review comments from Hanna This series has been reviewed; I fixed up the last few bits,

Re: [PATCH] qcow2: Explicit mention of padding bytes

2023-06-01 Thread Eric Blake
On Mon, May 22, 2023 at 11:26:03PM +0300, Vladimir Sementsov-Ogievskiy wrote: > On 22.05.23 21:46, Eric Blake wrote: > > Although we already covered the need for padding bytes with our > > changes in commit 3ae3fcfa, commit 66fcbca5 (both v5.0.0) added one > > byte and relied on the rest of the

Re: [PATCH 1/6] qemu-img: rebase: stop when reaching EOF of old backing file

2023-06-01 Thread Michael Tokarev
01.06.2023 22:28, Andrey Drobyshev via пишет: In case when we're rebasing within one backing chain, and when target image is larger than old backing file, bdrv_is_allocated_above() ends up setting *pnum = 0. As a result, target offset isn't getting incremented, and we get stuck in an infinite

Re: [PATCH v2 0/2] qemu-img: fix getting stuck in infinite loop on in-chain rebase

2023-06-01 Thread Andrey Drobyshev
On 5/25/23 21:02, Andrey Drobyshev wrote: > v1 -> v2: > > * Avoid breaking the loop just yet, as the offsets beyond the old > backing size need to be explicitly zeroed; > * Amend the commit message accordingly; > * Alter the added test case to take the last zeroed cluster into >

Re: [PATCH v3 1/3] hw/i2c: add smbus pec utility function

2023-06-01 Thread Philippe Mathieu-Daudé
On 31/5/23 13:47, Klaus Jensen wrote: From: Klaus Jensen Add i2c_smbus_pec() to calculate the SMBus Packet Error Code for a message. Signed-off-by: Klaus Jensen --- hw/i2c/smbus_master.c | 28 include/hw/i2c/smbus_master.h | 2 ++ 2 files changed, 30

Re: [PATCH v3 0/3] hw/{i2c, nvme}: mctp endpoint, nvme management interface model

2023-06-01 Thread Corey Minyard
On Wed, May 31, 2023 at 01:47:41PM +0200, Klaus Jensen wrote: > From: Klaus Jensen > > This adds a generic MCTP endpoint model that other devices may derive > from. I'm not 100% happy with the design of the class methods, but it's > a start. > > Also included is a very basic implementation of

[PATCH 0/6] qemu-img: rebase: add compression support

2023-06-01 Thread Andrey Drobyshev via
This series is adding [-c | --compress] option to "qemu-img rebase" command, which might prove useful for saving some disk space when, for instance, manipulating chains of backup images. Along the way I had to make a couple of minor improvements. The first 2 patches are a bug fix + corresponding

[PATCH 1/6] qemu-img: rebase: stop when reaching EOF of old backing file

2023-06-01 Thread Andrey Drobyshev via
In case when we're rebasing within one backing chain, and when target image is larger than old backing file, bdrv_is_allocated_above() ends up setting *pnum = 0. As a result, target offset isn't getting incremented, and we get stuck in an infinite for loop. Let's detect this case and proceed

[PATCH 2/6] qemu-iotests: 024: add rebasing test case for overlay_size > backing_size

2023-06-01 Thread Andrey Drobyshev via
Before previous commit, rebase was getting infitely stuck in case of rebasing within the same backing chain and when overlay_size > backing_size. Let's add this case to the rebasing test 024 to make sure it doesn't break again. Signed-off-by: Andrey Drobyshev --- tests/qemu-iotests/024 | 57

[PATCH 5/6] qemu-img: add compression option to rebase subcommand

2023-06-01 Thread Andrey Drobyshev via
If we rebase an image whose backing file has compressed clusters, we might end up wasting disk space since the copied clusters are now uncompressed. In order to have better control over this, let's add "--compress" option to the "qemu-img rebase" command. Note that this option affects only the

[PATCH 6/6] iotests: add test 314 for "qemu-img rebase" with compression

2023-06-01 Thread Andrey Drobyshev via
The test cases considered so far: 1. Check that compression mode isn't compatible with "-f raw" (raw format doesn't support compression). 2. Check that rebasing an image onto no backing file preserves the data and writes the copied clusters actually compressed. 3. Same as 2, but with a raw

[PATCH 3/6] qemu-img: rebase: use backing files' BlockBackend for buffer alignment

2023-06-01 Thread Andrey Drobyshev via
Since commit bb1c05973cf ("qemu-img: Use qemu_blockalign"), buffers for the data read from the old and new backing files are aligned using BlockDriverState (or BlockBackend later on) referring to the target image. However, this isn't quite right, because target image is only being written to and

[PATCH 4/6] qemu-img: rebase: avoid unnecessary COW operations

2023-06-01 Thread Andrey Drobyshev via
When rebasing an image from one backing file to another, we need to compare data from old and new backings. If the diff between that data happens to be unaligned to the target cluster size, we might end up doing partial writes, which would lead to copy-on-write and additional IO. Consider the

Re: [PATCH v2 0/8] misc AHCI cleanups

2023-06-01 Thread John Snow
On Thu, Jun 1, 2023 at 9:45 AM Niklas Cassel wrote: > > From: Niklas Cassel > > Hello John, > > Here comes some misc AHCI cleanups. > > Most are related to error handling. > > Please review. > > (I'm also working on a second series which will add support for > READ LOG EXT and READ LOG DMA EXT,

Re: [PATCH 02/11] qdev-properties-system: Lock AioContext for blk_insert_bs()

2023-06-01 Thread Kevin Wolf
Am 31.05.2023 um 13:02 hat Kevin Wolf geschrieben: > blk_insert_bs() requires that callers hold the AioContext lock for the > node that should be inserted. Take it. > > Signed-off-by: Kevin Wolf > --- > hw/core/qdev-properties-system.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git

[PULL 7/8] block/blkio: use qemu_open() to support fd passing for virtio-blk

2023-06-01 Thread Stefan Hajnoczi
From: Stefano Garzarella Some virtio-blk drivers (e.g. virtio-blk-vhost-vdpa) supports the fd passing. Let's expose this to the user, so the management layer can pass the file descriptor of an already opened path. If the libblkio virtio-blk driver supports fd passing, let's always use

[PULL 6/8] block: remove bdrv_co_io_plug() API

2023-06-01 Thread Stefan Hajnoczi
No block driver implements .bdrv_co_io_plug() anymore. Get rid of the function pointers. Signed-off-by: Stefan Hajnoczi Reviewed-by: Eric Blake Reviewed-by: Stefano Garzarella Acked-by: Kevin Wolf Message-id: 20230530180959.1108766-7-stefa...@redhat.com Signed-off-by: Stefan Hajnoczi ---

[PULL 5/8] block/linux-aio: convert to blk_io_plug_call() API

2023-06-01 Thread Stefan Hajnoczi
Stop using the .bdrv_co_io_plug() API because it is not multi-queue block layer friendly. Use the new blk_io_plug_call() API to batch I/O submission instead. Note that a dev_max_batch check is dropped in laio_io_unplug() because the semantics of unplug_fn() are different from .bdrv_co_unplug():

[PULL 1/8] block: add blk_io_plug_call() API

2023-06-01 Thread Stefan Hajnoczi
Introduce a new API for thread-local blk_io_plug() that does not traverse the block graph. The goal is to make blk_io_plug() multi-queue friendly. Instead of having block drivers track whether or not we're in a plugged section, provide an API that allows them to defer a function call until we're

[PULL 8/8] qapi: add '@fdset' feature for BlockdevOptionsVirtioBlkVhostVdpa

2023-06-01 Thread Stefan Hajnoczi
From: Stefano Garzarella The virtio-blk-vhost-vdpa driver in libblkio 1.3.0 supports the fd passing through the new 'fd' property. Since now we are using qemu_open() on '@path' if the virtio-blk driver supports the fd passing, let's announce it. In this way, the management layer can pass the

[PULL 3/8] block/blkio: convert to blk_io_plug_call() API

2023-06-01 Thread Stefan Hajnoczi
Stop using the .bdrv_co_io_plug() API because it is not multi-queue block layer friendly. Use the new blk_io_plug_call() API to batch I/O submission instead. Signed-off-by: Stefan Hajnoczi Reviewed-by: Eric Blake Reviewed-by: Stefano Garzarella Acked-by: Kevin Wolf Message-id:

[PULL 4/8] block/io_uring: convert to blk_io_plug_call() API

2023-06-01 Thread Stefan Hajnoczi
Stop using the .bdrv_co_io_plug() API because it is not multi-queue block layer friendly. Use the new blk_io_plug_call() API to batch I/O submission instead. Signed-off-by: Stefan Hajnoczi Reviewed-by: Eric Blake Reviewed-by: Stefano Garzarella Acked-by: Kevin Wolf Message-id:

[PULL 0/8] Block patches

2023-06-01 Thread Stefan Hajnoczi
The following changes since commit c6a5fc2ac76c5ab709896ee1b0edd33685a67ed1: decodetree: Add --output-null for meson testing (2023-05-31 19:56:42 -0700) are available in the Git repository at: https://gitlab.com/stefanha/qemu.git tags/block-pull-request for you to fetch changes up to

[PULL 2/8] block/nvme: convert to blk_io_plug_call() API

2023-06-01 Thread Stefan Hajnoczi
Stop using the .bdrv_co_io_plug() API because it is not multi-queue block layer friendly. Use the new blk_io_plug_call() API to batch I/O submission instead. Signed-off-by: Stefan Hajnoczi Reviewed-by: Eric Blake Reviewed-by: Stefano Garzarella Acked-by: Kevin Wolf Message-id:

Re: [PATCH v5 0/2] block/blkio: support fd passing for virtio-blk-vhost-vdpa driver

2023-06-01 Thread Stefan Hajnoczi
On Tue, May 30, 2023 at 09:19:39AM +0200, Stefano Garzarella wrote: > v5: > - moved `features` to the object level to simplify libvirt code [Jonathon] > - wrapped a line too long in the documentation [Markus] > - added Stefan R-b tags > > v4: >

Re: [PATCH 0/2] bulk: Remove pointless QOM casts

2023-06-01 Thread Richard Henderson
On 6/1/23 02:34, Philippe Mathieu-Daudé wrote: As per Markus suggestion in [*], use Coccinelle to remove pointless QOM cast macro uses. Since we have more than 1000 QOM types, add a script to generate the semantic patch. [*]https://lore.kernel.org/qemu-devel/87mt1jafjt@pond.sub.org/

Re: [PATCH 01/12] file-posix: remove incorrect coroutine_fn calls

2023-06-01 Thread Paolo Bonzini
Il gio 1 giu 2023, 15:50 Eric Blake ha scritto: > > @@ -2696,7 +2696,7 @@ static int coroutine_fn > raw_co_truncate(BlockDriverState *bs, int64_t offset, > > } > > > > if (S_ISCHR(st.st_mode) || S_ISBLK(st.st_mode)) { > > -int64_t cur_length = raw_co_getlength(bs); > > +

Re: [Libguestfs] [libnbd PATCH v3 05/22] states: Prepare to receive 64-bit replies

2023-06-01 Thread Laszlo Ersek
On 6/1/23 15:00, Eric Blake wrote: > On Thu, Jun 01, 2023 at 11:04:05AM +0200, Laszlo Ersek wrote: >> Probably best to reorder the files in this patch for review: > > I see what you mean: because of the state hierarchy, it is probably > worth tweaking the git orderfile to favor files nearer the

Re: [PATCH 0/9] misc AHCI cleanups

2023-06-01 Thread Niklas Cassel
On Wed, May 17, 2023 at 01:06:06PM -0400, John Snow wrote: > On Fri, Apr 28, 2023 at 9:22 AM Niklas Cassel wrote: > > > > From: Niklas Cassel > > > > Hello John, > > > > Hi Niklas! > > I haven't been actively involved with AHCI for a while, so I am not > sure I can find the time to give this a

Re: [PATCH 01/12] file-posix: remove incorrect coroutine_fn calls

2023-06-01 Thread Eric Blake
On Thu, Jun 01, 2023 at 01:51:34PM +0200, Paolo Bonzini wrote: > raw_co_getlength is called by handle_aiocb_write_zeroes, which is not a > coroutine > function. This is harmless because raw_co_getlength does not actually > suspend, > but in the interest of clarity make it a non-coroutine_fn

[PATCH v2 8/8] hw/ide/ahci: fix broken SError handling

2023-06-01 Thread Niklas Cassel
From: Niklas Cassel When encountering an NCQ error, you should not write the NCQ tag to the SError register. This is completely wrong. The SError register has a clear definition, where each bit represents a different error, see PxSERR definition in AHCI 1.3.1. If we write a random value (like

[PATCH v2 7/8] hw/ide/ahci: fix ahci_write_fis_sdb()

2023-06-01 Thread Niklas Cassel
From: Niklas Cassel When there is an error, we need to raise a TFES error irq, see AHCI 1.3.1, 5.3.13.1 SDB:Entry. If ERR_STAT is set, we jump to state ERR:FatalTaskfile, which will raise a TFES IRQ unconditionally, regardless if the I bit is set in the FIS or not. Thus, we should never raise

[PATCH v2 4/8] hw/ide/ahci: simplify and document PxCI handling

2023-06-01 Thread Niklas Cassel
From: Niklas Cassel The AHCI spec states that: For NCQ, PxCI is cleared on command queued successfully. For non-NCQ, PxCI is cleared on command completed successfully. (A non-NCQ command that completes with error does not clear PxCI.) The current QEMU implementation either clears PxCI in

[PATCH v2 6/8] hw/ide/ahci: PxSACT and PxCI is cleared when PxCMD.ST is cleared

2023-06-01 Thread Niklas Cassel
From: Niklas Cassel According to AHCI 1.3.1 definition of PxSACT: This field is cleared when PxCMD.ST is written from a '1' to a '0' by software. This field is not cleared by a COMRESET or a software reset. According to AHCI 1.3.1 definition of PxCI: This field is also cleared when PxCMD.ST is

[PATCH v2 5/8] hw/ide/ahci: PxCI should not get cleared when ERR_STAT is set

2023-06-01 Thread Niklas Cassel
From: Niklas Cassel For NCQ, PxCI is cleared on command queued successfully. For non-NCQ, PxCI is cleared on command completed successfully. Successfully means ERR_STAT, BUSY and DRQ are all cleared. A command that has ERR_STAT set, does not get to clear PxCI. See AHCI 1.3.1, section 5.3.8,

[PATCH v2 3/8] hw/ide/ahci: write D2H FIS on when processing NCQ command

2023-06-01 Thread Niklas Cassel
From: Niklas Cassel The way that BUSY + PxCI is cleared for NCQ (FPDMA QUEUED) commands is described in SATA 3.5a Gold: 11.15 FPDMA QUEUED command protocol DFPDMAQ2: ClearInterfaceBsy "Transmit Register Device to Host FIS with the BSY bit cleared to zero and the DRQ bit cleared to zero and

[PATCH v2 2/8] hw/ide/core: set ERR_STAT in unsupported command completion

2023-06-01 Thread Niklas Cassel
From: Niklas Cassel Currently, the first time sending an unsupported command (e.g. READ LOG DMA EXT) will not have ERR_STAT set in the completion. Sending the unsupported command again, will correctly have ERR_STAT set. When ide_cmd_permitted() returns false, it calls ide_abort_command().

[PATCH v2 1/8] hw/ide/ahci: remove stray backslash

2023-06-01 Thread Niklas Cassel
From: Niklas Cassel This backslash obviously does not belong here, so remove it. Signed-off-by: Niklas Cassel Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: John Snow --- hw/ide/ahci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c index

[PATCH v2 0/8] misc AHCI cleanups

2023-06-01 Thread Niklas Cassel
From: Niklas Cassel Hello John, Here comes some misc AHCI cleanups. Most are related to error handling. Please review. (I'm also working on a second series which will add support for READ LOG EXT and READ LOG DMA EXT, but I will send that one out once it is ready. (It might take a couple of

Re: [PATCH v2 0/3] block: remove separate bdrv_file_open callback

2023-06-01 Thread Eric Blake
On Thu, Jun 01, 2023 at 01:51:36PM +0200, Paolo Bonzini wrote: > The value of the bdrv_file_open is sometimes checked to distinguish > protocol and format drivers, but apart from that there is no difference > between bdrv_file_open and bdrv_open. > > However, they can all be distinguished by the

Re: [Libguestfs] [libnbd PATCH v3 06/22] states: Break deadlock if server goofs on extended replies

2023-06-01 Thread Laszlo Ersek
On 5/25/23 15:00, Eric Blake wrote: > One of the benefits of extended replies is that we can do a > fixed-length read for the entire header of every server reply, which > is fewer syscalls than the split-read approach required by structured > replies. (Totally tangential comment: recvmsg() could

Re: [PATCH v2 2/4] block: complete public block status API

2023-06-01 Thread Eric Blake
On Thu, Jun 01, 2023 at 01:51:29PM +0200, Paolo Bonzini wrote: > Include both coroutine and non-coroutine versions, the latter being > co_wrapper_mixed_bdrv_rdlock of the former. > > Reviewed-by: Eric Blake > Signed-off-by: Paolo Bonzini > --- > block/io.c | 18 +-

Re: [PATCH v2 1/4] block: rename the bdrv_co_block_status static function

2023-06-01 Thread Eric Blake
On Thu, Jun 01, 2023 at 01:51:28PM +0200, Paolo Bonzini wrote: > bdrv_block_status exists as a wrapper for bdrv_block_status_above, > but the name of the (hypothetical) coroutine version, bdrv_co_block_status, > is squatted by a random static function. Rename it to bdrv_do_block_status.

Re: [PATCH 2/9] hw/ide/core: set ERR_STAT in unsupported command completion

2023-06-01 Thread Niklas Cassel
On Wed, May 17, 2023 at 05:12:57PM -0400, John Snow wrote: > On Fri, Apr 28, 2023 at 9:22 AM Niklas Cassel wrote: > > > > From: Niklas Cassel > > > > Currently, the first time sending an unsupported command > > (e.g. READ LOG DMA EXT) will not have ERR_STAT set in the completion. > > Sending the

Re: [PATCH v3 0/6] block: add blk_io_plug_call() API

2023-06-01 Thread Stefan Hajnoczi
On Tue, May 30, 2023 at 02:09:53PM -0400, Stefan Hajnoczi wrote: > v3 > - Patch 5: Mention why dev_max_batch condition was dropped [Stefano] > v2 > - Patch 1: "is not be freed" -> "is not freed" [Eric] > - Patch 2: Remove unused nvme_process_completion_queue_plugged trace event > [Stefano] > -

Re: [Libguestfs] [libnbd PATCH v3 05/22] states: Prepare to receive 64-bit replies

2023-06-01 Thread Eric Blake
On Thu, Jun 01, 2023 at 11:04:05AM +0200, Laszlo Ersek wrote: > On 5/25/23 15:00, Eric Blake wrote: > > Support receiving headers for 64-bit replies if extended headers were > > negotiated. We already insist that the server not send us too much > > payload in one reply, so we can exploit that and

Re: [PATCH v3 7/7] hw/ide/piix: Move registration of VMStateDescription to DeviceClass

2023-06-01 Thread Mark Cave-Ayland
On 31/05/2023 22:10, Bernhard Beschow wrote: The modern, declarative way to set up VM state handling is to assign to DeviceClass::vmsd attribute. There shouldn't be any change in behavior since dc->vmsd causes vmstate_register_with_alias_id() to be called on the instance during the instance

Re: [PATCH v3 6/7] hw/ide/pci: Replace some magic numbers by constants

2023-06-01 Thread Mark Cave-Ayland
On 31/05/2023 22:10, Bernhard Beschow wrote: Signed-off-by: Bernhard Beschow --- hw/ide/pci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/ide/pci.c b/hw/ide/pci.c index 0b26a4ce9f..a25b352537 100644 --- a/hw/ide/pci.c +++ b/hw/ide/pci.c @@ -320,7 +320,8 @@ void

[PATCH 09/12] vhdx: mark more functions as coroutine_fns and GRAPH_RDLOCK

2023-06-01 Thread Paolo Bonzini
Mark functions as coroutine_fn when they are only called by other coroutine_fns and they can suspend. Change calls to co_wrappers to use the non-wrapped functions, which in turn requires adding GRAPH_RDLOCK annotations. Signed-off-by: Paolo Bonzini --- block/vhdx-log.c | 36

[PATCH 12/12] block: use bdrv_co_debug_event in coroutine context

2023-06-01 Thread Paolo Bonzini
bdrv_co_debug_event was recently introduced, with bdrv_debug_event becoming a wrapper for use in unknown context. Because most of the time bdrv_debug_event is used on a BdrvChild via the wrapper macro BLKDBG_EVENT, introduce a similar macro BLKDBG_CO_EVENT that calls bdrv_co_debug_event, and

[PATCH 04/12] bochs: mark more functions as coroutine_fns and GRAPH_RDLOCK

2023-06-01 Thread Paolo Bonzini
Mark functions as coroutine_fn when they are only called by other coroutine_fns and they can suspend. Change calls to co_wrappers to use the non-wrapped functions, which in turn requires adding GRAPH_RDLOCK annotations. Signed-off-by: Paolo Bonzini --- block/bochs.c | 7 --- 1 file

[PATCH 08/12] vmdk: mark more functions as coroutine_fns and GRAPH_RDLOCK

2023-06-01 Thread Paolo Bonzini
Mark functions as coroutine_fn when they are only called by other coroutine_fns and they can suspend. Change calls to co_wrappers to use the non-wrapped functions, which in turn requires adding GRAPH_RDLOCK annotations. Signed-off-by: Paolo Bonzini --- block/vmdk.c | 27

[PATCH 10/12] qcow2: mark more functions as coroutine_fns and GRAPH_RDLOCK

2023-06-01 Thread Paolo Bonzini
Mark functions as coroutine_fn when they are only called by other coroutine_fns and they can suspend. Change calls to co_wrappers to use the non-wrapped functions, which in turn requires adding GRAPH_RDLOCK annotations. Signed-off-by: Paolo Bonzini --- block/qcow2-bitmap.c | 26 +

[PATCH 05/12] block: mark another function as coroutine_fns and GRAPH_UNLOCKED

2023-06-01 Thread Paolo Bonzini
Mark functions as coroutine_fn when they are only called by other coroutine_fns and they can suspend. Because this function operates on a BlockBackend, mark it GRAPH_UNLOCKED. Signed-off-by: Paolo Bonzini --- block.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git

[PATCH 07/12] dmg: mark more functions as coroutine_fns and GRAPH_RDLOCK

2023-06-01 Thread Paolo Bonzini
Mark functions as coroutine_fn when they are only called by other coroutine_fns and they can suspend. Change calls to co_wrappers to use the non-wrapped functions, which in turn requires adding GRAPH_RDLOCK annotations. Signed-off-by: Paolo Bonzini --- block/dmg.c | 21 +++-- 1

[PATCH 03/12] vpc: mark more functions as coroutine_fns and GRAPH_RDLOCK

2023-06-01 Thread Paolo Bonzini
Mark functions as coroutine_fn when they are only called by other coroutine_fns and they can suspend. Change calls to co_wrappers to use the non-wrapped functions, which in turn requires adding GRAPH_RDLOCK annotations. Signed-off-by: Paolo Bonzini --- block/vpc.c | 52

[PATCH v2 2/4] block: complete public block status API

2023-06-01 Thread Paolo Bonzini
Include both coroutine and non-coroutine versions, the latter being co_wrapper_mixed_bdrv_rdlock of the former. Reviewed-by: Eric Blake Signed-off-by: Paolo Bonzini --- block/io.c | 18 +- include/block/block-io.h | 18 -- 2 files changed, 17

[PATCH v2 3/4] block: switch to co_wrapper for bdrv_is_allocated_*

2023-06-01 Thread Paolo Bonzini
Reviewed-by: Eric Blake Signed-off-by: Paolo Bonzini --- block/io.c | 53 ++-- include/block/block-io.h | 12 + 2 files changed, 14 insertions(+), 51 deletions(-) diff --git a/block/io.c b/block/io.c index 806715a5bbe3..2fae64ad1eb6

[PATCH v2 4/4] block: convert more bdrv_is_allocated* and bdrv_block_status* calls to coroutine versions

2023-06-01 Thread Paolo Bonzini
Reviewed-by: Eric Blake Signed-off-by: Paolo Bonzini --- block/copy-before-write.c | 2 +- block/copy-on-read.c | 8 block/io.c| 6 +++--- block/mirror.c| 10 +- block/qcow2.c | 5 +++-- block/replication.c | 8

[PATCH 11/12] block: use bdrv_co_getlength in coroutine context

2023-06-01 Thread Paolo Bonzini
bdrv_co_getlength was recently introduced, with bdrv_getlength becoming a wrapper for use in unknown context. Switch to bdrv_co_getlength when possible. Signed-off-by: Paolo Bonzini --- block/io.c| 10 +- block/parallels.c | 4 ++-- block/qcow.c | 6 +++--- block/vmdk.c

[PATCH 00/12] block: more fixes to coroutine_fn marking

2023-06-01 Thread Paolo Bonzini
*** BLURB HERE *** Paolo Bonzini (12): file-posix: remove incorrect coroutine_fn calls qed: mark more functions as coroutine_fns and GRAPH_RDLOCK vpc: mark more functions as coroutine_fns and GRAPH_RDLOCK bochs: mark more functions as coroutine_fns and GRAPH_RDLOCK block: mark another

[PATCH v2 0/3] block: remove separate bdrv_file_open callback

2023-06-01 Thread Paolo Bonzini
The value of the bdrv_file_open is sometimes checked to distinguish protocol and format drivers, but apart from that there is no difference between bdrv_file_open and bdrv_open. However, they can all be distinguished by the non-NULL .protocol_name member. Change the checks to use .protocol_name

[PATCH 06/12] cloop: mark more functions as coroutine_fns and GRAPH_RDLOCK

2023-06-01 Thread Paolo Bonzini
Mark functions as coroutine_fn when they are only called by other coroutine_fns and they can suspend. Change calls to co_wrappers to use the non-wrapped functions, which in turn requires adding GRAPH_RDLOCK annotations. Signed-off-by: Paolo Bonzini --- block/cloop.c | 9 + 1 file

[PATCH v2 3/3] block: remove separate bdrv_file_open callback

2023-06-01 Thread Paolo Bonzini
bdrv_file_open and bdrv_open are completely equivalent, they are never checked except to see which one to invoke. So merge them into a single one. Signed-off-by: Paolo Bonzini --- block.c | 4 +--- block/blkdebug.c | 2 +- block/blkio.c

[PATCH v2 1/3] block: make assertion more generic

2023-06-01 Thread Paolo Bonzini
.bdrv_needs_filename is only set for drivers that also set bdrv_file_open, i.e. protocol drivers. So we can make the assertion always, it will always pass for those drivers that use bdrv_open. Signed-off-by: Paolo Bonzini --- block.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff

[PATCH 02/12] qed: mark more functions as coroutine_fns and GRAPH_RDLOCK

2023-06-01 Thread Paolo Bonzini
Mark functions as coroutine_fn when they are only called by other coroutine_fns and they can suspend. Change calls to co_wrappers to use the non-wrapped functions, which in turn requires adding GRAPH_RDLOCK annotations. Signed-off-by: Paolo Bonzini --- block/qed-check.c | 5 +++-- block/qed.c

[PATCH 01/12] file-posix: remove incorrect coroutine_fn calls

2023-06-01 Thread Paolo Bonzini
raw_co_getlength is called by handle_aiocb_write_zeroes, which is not a coroutine function. This is harmless because raw_co_getlength does not actually suspend, but in the interest of clarity make it a non-coroutine_fn that is just wrapped by the coroutine_fn raw_co_getlength. Likewise,

[PATCH v2 2/3] block: do not check bdrv_file_open

2023-06-01 Thread Paolo Bonzini
The set of BlockDrivers that have .bdrv_file_open coincides with those that have .protocol_name and guess what---checking drv->bdrv_file_open is done to see if the driver is a protocol. So check drv->protocol_name instead. Signed-off-by: Paolo Bonzini --- block.c | 11 +-- 1 file

[PATCH v2 0/4] block: clean up coroutine versions of bdrv_{is_allocated, block_status}*

2023-06-01 Thread Paolo Bonzini
Provide coroutine versions of bdrv_is_allocated* and bdrv_block_status*, since the underlying BlockDriver API is coroutine-based, and use automatically-generated wrappers for the "mixed" versions. Paolo v1->v2: rename the old bdrv_co_block_status to bdrv_co_do_block_status Paolo Bonzini (4):

[PATCH v2 1/4] block: rename the bdrv_co_block_status static function

2023-06-01 Thread Paolo Bonzini
bdrv_block_status exists as a wrapper for bdrv_block_status_above, but the name of the (hypothetical) coroutine version, bdrv_co_block_status, is squatted by a random static function. Rename it to bdrv_do_block_status. Signed-off-by: Paolo Bonzini --- block/io.c | 19 +-- 1

Re: [PATCH v3 13/14] nbd/server: Prepare for per-request filtering of BLOCK_STATUS

2023-06-01 Thread Vladimir Sementsov-Ogievskiy
On 15.05.23 22:53, Eric Blake wrote: The next commit will add support for the new addition of NBD_CMD_FLAG_PAYLOAD during NBD_CMD_BLOCK_STATUS, where the client can request that the server only return a subset of negotiated contexts, rather than all contexts. To make that task easier, this

[PATCH 1/2] scripts: Add qom-cast-macro-clean-cocci-gen.py

2023-06-01 Thread Philippe Mathieu-Daudé
Add a script to generate Coccinelle semantic patch removing all pointless QOM cast macro uses. Suggested-by: Markus Armbruster Signed-off-by: Philippe Mathieu-Daudé --- MAINTAINERS | 1 + scripts/qom-cast-macro-clean-cocci-gen.py | 49 +++ 2

[PATCH 0/2] bulk: Remove pointless QOM casts

2023-06-01 Thread Philippe Mathieu-Daudé
As per Markus suggestion in [*], use Coccinelle to remove pointless QOM cast macro uses. Since we have more than 1000 QOM types, add a script to generate the semantic patch. [*] https://lore.kernel.org/qemu-devel/87mt1jafjt@pond.sub.org/ Philippe Mathieu-Daudé (2): scripts: Add

[PATCH 2/2] bulk: Remove pointless QOM casts

2023-06-01 Thread Philippe Mathieu-Daudé
Mechanical change running Coccinelle spatch with content generated from the qom-cast-macro-clean-cocci-gen.py added in the previous commit. Suggested-by: Markus Armbruster Signed-off-by: Philippe Mathieu-Daudé --- block/nbd.c | 4 ++-- chardev/char-pty.c | 2 +-

Re: [Libguestfs] [libnbd PATCH v3 05/22] states: Prepare to receive 64-bit replies

2023-06-01 Thread Laszlo Ersek
On 5/25/23 15:00, Eric Blake wrote: > Support receiving headers for 64-bit replies if extended headers were > negotiated. We already insist that the server not send us too much > payload in one reply, so we can exploit that and merge the 64-bit > length back into a normalized 32-bit field for the

Re: [PATCH v3 12/14] nbd/client: Request extended headers during negotiation

2023-06-01 Thread Vladimir Sementsov-Ogievskiy
On 31.05.23 23:26, Eric Blake wrote: On Wed, May 31, 2023 at 09:33:20PM +0300, Vladimir Sementsov-Ogievskiy wrote: On 31.05.23 20:54, Eric Blake wrote: On Wed, May 31, 2023 at 08:39:53PM +0300, Vladimir Sementsov-Ogievskiy wrote: On 15.05.23 22:53, Eric Blake wrote: All the pieces are in

Re: [PATCH v3 0/6] block: add blk_io_plug_call() API

2023-06-01 Thread Kevin Wolf
Am 31.05.2023 um 21:50 hat Stefan Hajnoczi geschrieben: > Hi Kevin, > Do you want to review the thread-local blk_io_plug() patch series or > should I merge it? I haven't reviewed it in detail, but on the high level it looks good to me, and you already got reviews for the details. Acked-by: Kevin