Re: [PATCH v2 2/3] hw/sd/sdhci: Document the datasheet used

2020-09-01 Thread Richard Henderson
On 9/1/20 7:04 AM, Philippe Mathieu-Daudé wrote: > Add datasheet name in the file header. > > We can not add the direct download link since there is a disclaimers > to agree first on the SD Association website (www.sdcard.org). > > Signed-off-by: Philippe Mathieu-Daudé > --- > hw/sd/sdhci.c |

Re: [PATCH v2 1/3] hw/sd/sdhci: Fix qemu_log_mask() format string

2020-09-01 Thread Richard Henderson
On 9/1/20 7:04 AM, Philippe Mathieu-Daudé wrote: > Add missing newline character in qemu_log_mask() format. > > Signed-off-by: Philippe Mathieu-Daudé > --- > hw/sd/sdhci.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Reviewed-by: Richard Henderson r~

Re: [PATCH v3 7/7] migration: introduce snapshot-{save, load, delete} QMP commands

2020-09-01 Thread Daniel P . Berrangé
On Tue, Sep 01, 2020 at 04:20:47PM +0200, Markus Armbruster wrote: > Daniel P. Berrangé writes: > > > savevm, loadvm and delvm are some of the few HMP commands that have never > > been converted to use QMP. The primary reason for this lack of conversion > > is that they block execution of the

Re: [PATCH v6 00/15] block/nvme: Various cleanups required to use multiple queues

2020-09-01 Thread Kevin Wolf
Am 21.08.2020 um 21:53 hat Philippe Mathieu-Daudé geschrieben: > Hi Kevin, > > This series is mostly code rearrangement (cleanups) to be > able to split the hardware code from the block driver code, > to be able to use multiple queues on the same hardware, or > multiple block drivers on the same

Re: [PATCH 2/2] block: file-posix: Replace posix_fallocate with fallocate

2020-09-01 Thread Alberto Garcia
On Mon 31 Aug 2020 04:01:27 PM CEST, Nir Soffer wrote: > If fallocate() is not supported, posix_fallocate() falls back to > inefficient allocation, writing one byte for every 4k bytes[1]. This is > very slow compared with writing zeros. In oVirt we measured ~400% > improvement in allocation time

Re: [PATCH v6 00/15] block/nvme: Various cleanups required to use multiple queues

2020-09-01 Thread Philippe Mathieu-Daudé
On 8/21/20 9:53 PM, Philippe Mathieu-Daudé wrote: > Hi Kevin, > > This series is mostly code rearrangement (cleanups) to be > able to split the hardware code from the block driver code, > to be able to use multiple queues on the same hardware, or > multiple block drivers on the same hardware. >

Re: [PATCH v8 1/8] Introduce yank feature

2020-09-01 Thread Daniel P . Berrangé
On Tue, Sep 01, 2020 at 04:38:46PM +0200, Markus Armbruster wrote: > One more question... > > Lukas Straub writes: > > > The yank feature allows to recover from hanging qemu by "yanking" > > at various parts. Other qemu systems can register themselves and > > multiple yank functions. Then all

Re: [PATCH v5 00/10] preallocate filter

2020-09-01 Thread Max Reitz
On 27.08.20 23:08, Vladimir Sementsov-Ogievskiy wrote: > 21.08.2020 17:11, Vladimir Sementsov-Ogievskiy wrote: >> Hi all! >> >> Here is a filter, which does preallocation on write. >> >> In Virtuozzo we have to deal with some custom distributed storage >> solution, where allocation is relatively

Attached disk blockpull

2020-09-01 Thread Yoonho Park
I am trying to perform a blockpull on an attached disk, but I cannot do this using "virsh attach-disk" specifying a new, empty overlay file created with "qemu-img create". The VM does not pick up the backing_file path from the qcow2 overlay file, and there seems to be no way to specify the backing

[PATCH v8 43/43] iotests: Test committing to overridden backing

2020-09-01 Thread Max Reitz
Signed-off-by: Max Reitz Reviewed-by: Andrey Shinkevich Reviewed-by: Kevin Wolf --- tests/qemu-iotests/040 | 61 ++ tests/qemu-iotests/040.out | 4 +-- 2 files changed, 63 insertions(+), 2 deletions(-) diff --git a/tests/qemu-iotests/040

[PATCH v8 42/43] iotests: Add test for commit in sub directory

2020-09-01 Thread Max Reitz
Add a test for committing an overlay in a sub directory to one of the images in its backing chain, using both relative and absolute filenames. Signed-off-by: Max Reitz --- tests/qemu-iotests/020 | 44 ++ tests/qemu-iotests/020.out | 10 + 2 files

[PATCH v8 38/43] iotests: Test that qcow2's data-file is flushed

2020-09-01 Thread Max Reitz
Flushing a qcow2 node must lead to the data-file node being flushed as well. Signed-off-by: Max Reitz Reviewed-by: Andrey Shinkevich Reviewed-by: Kevin Wolf --- tests/qemu-iotests/244 | 49 ++ tests/qemu-iotests/244.out | 7 ++ 2 files changed, 56

[PATCH v8 40/43] iotests: Add filter commit test cases

2020-09-01 Thread Max Reitz
This patch adds some tests on how commit copes with filter nodes. Signed-off-by: Max Reitz --- tests/qemu-iotests/040 | 177 + tests/qemu-iotests/040.out | 4 +- 2 files changed, 179 insertions(+), 2 deletions(-) diff --git a/tests/qemu-iotests/040

[PATCH v8 33/43] qemu-img: Use child access functions

2020-09-01 Thread Max Reitz
This changes iotest 204's output, because blkdebug on top of a COW node used to make qemu-img map disregard the rest of the backing chain (the backing chain was broken by the filter). With this patch, the allocation in the base image is reported correctly. Signed-off-by: Max Reitz ---

[PATCH v8 32/43] nbd: Use CAF when looking for dirty bitmap

2020-09-01 Thread Max Reitz
When looking for a dirty bitmap to share, we should handle filters by just including them in the search (so they do not break backing chains). Signed-off-by: Max Reitz Reviewed-by: Andrey Shinkevich Reviewed-by: Kevin Wolf --- nbd/server.c | 6 +++--- 1 file changed, 3 insertions(+), 3

[PATCH v8 26/43] block: Report data child for query-blockstats

2020-09-01 Thread Max Reitz
It makes no sense to report the block stats of a purely metadata-storing child in query-blockstats. So if the primary child does not have any data, try to find a unique data-storing child. Signed-off-by: Max Reitz Reviewed-by: Andrey Shinkevich Reviewed-by: Kevin Wolf --- block/qapi.c | 31

[PATCH v8 34/43] block: Drop backing_bs()

2020-09-01 Thread Max Reitz
We want to make it explicit where bs->backing is used, and we have done so. The old role of backing_bs() is now effectively taken by bdrv_cow_bs(). Signed-off-by: Max Reitz Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Andrey Shinkevich Reviewed-by: Kevin Wolf ---

[PATCH v8 36/43] block: Inline bdrv_co_block_status_from_*()

2020-09-01 Thread Max Reitz
With bdrv_filter_bs(), we can easily handle this default filter behavior in bdrv_co_block_status(). blkdebug wants to have an additional assertion, so it keeps its own implementation, except bdrv_co_block_status_from_file() needs to be inlined there. Suggested-by: Eric Blake Signed-off-by: Max

[PATCH v8 31/43] commit: Deal with filters

2020-09-01 Thread Max Reitz
This includes some permission limiting (for example, we only need to take the RESIZE permission if the base is smaller than the top). Signed-off-by: Max Reitz --- block/block-backend.c | 7 ++- block/commit.c | 94 +-

Re: [PATCH v8 1/8] Introduce yank feature

2020-09-01 Thread Markus Armbruster
One more question... Lukas Straub writes: > The yank feature allows to recover from hanging qemu by "yanking" > at various parts. Other qemu systems can register themselves and > multiple yank functions. Then all yank functions for selected > instances can be called by the 'yank' out-of-band

[PATCH v8 27/43] block: Use child access functions for QAPI queries

2020-09-01 Thread Max Reitz
query-block, query-named-block-nodes, and query-blockstats now return any filtered child under "backing", not just bs->backing or COW children. This is so that filters do not interrupt the reported backing chain. This changes the output for iotest 184, as the throttled node now appears as a

[PATCH v8 25/43] blockdev: Use CAF in external_snapshot_prepare()

2020-09-01 Thread Max Reitz
This allows us to differentiate between filters and nodes with COW backing files: Filters cannot be used as overlays at all (for this function). Signed-off-by: Max Reitz Reviewed-by: Andrey Shinkevich Reviewed-by: Kevin Wolf --- blockdev.c | 7 ++- 1 file changed, 6 insertions(+), 1

[PATCH v8 41/43] iotests: Add filter mirror test cases

2020-09-01 Thread Max Reitz
This patch adds some test cases how mirroring relates to filters. One of them tests what happens when you mirror off a filtered COW node, two others use the mirror filter node as basically our only example of an implicitly created filter node so far (besides the commit filter). Signed-off-by:

[PATCH v8 39/43] iotests: Let complete_and_wait() work with commit

2020-09-01 Thread Max Reitz
complete_and_wait() and wait_ready() currently only work for mirror jobs. Let them work for active commit jobs, too. Signed-off-by: Max Reitz Reviewed-by: Andrey Shinkevich Reviewed-by: Kevin Wolf --- tests/qemu-iotests/iotests.py | 10 +++--- 1 file changed, 7 insertions(+), 3

[PATCH v8 37/43] block: Leave BDS.backing_{file,format} constant

2020-09-01 Thread Max Reitz
Parts of the block layer treat BDS.backing_file as if it were whatever the image header says (i.e., if it is a relative path, it is relative to the overlay), other parts treat it like a cache for bs->backing->bs->filename (relative paths are relative to the CWD). Considering

[PATCH v8 17/43] vmdk: Drop vmdk_co_flush()

2020-09-01 Thread Max Reitz
Before HEAD^, we needed this because bdrv_co_flush() by itself would only flush bs->file. With HEAD^, bdrv_co_flush() will flush all children on which a WRITE or WRITE_UNCHANGED permission has been taken. Thus, vmdk no longer needs to do it itself. Signed-off-by: Max Reitz Reviewed-by: Kevin

[PATCH v8 21/43] block/snapshot: Fix fallback

2020-09-01 Thread Max Reitz
If the top node's driver does not provide snapshot functionality and we want to fall back to a node down the chain, we need to snapshot all non-COW children. For simplicity's sake, just do not fall back if there is more than one such child. Furthermore, we really only can fall back to bs->file

[PATCH v8 35/43] blockdev: Fix active commit choice

2020-09-01 Thread Max Reitz
We have to perform an active commit whenever the top node has a parent that has taken the WRITE permission on it. This means that block-commit's @backing-file parameter is longer allowed for such nodes, and that users will have to issue a block-job-complete command. Neither should pose a problem

[PATCH v8 30/43] backup: Deal with filters

2020-09-01 Thread Max Reitz
Signed-off-by: Max Reitz Reviewed-by: Kevin Wolf --- block/backup-top.c | 2 +- block/backup.c | 9 + blockdev.c | 19 +++ 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/block/backup-top.c b/block/backup-top.c index af2f20f346..430d1be068

[PATCH v8 13/43] block: Use CAFs when working with backing chains

2020-09-01 Thread Max Reitz
Use child access functions when iterating through backing chains so filters do not break the chain. In addition, bdrv_find_overlay() will now always return the actual overlay; that is, it will never return a filter node but only one with a COW backing file (there may be filter nodes between that

[PATCH v8 29/43] mirror: Deal with filters

2020-09-01 Thread Max Reitz
This includes some permission limiting (for example, we only need to take the RESIZE permission for active commits where the base is smaller than the top). base_overlay is introduced so we can query bdrv_is_allocated_above() on it - we cannot do that with base itself, because a filter's

[PATCH v8 23/43] block: Improve get_allocated_file_size's default

2020-09-01 Thread Max Reitz
There are two practical problems with bdrv_get_allocated_file_size()'s default right now: (1) For drivers with children, we should generally sum all their sizes instead of just passing the request through to bs->file. The latter is good for filters, but not so much for format drivers.

[PATCH v8 11/43] block: Use CAFs in block status functions

2020-09-01 Thread Max Reitz
Use the child access functions in the block status inquiry functions as appropriate. Signed-off-by: Max Reitz --- block/io.c | 19 ++- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/block/io.c b/block/io.c index 01e3477a77..4ee8fe5465 100644 --- a/block/io.c +++

[PATCH v8 28/43] block-copy: Use CAF to find sync=top base

2020-09-01 Thread Max Reitz
Signed-off-by: Max Reitz Reviewed-by: Andrey Shinkevich Reviewed-by: Kevin Wolf --- block/block-copy.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/block/block-copy.c b/block/block-copy.c index a30b9097ef..cd9bc47c8f 100644 --- a/block/block-copy.c +++

[PATCH v8 20/43] block: Use CAF in bdrv_co_rw_vmstate()

2020-09-01 Thread Max Reitz
If a node whose driver does not provide VM state functions has a metadata child, the VM state should probably go there; if it is a filter, the VM state should probably go there. It follows that we should generally go down to the primary child. Signed-off-by: Max Reitz Reviewed-by: Vladimir

[PATCH v8 19/43] block: Use CAFs in bdrv_refresh_filename()

2020-09-01 Thread Max Reitz
bdrv_refresh_filename() and the kind of related bdrv_dirname() should look to the primary child when they wish to copy the underlying file's filename. Signed-off-by: Max Reitz Reviewed-by: Kevin Wolf --- block.c | 29 + 1 file changed, 21 insertions(+), 8

[PATCH v8 24/43] block/null: Implement bdrv_get_allocated_file_size

2020-09-01 Thread Max Reitz
It is trivial, so we might as well do it. Remove _filter_actual_image_size from iotest 184, so we get to see the result in its reference output. Signed-off-by: Max Reitz --- block/null.c | 7 +++ tests/qemu-iotests/153.out | 2 +- tests/qemu-iotests/184 | 3 +--

[PATCH v8 22/43] block: Use CAFs for debug breakpoints

2020-09-01 Thread Max Reitz
When looking for a blkdebug node (which implements debug breakpoints), use bdrv_primary_bs() to iterate through the graph, because that is where a blkdebug node would be. Signed-off-by: Max Reitz Reviewed-by: Andrey Shinkevich Reviewed-by: Kevin Wolf --- block.c | 16 +++- 1 file

[PATCH v8 10/43] block: Use bdrv_filter_(bs|child) where obvious

2020-09-01 Thread Max Reitz
Places that use patterns like if (bs->drv->is_filter && bs->file) { ... something about bs->file->bs ... } should be BlockDriverState *filtered = bdrv_filter_bs(bs); if (filtered) { ... something about @filtered ... } instead. Signed-off-by: Max Reitz

[PATCH v8 12/43] stream: Deal with filters

2020-09-01 Thread Max Reitz
Because of the (not so recent anymore) changes that make the stream job independent of the base node and instead track the node above it, we have to split that "bottom" node into two cases: The bottom COW node, and the node directly above the base node (which may be an R/W filter or the bottom COW

[PATCH v8 15/43] block: Re-evaluate backing file handling in reopen

2020-09-01 Thread Max Reitz
Reopening a node's backing child needs a bit of special handling because the "backing" child has different defaults than all other children (among other things). Adding filter support here is a bit more difficult than just using the child access functions. In fact, we often have to directly use

[PATCH v8 16/43] block: Flush all children in generic code

2020-09-01 Thread Max Reitz
If the driver does not support .bdrv_co_flush() so bdrv_co_flush() itself has to flush the children of the given node, it should not flush just bs->file->bs, but in fact all children that might have been written to (judging from the permissions taken on them). This is a bug fix for qcow2 images

[PATCH v8 07/43] block: Add bdrv_supports_compressed_writes()

2020-09-01 Thread Max Reitz
Filters cannot compress data themselves but they have to implement .bdrv_co_pwritev_compressed() still (or they cannot forward compressed writes). Therefore, checking whether bs->drv->bdrv_co_pwritev_compressed is non-NULL is not sufficient to know whether the node can actually handle compressed

[PATCH v8 14/43] block: Use bdrv_cow_child() in bdrv_co_truncate()

2020-09-01 Thread Max Reitz
The condition modified here is not about potentially filtered children, but only about COW sources (i.e. traditional backing files). Signed-off-by: Max Reitz Reviewed-by: Andrey Shinkevich Reviewed-by: Kevin Wolf --- block/io.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-)

[PATCH v8 18/43] block: Iterate over children in refresh_limits

2020-09-01 Thread Max Reitz
Instead of looking at just bs->file and bs->backing, we should look at all children that could end up receiving forwarded requests. Signed-off-by: Max Reitz Reviewed-by: Kevin Wolf --- block/io.c | 32 1 file changed, 16 insertions(+), 16 deletions(-) diff

[PATCH v8 00/43] block: Deal with filters

2020-09-01 Thread Max Reitz
v6: https://lists.nongnu.org/archive/html/qemu-devel/2019-08/msg01715.html v7: https://lists.nongnu.org/archive/html/qemu-block/2020-06/msg01357.html Branch: https://github.com/XanClic/qemu.git child-access-functions-v8 Branch: https://git.xanclic.moe/XanClic/qemu.git child-access-functions-v8

[PATCH v8 02/43] block: Add chain helper functions

2020-09-01 Thread Max Reitz
Add some helper functions for skipping filters in a chain of block nodes. Signed-off-by: Max Reitz --- include/block/block_int.h | 3 ++ block.c | 62 +++ 2 files changed, 65 insertions(+) diff --git a/include/block/block_int.h

[PATCH v8 01/43] block: Add child access functions

2020-09-01 Thread Max Reitz
There are BDS children that the general block layer code can access, namely bs->file and bs->backing. Since the introduction of filters and external data files, their meaning is not quite clear. bs->backing can be a COW source, or it can be a filtered child; bs->file can be a filtered child, it

[PATCH v8 06/43] block: Drop bdrv_is_encrypted()

2020-09-01 Thread Max Reitz
The original purpose of bdrv_is_encrypted() was to inquire whether a BDS can be used without the user entering a password or not. It has not been used for that purpose for quite some time. Actually, it is not even fit for that purpose, because to answer that question, it would have recursively

[PATCH v8 03/43] block: bdrv_cow_child() for bdrv_has_zero_init()

2020-09-01 Thread Max Reitz
bdrv_has_zero_init() should use bdrv_cow_child() if it wants to check whether the given BDS has a COW backing file. Signed-off-by: Max Reitz Reviewed-by: Andrey Shinkevich Reviewed-by: Kevin Wolf --- block.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block.c b/block.c

Re: [PATCH v3 7/7] migration: introduce snapshot-{save, load, delete} QMP commands

2020-09-01 Thread Markus Armbruster
Daniel P. Berrangé writes: > savevm, loadvm and delvm are some of the few HMP commands that have never > been converted to use QMP. The primary reason for this lack of conversion > is that they block execution of the thread for as long as they run. Nope. The primary reason is that the HMP

[PATCH v8 09/43] copy-on-read: Support compressed writes

2020-09-01 Thread Max Reitz
Signed-off-by: Max Reitz Reviewed-by: Andrey Shinkevich Reviewed-by: Kevin Wolf --- block/copy-on-read.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/block/copy-on-read.c b/block/copy-on-read.c index a6e3c74a68..a6a864f147 100644 --- a/block/copy-on-read.c +++

[PATCH v8 08/43] throttle: Support compressed writes

2020-09-01 Thread Max Reitz
Signed-off-by: Max Reitz Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Andrey Shinkevich Reviewed-by: Kevin Wolf --- block/throttle.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/block/throttle.c b/block/throttle.c index 1c1ac57bee..b21ee42d98 100644 ---

[PATCH v8 04/43] block: bdrv_set_backing_hd() is about bs->backing

2020-09-01 Thread Max Reitz
bdrv_set_backing_hd() is a function that explicitly cares about the bs->backing child. Highlight that in its description and use child_bs(bs->backing) instead of backing_bs(bs) to make it more obvious. Signed-off-by: Max Reitz Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Andrey

[PATCH v8 05/43] block: Include filters when freezing backing chain

2020-09-01 Thread Max Reitz
In order to make filters work in backing chains, the associated functions must be able to deal with them and freeze both COW and filter child links. While at it, add some comments that note which functions require their caller to ensure that a given child link is not frozen, and how the callers

[PATCH v2 2/3] hw/sd/sdhci: Document the datasheet used

2020-09-01 Thread Philippe Mathieu-Daudé
Add datasheet name in the file header. We can not add the direct download link since there is a disclaimers to agree first on the SD Association website (www.sdcard.org). Signed-off-by: Philippe Mathieu-Daudé --- hw/sd/sdhci.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/sd/sdhci.c

[PATCH v2 1/3] hw/sd/sdhci: Fix qemu_log_mask() format string

2020-09-01 Thread Philippe Mathieu-Daudé
Add missing newline character in qemu_log_mask() format. Signed-off-by: Philippe Mathieu-Daudé --- hw/sd/sdhci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c index 1785d7e1f79..e2ef288052e 100644 --- a/hw/sd/sdhci.c +++ b/hw/sd/sdhci.c @@

Re: [PATCH 3/3] hw/sd/sdhci: Fix DMA Transfer Block Size field

2020-09-01 Thread Philippe Mathieu-Daudé
On 9/1/20 4:01 PM, Philippe Mathieu-Daudé wrote: > The 'Transfer Block Size' field is 12-bit wide. > > See section '2.2.2. Block Size Register (Offset 004h)' in datasheet. > > Cc: qemu-sta...@nongnu.org > Cc: Igor Mitsyanko > Buglink: https://bugs.launchpad.net/qemu/+bug/1892960 > Fixes:

[PATCH v2 0/3] hw/sd/sdhci: Fix DMA Transfer Block Size field width

2020-09-01 Thread Philippe Mathieu-Daudé
Fix the SDHCI issue reported last week by Alexander: https://bugs.launchpad.net/qemu/+bug/1892960 The field is 12-bit (4KiB) but the guest can set up to 16-bit (64KiB), leading to OOB access. since v1: commited unstaged change in patch #3... Philippe Mathieu-Daudé (3): hw/sd/sdhci: Fix

[PATCH 3/3] hw/sd/sdhci: Fix DMA Transfer Block Size field

2020-09-01 Thread Philippe Mathieu-Daudé
The 'Transfer Block Size' field is 12-bit wide. See section '2.2.2. Block Size Register (Offset 004h)' in datasheet. Cc: qemu-sta...@nongnu.org Cc: Igor Mitsyanko Buglink: https://bugs.launchpad.net/qemu/+bug/1892960 Fixes: d7dfca0807a ("hw/sdhci: introduce standard SD host controller")

[PATCH v2 3/3] hw/sd/sdhci: Fix DMA Transfer Block Size field

2020-09-01 Thread Philippe Mathieu-Daudé
The 'Transfer Block Size' field is 12-bit wide. See section '2.2.2. Block Size Register (Offset 004h)' in datasheet. Cc: qemu-sta...@nongnu.org Cc: Igor Mitsyanko Buglink: https://bugs.launchpad.net/qemu/+bug/1892960 Fixes: d7dfca0807a ("hw/sdhci: introduce standard SD host controller")

[PATCH 2/3] hw/sd/sdhci: Document the datasheet used

2020-09-01 Thread Philippe Mathieu-Daudé
Add datasheet name in the file header. We can not add the direct download link since there is a disclaimers to agree first on the SD Association website (www.sdcard.org). Signed-off-by: Philippe Mathieu-Daudé --- hw/sd/sdhci.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/sd/sdhci.c

[PATCH 1/3] hw/sd/sdhci: Fix qemu_log_mask() format string

2020-09-01 Thread Philippe Mathieu-Daudé
Add missing newline character in qemu_log_mask() format. Signed-off-by: Philippe Mathieu-Daudé --- hw/sd/sdhci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c index 1785d7e1f79..e2ef288052e 100644 --- a/hw/sd/sdhci.c +++ b/hw/sd/sdhci.c @@

[PATCH 0/3] hw/sd/sdhci: Fix DMA Transfer Block Size field width

2020-09-01 Thread Philippe Mathieu-Daudé
Fix the SDHCI issue reported last week by Alexander: https://bugs.launchpad.net/qemu/+bug/1892960 The field is 12-bit (4KiB) but the guest can set up to 16-bit (64KiB), leading to OOB access. Philippe Mathieu-Daudé (3): hw/sd/sdhci: Fix qemu_log_mask() format string hw/sd/sdhci: Document the

Re: [PATCH v2 (BROKEN) 0/6] migration: bring improved savevm/loadvm/delvm to QMP

2020-09-01 Thread Kevin Wolf
Am 01.09.2020 um 15:22 hat Markus Armbruster geschrieben: > Daniel P. Berrangé writes: > > > On Thu, Aug 27, 2020 at 01:04:43PM +0200, Markus Armbruster wrote: > >> Daniel P. Berrangé writes: > >> > >> > On Wed, Aug 26, 2020 at 05:52:06PM +0200, Markus Armbruster wrote: > >> > From the POV

Re: [PATCH 0/7] block: Use definitions instead of magic values

2020-09-01 Thread Philippe Mathieu-Daudé
On 9/1/20 11:27 AM, Laurent Vivier wrote: > Le 14/08/2020 à 10:28, Philippe Mathieu-Daudé a écrit : >> Trivial block patches: >> - Fix a typo >> - Replace '1 << 30' by '1 * GiB' in null-co >> - Replace 512 by BDRV_SECTOR_SIZE when appropriate. >> >> Philippe Mathieu-Daudé (7): >> block/null:

Re: [PATCH] sd: sdhci: check data_count is within fifo_buffer

2020-09-01 Thread Philippe Mathieu-Daudé
On 8/27/20 1:53 PM, P J P wrote: > From: Prasad J Pandit > > While doing multi block SDMA, transfer block size may exceed > the 's->fifo_buffer[s->buf_maxsz]' size. It may leave the > current element pointer 's->data_count' pointing out of bounds. > Leading the subsequent DMA r/w operation to

Re: [PATCH v2 (BROKEN) 0/6] migration: bring improved savevm/loadvm/delvm to QMP

2020-09-01 Thread Daniel P . Berrangé
On Tue, Sep 01, 2020 at 03:22:24PM +0200, Markus Armbruster wrote: > Daniel P. Berrangé writes: > > > On Thu, Aug 27, 2020 at 01:04:43PM +0200, Markus Armbruster wrote: > >> Daniel P. Berrangé writes: > >> > >> > On Wed, Aug 26, 2020 at 05:52:06PM +0200, Markus Armbruster wrote: > >> > From

Re: [PATCH] qcow2: cleanup created file when qcow2_co_create

2020-09-01 Thread Alberto Garcia
On Thu 16 Jul 2020 01:33:59 PM CEST, Maxim Levitsky wrote: > if (ret < 0) { > + > +Error *local_delete_err = NULL; > +int r_del = bdrv_co_delete_file(bs, _delete_err); > +/* > + * ENOTSUP will happen if the block driver doesn't support > + * the

Re: [PATCH v2 (BROKEN) 0/6] migration: bring improved savevm/loadvm/delvm to QMP

2020-09-01 Thread Markus Armbruster
Daniel P. Berrangé writes: > On Thu, Aug 27, 2020 at 01:04:43PM +0200, Markus Armbruster wrote: >> Daniel P. Berrangé writes: >> >> > On Wed, Aug 26, 2020 at 05:52:06PM +0200, Markus Armbruster wrote: >> > From the POV of practicality, making a design that unifies internal >> > and external

[PATCH] qemu-img: avoid unaligned read requests during convert

2020-09-01 Thread Peter Lieven
in case of large continous areas that share the same allocation status it happens that the value of s->sector_next_status is unaligned to the cluster size or even request alignment of the source. Avoid this by stripping down the s->sector_next_status position to cluster boundaries. Signed-off-by:

Re: [PATCH] sd: sdhci: check data_count is within fifo_buffer

2020-09-01 Thread P J P
+-- On Sun, 30 Aug 2020, Alexander Bulekov wrote --+ | Here's a qtest reproducer for this one: | | cat << EOF |./i386-softmmu/qemu-system-i386 -nodefaults \ | -device sdhci-pci -device sd-card,drive=mydrive \ | -drive if=sd,index=0,file=null-co://,format=raw,id=mydrive \ | -nographic -accel qtest

Re: [PATCH v8 1/8] Introduce yank feature

2020-09-01 Thread Markus Armbruster
Lukas Straub writes: > The yank feature allows to recover from hanging qemu by "yanking" > at various parts. Other qemu systems can register themselves and > multiple yank functions. Then all yank functions for selected > instances can be called by the 'yank' out-of-band qmp command. > Available

Re: [PATCH] qcow2: cleanup created file when qcow2_co_create

2020-09-01 Thread Maxim Levitsky
On Thu, 2020-07-16 at 14:33 +0300, Maxim Levitsky wrote: > This is basically the same thing as commit > 'crypto.c: cleanup created file when block_crypto_co_create_opts_luks fails' > does but for qcow2 files to ensure that we don't leave qcow2 files > when creation fails. > > Signed-off-by: Maxim

Re: [PATCH v2 09/10] block/file-posix: fix a possible undefined behavior

2020-09-01 Thread Li Qiang
Pan Nengyuan 于2020年8月31日周一 下午3:21写道: > > local_err is not initialized to NULL, it will cause a assert error as below: > qemu/util/error.c:59: error_setv: Assertion `*errp == NULL' failed. > > Fixes: c6447510690 > Reported-by: Euler Robot > Signed-off-by: Pan Nengyuan > Reviewed-by: Stefano

Re: [PATCH 1/2] block: file-posix: Extract preallocate helpers

2020-09-01 Thread Nir Soffer
On Tue, Sep 1, 2020 at 1:27 PM Alberto Garcia wrote: > > On Mon 31 Aug 2020 04:01:26 PM CEST, Nir Soffer wrote: > > +static int preallocate_falloc(int fd, int64_t current_length, int64_t > > offset, > > + Error **errp) > > +{ > > +#ifdef CONFIG_POSIX_FALLOCATE > > +

Re: [PATCH] hw: ide: check the pointer before do dma memory unmap

2020-09-01 Thread Li Qiang
Ping. Li Qiang 于2020年8月15日周六 下午3:21写道: > > In 'map_page' we need to check the return value of > 'dma_memory_map' to ensure the we actully maped something. > Otherwise, we will hit an assert in 'address_space_unmap'. > This is because we can't find the MR with the NULL buffer. > This is the

Re: [PATCH 0/5] Introduce 'yank' oob qmp command to recover from hanging qemu

2020-09-01 Thread Markus Armbruster
Kevin Wolf writes: > Am 13.05.2020 um 12:53 hat Dr. David Alan Gilbert geschrieben: >> * Kevin Wolf (kw...@redhat.com) wrote: >> > Am 12.05.2020 um 11:43 hat Daniel P. Berrangé geschrieben: >> > > On Tue, May 12, 2020 at 11:32:06AM +0200, Lukas Straub wrote: >> > > > On Mon, 11 May 2020

Re: [PATCH 1/2] block: file-posix: Extract preallocate helpers

2020-09-01 Thread Alberto Garcia
On Mon 31 Aug 2020 04:01:26 PM CEST, Nir Soffer wrote: > +static int preallocate_falloc(int fd, int64_t current_length, int64_t offset, > + Error **errp) > +{ > +#ifdef CONFIG_POSIX_FALLOCATE > +int result; > + > +if (offset == current_length) > +return

Re: [PATCH 1/2] block: file-posix: Extract preallocate helpers

2020-09-01 Thread Alberto Garcia
On Mon 31 Aug 2020 04:01:26 PM CEST, Nir Soffer wrote: > handle_aiocb_truncate() was too big and complex, implementing 3 > different preallocation modes. In a future patch I want to introduce a > fallback from "falloc" to "full"; it will be too messy and error prone > with the current code. > >

Re: [PATCH 0/7] block: Use definitions instead of magic values

2020-09-01 Thread Laurent Vivier
Le 14/08/2020 à 10:28, Philippe Mathieu-Daudé a écrit : > Trivial block patches: > - Fix a typo > - Replace '1 << 30' by '1 * GiB' in null-co > - Replace 512 by BDRV_SECTOR_SIZE when appropriate. > > Philippe Mathieu-Daudé (7): > block/null: Make more explicit the driver default size is 1GiB >

Re: [PATCH v8 4/8] migration: Add yank feature

2020-09-01 Thread Daniel P . Berrangé
On Tue, Sep 01, 2020 at 11:15:18AM +0200, Lukas Straub wrote: > Register yank functions on sockets to shut them down. > > Signed-off-by: Lukas Straub > Acked-by: Stefan Hajnoczi > Acked-by: Dr. David Alan Gilbert > --- > migration/channel.c | 12 > migration/migration.c

Re: [PATCH v8 6/8] io: Document qmp oob suitability of qio_channel_shutdown and io_shutdown

2020-09-01 Thread Daniel P . Berrangé
On Tue, Sep 01, 2020 at 11:15:25AM +0200, Lukas Straub wrote: > Migration and yank code assume that qio_channel_shutdown is thread > -safe and can be called from qmp oob handler. Document this after > checking the code. > > Signed-off-by: Lukas Straub > Acked-by: Stefan Hajnoczi > --- >

Re: [PATCH v8 1/8] Introduce yank feature

2020-09-01 Thread Daniel P . Berrangé
On Tue, Sep 01, 2020 at 11:15:07AM +0200, Lukas Straub wrote: > The yank feature allows to recover from hanging qemu by "yanking" > at various parts. Other qemu systems can register themselves and > multiple yank functions. Then all yank functions for selected > instances can be called by the

[PATCH v8 5/8] io/channel-tls.c: make qio_channel_tls_shutdown thread-safe

2020-09-01 Thread Lukas Straub
Make qio_channel_tls_shutdown thread-safe by using atomics when accessing tioc->shutdown. Signed-off-by: Lukas Straub Acked-by: Stefan Hajnoczi Reviewed-by: Daniel P. Berrangé --- io/channel-tls.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/io/channel-tls.c

[PATCH v8 7/8] MAINTAINERS: Add myself as maintainer for yank feature

2020-09-01 Thread Lukas Straub
I'll maintain this for now as the colo usecase is the first user of this functionality. Signed-off-by: Lukas Straub Acked-by: Stefan Hajnoczi Reviewed-by: Daniel P. Berrangé --- MAINTAINERS | 6 ++ 1 file changed, 6 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index

[PATCH v8 3/8] chardev/char-socket.c: Add yank feature

2020-09-01 Thread Lukas Straub
Register a yank function to shutdown the socket on yank. Signed-off-by: Lukas Straub Acked-by: Stefan Hajnoczi Reviewed-by: Daniel P. Berrangé --- chardev/char-socket.c | 31 +++ 1 file changed, 31 insertions(+) diff --git a/chardev/char-socket.c

[PATCH v8 2/8] block/nbd.c: Add yank feature

2020-09-01 Thread Lukas Straub
Register a yank function which shuts down the socket and sets s->state = NBD_CLIENT_QUIT. This is the same behaviour as if an error occured. Signed-off-by: Lukas Straub Acked-by: Stefan Hajnoczi Reviewed-by: Daniel P. Berrangé --- block/nbd.c | 129

[PATCH v8 1/8] Introduce yank feature

2020-09-01 Thread Lukas Straub
The yank feature allows to recover from hanging qemu by "yanking" at various parts. Other qemu systems can register themselves and multiple yank functions. Then all yank functions for selected instances can be called by the 'yank' out-of-band qmp command. Available instances can be queried by a

[PATCH v8 0/8] Introduce 'yank' oob qmp command to recover from hanging qemu

2020-09-01 Thread Lukas Straub
Hello Everyone, So here is v8. We still need ACKs from NBD and chardev maintainers. Changes: v8: -add Reviewed-by and Acked-by tags -rebase onto master -minor change to migration -convert to meson -change "Since:" to 5.2 -varios code style fixes (Markus Armbruster) -point to oob

[PATCH v8 8/8] tests/test-char.c: Wait for the chardev to connect in char_socket_client_dupid_test

2020-09-01 Thread Lukas Straub
A connecting chardev object has an additional reference by the connecting thread, so if the chardev is still connecting by the end of the test, then the chardev object won't be freed. This in turn means that the yank instance won't be unregistered and when running the next test-case

[PATCH v8 6/8] io: Document qmp oob suitability of qio_channel_shutdown and io_shutdown

2020-09-01 Thread Lukas Straub
Migration and yank code assume that qio_channel_shutdown is thread -safe and can be called from qmp oob handler. Document this after checking the code. Signed-off-by: Lukas Straub Acked-by: Stefan Hajnoczi --- include/io/channel.h | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff

[PATCH v8 4/8] migration: Add yank feature

2020-09-01 Thread Lukas Straub
Register yank functions on sockets to shut them down. Signed-off-by: Lukas Straub Acked-by: Stefan Hajnoczi Acked-by: Dr. David Alan Gilbert --- migration/channel.c | 12 migration/migration.c | 25 + migration/multifd.c | 10

[PULL 02/24] block: always link with zlib

2020-09-01 Thread Paolo Bonzini
The qcow2 driver needs the zlib dependency. While emulators provided it through the migration code, this is not true of the tools. Move the dependency from the qcow1 rule directly into block_ss so that it is included unconditionally. Fixes build with --disable-qcow1. Reported-by: Thomas Huth

Re: [PATCH v2 2/7] vhost: check queue state in the vhost_dev_set_log routine

2020-09-01 Thread Dima Stepanov
On Mon, Aug 31, 2020 at 11:22:14PM -0400, Raphael Norwitz wrote: > On Mon, Aug 31, 2020 at 4:37 AM Dima Stepanov wrote: > > > > On Thu, Aug 27, 2020 at 09:46:03PM -0400, Raphael Norwitz wrote: > > > On Mon, Aug 24, 2020 at 4:41 AM Dima Stepanov > > > wrote: > > > > > > > > If the vhost-user-blk

Re: [PATCH-for-5.2] stubs/cmos: Use correct include

2020-09-01 Thread Laurent Vivier
Le 24/07/2020 à 10:43, Philippe Mathieu-Daudé a écrit : > cmos_get_fd_drive_type() is declared in "hw/block/fdc.h". > This currently works because "hw/i386/pc.h" happens to > include it. Simplify including the correct header. > > Fixes: 2055dbc1c9 ("acpi: move aml builder code for floppy device")

Re: [PATCH 08/12] block/vmdk: Remove superfluous breaks

2020-09-01 Thread Laurent Vivier
Le 13/07/2020 à 11:36, Thomas Huth a écrit : > On 13/07/2020 11.05, Yi Wang wrote: >> From: Liao Pingfang >> >> Remove superfluous breaks, as there is a "return" before them. >> >> Signed-off-by: Liao Pingfang >> Signed-off-by: Yi Wang >> Reviewed-by: Philippe Mathieu-Daudé >> --- >>