Re: [PATCH v2 2/2] hw/pflash: implement update buffer for block writes

2024-01-16 Thread Peter Xu
On Tue, Jan 16, 2024 at 05:08:28PM +0100, Philippe Mathieu-Daudé wrote: > On 12/1/24 17:54, Peter Maydell wrote: > > On Mon, 8 Jan 2024 at 13:06, Philippe Mathieu-Daudé > > wrote: > > > > > > Hi Gerd, > > > > > > On 8/1/24 13:53, Philippe Mathieu-Daudé wrote: > > > > From: Gerd Hoffmann > > >

Re: [PATCH] block/io: clear BDRV_BLOCK_RECURSE flag after recursing in bdrv_co_block_status

2024-01-16 Thread Stefan Hajnoczi
On Tue, Jan 16, 2024 at 04:48:39PM +0100, Fiona Ebner wrote: > Using fleecing backup like in [0] on a qcow2 image (with metadata > preallocation) can lead to the following assertion failure: > > > bdrv_co_do_block_status: Assertion `!(ret & BDRV_BLOCK_ZERO)' failed. > > In the reproducer [0], it

[PATCH 3/3] monitor: only run coroutine commands in qemu_aio_context

2024-01-16 Thread Stefan Hajnoczi
monitor_qmp_dispatcher_co() runs in the iohandler AioContext that is not polled during nested event loops. The coroutine currently reschedules itself in the main loop's qemu_aio_context AioContext, which is polled during nested event loops. One known problem is that QMP device-add calls

[PATCH 2/3] iotests: port 141 to Python for reliable QMP testing

2024-01-16 Thread Stefan Hajnoczi
The common.qemu bash functions allow tests to interact with the QMP monitor of a QEMU process. I spent two days trying to update 141 when the order of the test output changed, but found it would still fail occassionally because printf() and QMP events race with synchronous QMP communication. I

[PATCH 1/3] iotests: add filter_qmp_generated_node_ids()

2024-01-16 Thread Stefan Hajnoczi
Add a filter function for QMP responses that contain QEMU's automatically generated node ids. The ids change between runs and must be masked in the reference output. The next commit will use this new function. Signed-off-by: Stefan Hajnoczi --- tests/qemu-iotests/iotests.py | 7 +++ 1 file

[PATCH 0/3] monitor: only run coroutine commands in qemu_aio_context

2024-01-16 Thread Stefan Hajnoczi
Several bugs have been reported related to how QMP commands are rescheduled in qemu_aio_context: - https://gitlab.com/qemu-project/qemu/-/issues/1933 - https://issues.redhat.com/browse/RHEL-17369 - https://bugzilla.redhat.com/show_bug.cgi?id=2215192 -

Re: [PATCH] string-output-visitor: Fix (pseudo) struct handling

2024-01-16 Thread Stefan Hajnoczi
On Tue, Jan 09, 2024 at 07:17:17PM +0100, Kevin Wolf wrote: > Commit ff32bb53 tried to get minimal struct support into the string > output visitor by just making it return "". Unfortunately, it > forgot that the caller will still make more visitor calls for the > content of the struct. > > If the

Re: [PATCH v2 2/2] hw/pflash: implement update buffer for block writes

2024-01-16 Thread Peter Maydell
On Tue, 16 Jan 2024 at 16:08, Philippe Mathieu-Daudé wrote: > > On 12/1/24 17:54, Peter Maydell wrote: > > On Mon, 8 Jan 2024 at 13:06, Philippe Mathieu-Daudé > > wrote: > >> > >> Hi Gerd, > >> > >> On 8/1/24 13:53, Philippe Mathieu-Daudé wrote: > >>> From: Gerd Hoffmann > >>> > >>> Add an

Re: [PATCH v2 2/2] hw/pflash: implement update buffer for block writes

2024-01-16 Thread Philippe Mathieu-Daudé
On 12/1/24 17:54, Peter Maydell wrote: On Mon, 8 Jan 2024 at 13:06, Philippe Mathieu-Daudé wrote: Hi Gerd, On 8/1/24 13:53, Philippe Mathieu-Daudé wrote: From: Gerd Hoffmann Add an update buffer where all block updates are staged. Flush or discard updates properly, so we should never see

[PATCH] block/io: clear BDRV_BLOCK_RECURSE flag after recursing in bdrv_co_block_status

2024-01-16 Thread Fiona Ebner
Using fleecing backup like in [0] on a qcow2 image (with metadata preallocation) can lead to the following assertion failure: > bdrv_co_do_block_status: Assertion `!(ret & BDRV_BLOCK_ZERO)' failed. In the reproducer [0], it happens because the BDRV_BLOCK_RECURSE flag will be set by the qcow2

Re: [PATCH v4 12/21] parallels: Let image extensions work in RW mode

2024-01-16 Thread Denis V. Lunev
On 12/28/23 11:12, Alexander Ivanov wrote: Now we support extensions saving and can let to work with them in read-write mode. Signed-off-by: Alexander Ivanov --- block/parallels-ext.c | 4 block/parallels.c | 17 - 2 files changed, 4 insertions(+), 17 deletions(-)

Re: [PATCH v4 10/21] parallels: Create used bitmap even if checks needed

2024-01-16 Thread Denis V. Lunev
On 12/28/23 11:12, Alexander Ivanov wrote: All the checks were fixed to work with used bitmap. Create used bitmap in parallels_open() even if need_check is true. Signed-off-by: Alexander Ivanov --- block/parallels.c | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff

Re: [PATCH v4 09/21] parallels: Add a note about used bitmap in parallels_check_duplicate()

2024-01-16 Thread Denis V. Lunev
On 12/28/23 11:12, Alexander Ivanov wrote: In parallels_check_duplicate() We use a bitmap for duplication detection. This bitmap is not related to used_bmap field in BDRVParallelsState. Add a comment about it to avoid confusion. Signed-off-by: Alexander Ivanov --- block/parallels.c | 5 -

Re: [PATCH v4 08/21] parallels: Recreate used bitmap in parallels_check_leak()

2024-01-16 Thread Denis V. Lunev
On 12/28/23 11:12, Alexander Ivanov wrote: In parallels_check_leak() file can be truncated. In this case the used bitmap would not comply to the file. Recreate the bitmap after file truncation. Signed-off-by: Alexander Ivanov --- block/parallels.c | 8 1 file changed, 8

Re: [PATCH v4 07/21] parallels: Set data_end value in parallels_check_leak()

2024-01-16 Thread Denis V. Lunev
On 12/28/23 11:12, Alexander Ivanov wrote: In parallels_check_leak() we change file size but don't correct data_end field of BDRVParallelsState structure. Fix it. Signed-off-by: Alexander Ivanov --- block/parallels.c | 1 + 1 file changed, 1 insertion(+) diff --git a/block/parallels.c

Re: [PATCH v4 06/21] parallels: Move host clusters allocation to a separate function

2024-01-16 Thread Denis V. Lunev
On 12/28/23 11:12, Alexander Ivanov wrote: For parallels images extensions we need to allocate host clusters without any connection to BAT. Move host clusters allocation code to parallels_allocate_host_clusters(). This function can be called not only from coroutines so all the *_co_* functions

Re: [PATCH v4 05/21] parallels: Add parallels_mark_unused() helper

2024-01-16 Thread Denis V. Lunev
On 12/28/23 11:12, Alexander Ivanov wrote: Add a helper to set unused areas in the used bitmap. Signed-off-by: Alexander Ivanov --- block/parallels.c | 18 ++ block/parallels.h | 2 ++ 2 files changed, 20 insertions(+) diff --git a/block/parallels.c b/block/parallels.c

Re: [PATCH v4 04/21] parallels: Limit search in parallels_mark_used to the last marked claster

2024-01-16 Thread Denis V. Lunev
On 12/28/23 11:12, Alexander Ivanov wrote: There is no necessity to search to the end of the bitmap. Limit the search area as cluster_index + count. Add cluster_end variable to avoid its calculation in a few places. Signed-off-by: Alexander Ivanov --- block/parallels.c | 9 + 1