Re: [PATCH v1 0/2] Add timeout mechanism to qmp actions

2020-08-12 Thread Zhenyu Ye
Hi Stefan, On 2020/8/12 21:51, Stefan Hajnoczi wrote: > On Mon, Aug 10, 2020 at 10:52:44PM +0800, Zhenyu Ye wrote: >> Before doing qmp actions, we need to lock the qemu_global_mutex, >> so the qmp actions should not take too long time. >> >> Unfortunately, some qmp actions need to acquire aio

[PATCH v4 12/14] block/nvme: Replace BDRV_POLL_WHILE by AIO_WAIT_WHILE

2020-08-12 Thread Philippe Mathieu-Daudé
BDRV_POLL_WHILE() is defined as: #define BDRV_POLL_WHILE(bs, cond) ({ \ BlockDriverState *bs_ = (bs); \ AIO_WAIT_WHILE(bdrv_get_aio_context(bs_), \ cond); }) As we will remove the BlockDriverState use in the next commit, start by using the

[PATCH v4 14/14] block/nvme: Extract nvme_poll_queue()

2020-08-12 Thread Philippe Mathieu-Daudé
As we want to do per-queue polling, extract the nvme_poll_queue() method which operates on a single queue. Reviewed-by: Stefan Hajnoczi Signed-off-by: Philippe Mathieu-Daudé --- block/nvme.c | 44 +++- 1 file changed, 27 insertions(+), 17 deletions(-)

[PATCH v4 13/14] block/nvme: Simplify nvme_create_queue_pair() arguments

2020-08-12 Thread Philippe Mathieu-Daudé
nvme_create_queue_pair() doesn't require BlockDriverState anymore. Replace it by BDRVNVMeState and AioContext to simplify. Reviewed-by: Stefan Hajnoczi Signed-off-by: Philippe Mathieu-Daudé --- block/nvme.c | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff --git

[PATCH v4 11/14] block/nvme: Simplify nvme_init_queue() arguments

2020-08-12 Thread Philippe Mathieu-Daudé
nvme_init_queue() doesn't require BlockDriverState anymore. Replace it by BDRVNVMeState to simplify. Reviewed-by: Stefan Hajnoczi Signed-off-by: Philippe Mathieu-Daudé --- block/nvme.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/block/nvme.c b/block/nvme.c index

[PATCH v4 07/14] block/nvme: Rename local variable

2020-08-12 Thread Philippe Mathieu-Daudé
We are going to modify the code in the next commit. Renaming the 'resp' variable to 'id' first makes the next commit easier to review. No logical changes. Reviewed-by: Stefan Hajnoczi Signed-off-by: Philippe Mathieu-Daudé --- block/nvme.c | 19 +-- 1 file changed, 9

[PATCH v4 09/14] block/nvme: Replace qemu_try_blockalign0 by qemu_try_blockalign/memset

2020-08-12 Thread Philippe Mathieu-Daudé
In the next commit we'll get rid of qemu_try_blockalign(). To ease review, first replace qemu_try_blockalign0() by explicit calls to qemu_try_blockalign() and memset(). Reviewed-by: Stefan Hajnoczi Signed-off-by: Philippe Mathieu-Daudé --- block/nvme.c | 16 +--- 1 file changed, 9

[PATCH v4 08/14] block/nvme: Use union of NvmeIdCtrl / NvmeIdNs structures

2020-08-12 Thread Philippe Mathieu-Daudé
We allocate an unique chunk of memory then use it for two different structures. By using an union, we make it clear the data is overlapping (and we can remove the casts). Suggested-by: Stefan Hajnoczi Reviewed-by: Stefan Hajnoczi Signed-off-by: Philippe Mathieu-Daudé --- block/nvme.c | 31

[PATCH v4 10/14] block/nvme: Replace qemu_try_blockalign(bs) by qemu_try_memalign(pg_sz)

2020-08-12 Thread Philippe Mathieu-Daudé
qemu_try_blockalign() is a generic API that call back to the block driver to return its page alignment. As we call from within the very same driver, we already know to page alignment stored in our state. Remove indirections and use the value from BDRVNVMeState. This change is required to later

[PATCH v4 06/14] block/nvme: Use common error path in nvme_add_io_queue()

2020-08-12 Thread Philippe Mathieu-Daudé
Rearrange nvme_add_io_queue() by using a common error path. This will be proven useful in few commits where we add IRQ notification to the IO queues. Reviewed-by: Stefan Hajnoczi Signed-off-by: Philippe Mathieu-Daudé --- block/nvme.c | 9 + 1 file changed, 5 insertions(+), 4

[PATCH v4 04/14] block/nvme: Define INDEX macros to ease code review

2020-08-12 Thread Philippe Mathieu-Daudé
Use definitions instead of '0' or '1' indexes. Also this will be useful when using multi-queues later. Reviewed-by: Stefan Hajnoczi Signed-off-by: Philippe Mathieu-Daudé --- block/nvme.c | 33 +++-- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git

[PATCH v4 05/14] block/nvme: Improve error message when IO queue creation failed

2020-08-12 Thread Philippe Mathieu-Daudé
Do not use the same error message for different failures. Display a different error whether it is the CQ or the SQ. Reviewed-by: Stefan Hajnoczi Signed-off-by: Philippe Mathieu-Daudé --- block/nvme.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/block/nvme.c

[PATCH v4 03/14] block/nvme: Let nvme_create_queue_pair() fail gracefully

2020-08-12 Thread Philippe Mathieu-Daudé
As nvme_create_queue_pair() is allowed to fail, replace the alloc() calls by try_alloc() to avoid aborting QEMU. Reviewed-by: Stefan Hajnoczi Signed-off-by: Philippe Mathieu-Daudé --- block/nvme.c | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/block/nvme.c

[PATCH v4 00/14] block/nvme: Various cleanups required to use multiple queues

2020-08-12 Thread Philippe Mathieu-Daudé
Hi, 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. All this series is reviewed. Since v3: - renamed

[PATCH v4 01/14] block/nvme: Replace magic value by SCALE_MS definition

2020-08-12 Thread Philippe Mathieu-Daudé
Use self-explicit SCALE_MS definition instead of magic value. Reviewed-by: Stefan Hajnoczi Signed-off-by: Philippe Mathieu-Daudé --- block/nvme.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/nvme.c b/block/nvme.c index 374e268915..2f5e3c2adf 100644 ---

[PATCH v4 02/14] block/nvme: Avoid further processing if trace event not enabled

2020-08-12 Thread Philippe Mathieu-Daudé
Avoid further processing if TRACE_NVME_SUBMIT_COMMAND_RAW is not enabled. This is an untested intend of performance optimization. Reviewed-by: Stefan Hajnoczi Signed-off-by: Philippe Mathieu-Daudé --- block/nvme.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/block/nvme.c

[PATCH v3] block/nbd: use non-blocking connect: fix vm hang on connect()

2020-08-12 Thread Vladimir Sementsov-Ogievskiy
This make nbd connection_co to yield during reconnects, so that reconnect doesn't hang up the main thread. This is very important in case of unavailable nbd server host: connect() call may take a long time, blocking the main thread (and due to reconnect, it will hang again and again with small

Re: [PATCH for-5.2 v3 0/3] migration: Add block-bitmap-mapping parameter

2020-08-12 Thread Vladimir Sementsov-Ogievskiy
Now this doesn't apply, as code changed a lot after my series "[PATCH v4 for-5.1 00/21] Fix error handling during bitmap postcopy" merged first. I feel my responsibility for the mess with these series, so if you want I can try to rebase and post v4 of this one myself :) 12.08.2020 17:15, Max

Re: [PATCH for-5.2 v3 1/3] migration: Add block-bitmap-mapping parameter

2020-08-12 Thread Eric Blake
On 7/22/20 3:05 AM, Max Reitz wrote: This migration parameter allows mapping block node names and bitmap names to aliases for the purpose of block dirty bitmap migration. This way, management tools can use different node and bitmap names on the source and destination and pass the mapping of how

Re: [PATCH for-5.2 v3 0/3] migration: Add block-bitmap-mapping parameter

2020-08-12 Thread Max Reitz
Ping – seems like everyone found v2 more or less acceptable bar the failing assertion in patch 1, and some aspects of the test. How about v3, are there any objections? On 22.07.20 10:05, Max Reitz wrote: > RFC v1: https://lists.nongnu.org/archive/html/qemu-block/2020-05/msg00912.html > RFC v2:

Re: [PATCH v2 for 5.2 0/3] block: add logging facility for long standing IO requests

2020-08-12 Thread Stefan Hajnoczi
On Mon, Aug 10, 2020 at 01:14:44PM +0300, Denis V. Lunev wrote: > There are severe delays with IO requests processing if QEMU is running in > virtual machine or over software defined storage. Such delays potentially > results in unpredictable guest behavior. For example, guests over IDE or > SATA

Re: [PATCH v1 0/2] Add timeout mechanism to qmp actions

2020-08-12 Thread Stefan Hajnoczi
On Mon, Aug 10, 2020 at 10:52:44PM +0800, Zhenyu Ye wrote: > Before doing qmp actions, we need to lock the qemu_global_mutex, > so the qmp actions should not take too long time. > > Unfortunately, some qmp actions need to acquire aio context and > this may take a long time. The vm will soft

[PATCH 1/3] util/iov: add iov_discard_undo()

2020-08-12 Thread Stefan Hajnoczi
The iov_discard_front/back() operations are useful for parsing iovecs but they modify the array elements. If the original array is needed after parsing finishes there is currently no way to restore it. Although g_memdup() can be used before performing destructive iov_discard_front/back()

[PATCH 0/3] virtio: restore elem->in/out_sg after iov_discard_front/back()

2020-08-12 Thread Stefan Hajnoczi
Both virtio-blk and virtio-crypto use destructive iov_discard_front/back() operations on elem->in/out_sg. virtqueue_push() calls dma_memory_unmap() on t= he modified iovec arrays. The memory addresses may not match those originally mapped with dma_memory_map(). This raises several issues: 1.

[PATCH 3/3] virtio-crypto: don't modify elem->in/out_sg

2020-08-12 Thread Stefan Hajnoczi
A number of iov_discard_front/back() operations are made by virtio-crypto. The elem->in/out_sg iovec arrays are modified by these operations, resulting virtqueue_unmap_sg() calls on different addresses than were originally mapped. This is problematic because dirty memory may not be logged

[PATCH 2/3] virtio-blk: undo destructive iov_discard_*() operations

2020-08-12 Thread Stefan Hajnoczi
Fuzzing discovered that virtqueue_unmap_sg() is being called on modified req->in/out_sg iovecs. This means dma_memory_map() and dma_memory_unmap() calls do not have matching memory addresses. Fuzzing discovered that non-RAM addresses trigger a bug: void address_space_unmap(AddressSpace *as,

Re: [PATCH v2 3/6] migration: stop returning errno from load_snapshot()

2020-08-12 Thread Dr. David Alan Gilbert
* Daniel P. Berrangé (berra...@redhat.com) wrote: > None of the callers care about the errno value since there is a full > Error object populated. This gives consistency with save_snapshot() > which already just returns -1. > > Signed-off-by: Daniel P. Berrangé Reviewed-by: Dr. David Alan

Re: [PATCH v2 1/6] migration: improve error reporting of block driver state name

2020-08-12 Thread Dr. David Alan Gilbert
* Daniel P. Berrangé (berra...@redhat.com) wrote: > With blockdev, a BlockDriverState may not have a device name, > so using a node name is required as an alternative. > > Signed-off-by: Daniel P. Berrangé Reviewed-by: Dr. David Alan Gilbert > --- > migration/savevm.c | 12

Re: [PATCH] hw: add a number of SPI-flash's of m25p80 family

2020-08-12 Thread Cédric Le Goater
On 8/11/20 10:37 PM, Igor Kononenko wrote: > Support a following SPI flashes: > * mx66l51235f > * mt25ql512ab > > Signed-off-by: Igor Kononenko > --- > hw/block/m25p80.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c > index

Re: [PATCH v2] block: Raise an error when backing file parameter is an empty string

2020-08-12 Thread Kevin Wolf
Am 11.08.2020 um 23:23 hat Connor Kuehl geschrieben: > Providing an empty string for the backing file parameter like so: > > qemu-img create -f qcow2 -b '' /tmp/foo > > allows the flow of control to reach and subsequently fail an assert > statement because passing an empty string to > >