[PATCH v10 11/12] hw/block/nvme: Add injection of Offline/Read-Only zones

2020-11-06 Thread Dmitry Fomichev
ZNS specification defines two zone conditions for the zones that no longer can function properly, possibly because of flash wear or other internal fault. It is useful to be able to "inject" a small number of such zones for testing purposes. This commit defines two optional device properties,

[PATCH v10 07/12] block/nvme: Make ZNS-related definitions

2020-11-06 Thread Dmitry Fomichev
Define values and structures that are needed to support Zoned Namespace Command Set (NVMe TP 4053). Signed-off-by: Dmitry Fomichev --- include/block/nvme.h | 114 ++- 1 file changed, 113 insertions(+), 1 deletion(-) diff --git a/include/block/nvme.h

[PATCH v10 12/12] hw/block/nvme: Document zoned parameters in usage text

2020-11-06 Thread Dmitry Fomichev
Added brief descriptions of the new device properties that are now available to users to configure features of Zoned Namespace Command Set in the emulator. This patch is for documentation only, no functionality change. Signed-off-by: Dmitry Fomichev Reviewed-by: Niklas Cassel ---

[PATCH v10 08/12] hw/block/nvme: Support Zoned Namespace Command Set

2020-11-06 Thread Dmitry Fomichev
The emulation code has been changed to advertise NVM Command Set when "zoned" device property is not set (default) and Zoned Namespace Command Set otherwise. Define values and structures that are needed to support Zoned Namespace Command Set (NVMe TP 4053) in PCI NVMe controller emulator. Define

[PATCH v10 06/12] hw/block/nvme: Support allocated CNS command variants

2020-11-06 Thread Dmitry Fomichev
From: Niklas Cassel Many CNS commands have "allocated" command variants. These include a namespace as long as it is allocated, that is a namespace is included regardless if it is active (attached) or not. While these commands are optional (they are mandatory for controllers supporting the

[PATCH v10 09/12] hw/block/nvme: Introduce max active and open zone limits

2020-11-06 Thread Dmitry Fomichev
Add two module properties, "zoned.max_active" and "zoned.max_open" to control the maximum number of zones that can be active or open. Once these variables are set to non-default values, these limits are checked during I/O and Too Many Active or Too Many Open command status is returned if they are

[PATCH v10 10/12] hw/block/nvme: Support Zone Descriptor Extensions

2020-11-06 Thread Dmitry Fomichev
Zone Descriptor Extension is a label that can be assigned to a zone. It can be set to an Empty zone and it stays assigned until the zone is reset. This commit adds a new optional module property, "zoned.descr_ext_size". Its value must be a multiple of 64 bytes. If this value is non-zero, it

[PATCH v10 05/12] hw/block/nvme: Add support for Namespace Types

2020-11-06 Thread Dmitry Fomichev
From: Niklas Cassel Define the structures and constants required to implement Namespace Types support. Namespace Types introduce a new command set, "I/O Command Sets", that allows the host to retrieve the command sets associated with a namespace. Introduce support for the command set and enable

[PATCH v10 03/12] hw/block/nvme: Separate read and write handlers

2020-11-06 Thread Dmitry Fomichev
With ZNS support in place, the majority of code in nvme_rw() has become read- or write-specific. Move these parts to two separate handlers, nvme_read() and nvme_write() to make the code more readable and to remove multiple is_write checks that so far existed in the i/o path. This is a refactoring

[PATCH v10 04/12] hw/block/nvme: Merge nvme_write_zeroes() with nvme_write()

2020-11-06 Thread Dmitry Fomichev
nvme_write() now handles WRITE, WRITE ZEROES and ZONE_APPEND. Signed-off-by: Dmitry Fomichev Reviewed-by: Niklas Cassel Acked-by: Klaus Jensen --- hw/block/nvme.c | 72 +-- hw/block/trace-events | 1 - 2 files changed, 28 insertions(+), 45

[PATCH v10 00/12] hw/block/nvme: Support Namespace Types and Zoned Namespace Command Set

2020-11-06 Thread Dmitry Fomichev
v9 -> v10: - Correctly check for MDTS in Zone Management Receive handler. - Change Klaus' "Reviewed-by" email in UUID patch. v8 -> v9: - Move the modifications to "include/block/nvme.h" made to introduce ZNS-related definitions to a separate patch. - Add a new struct, NvmeZonedResult,

[PATCH v10 01/12] hw/block/nvme: Add Commands Supported and Effects log

2020-11-06 Thread Dmitry Fomichev
This log page becomes necessary to implement to allow checking for Zone Append command support in Zoned Namespace Command Set. This commit adds the code to report this log page for NVM Command Set only. The parts that are specific to zoned operation will be added later in the series. All

[PATCH v10 02/12] hw/block/nvme: Generate namespace UUIDs

2020-11-06 Thread Dmitry Fomichev
In NVMe 1.4, a namespace must report an ID descriptor of UUID type if it doesn't support EUI64 or NGUID. Add a new namespace property, "uuid", that provides the user the option to either specify the UUID explicitly or have a UUID generated automatically every time a namespace is initialized.

RE: [PATCH v9 08/12] hw/block/nvme: Support Zoned Namespace Command Set

2020-11-06 Thread Dmitry Fomichev
> -Original Message- > From: Niklas Cassel > Sent: Friday, November 6, 2020 6:59 AM > To: Dmitry Fomichev > Cc: Keith Busch ; Klaus Jensen > ; Kevin Wolf ; Philippe > Mathieu-Daudé ; Max Reitz ; > Maxim Levitsky ; Fam Zheng ; > Alistair Francis ; Matias Bjorling > ; Damien Le Moal ; >

[PATCH v2 2/2] quorum: Implement bdrv_co_pwrite_zeroes()

2020-11-06 Thread Alberto Garcia
This simply calls bdrv_co_pwrite_zeroes() in all children Signed-off-by: Alberto Garcia --- block/quorum.c | 18 -- tests/qemu-iotests/312 | 7 +++ tests/qemu-iotests/312.out | 4 3 files changed, 27 insertions(+), 2 deletions(-) diff --git

[PATCH v2 0/2] quorum: Implement bdrv_co_block_status()

2020-11-06 Thread Alberto Garcia
Hi, The first patch is the same as in v1, but now that we're at it I decided to also implement bdrv_co_pwrite_zeroes() Berto v2: - Implement bdrv_co_pwrite_zeroes() for quorum v1: https://lists.gnu.org/archive/html/qemu-block/2020-11/msg00163.html Alberto Garcia (2): quorum: Implement

[PATCH v2 1/2] quorum: Implement bdrv_co_block_status()

2020-11-06 Thread Alberto Garcia
The quorum driver does not implement bdrv_co_block_status() and because of that it always reports to contain data even if all its children are known to be empty. One consequence of this is that if we for example create a quorum with a size of 10GB and we mirror it to a new image the operation

Re: [PATCH 0/2] Increase amount of data for monitor to read

2020-11-06 Thread Andrey Shinkevich
Please exclude this address when reply: jc...@redhat.com Andrey

Re: [PATCH v2 2/7] block: add bdrv_replace_node_common()

2020-11-06 Thread Alberto Garcia
On Fri 06 Nov 2020 01:42:36 PM CET, Vladimir Sementsov-Ogievskiy wrote: > Add new parameter to bdrv_replace_node(): auto_skip. With > auto_skip=false we'll have stricter behavior: update _all_ from > parents or fail. New behaviour will be used in the following commit in > block.c, so keep original

Re: [PATCH v2 4/7] block: add bdrv_refresh_perms() helper

2020-11-06 Thread Alberto Garcia
On Fri 06 Nov 2020 01:42:38 PM CET, Vladimir Sementsov-Ogievskiy wrote: > Make separate function for common pattern. > > Signed-off-by: Vladimir Sementsov-Ogievskiy > --- > block.c | 60 - > 1 file changed, 30 insertions(+), 30 deletions(-)

Re: [PATCH v2 3/7] block: make bdrv_drop_intermediate() less wrong

2020-11-06 Thread Alberto Garcia
On Fri 06 Nov 2020 01:42:37 PM CET, Vladimir Sementsov-Ogievskiy wrote: > First, permission update loop tries to do iterations transactionally, > but the whole update is not transactional: nobody roll-back successful > loop iterations when some iteration fails. > > Second, in the iteration we have

[PATCH 2/2] monitor: increase amount of data for monitor to read

2020-11-06 Thread Andrey Shinkevich via
QMP and HMP monitors read one byte at a time from the socket or stdin, which is very inefficient. With 100+ VMs on the host, this results in multiple extra system calls and CPU overuse. This patch increases the amount of read data up to 4096 bytes that fits the buffer size on the channel level.

Re: [PATCH v2 1/7] block: add forgotten bdrv_abort_perm_update() to bdrv_co_invalidate_cache()

2020-11-06 Thread Alberto Garcia
On Fri 06 Nov 2020 01:42:35 PM CET, Vladimir Sementsov-Ogievskiy wrote: > Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Alberto Garcia Berto

[PATCH v2 6/7] block: bdrv_child_set_perm() drop redundant parameters.

2020-11-06 Thread Vladimir Sementsov-Ogievskiy
We must set the permission used for _check_. Assert that we have backup and drop extra arguments. Signed-off-by: Vladimir Sementsov-Ogievskiy --- block.c | 15 --- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/block.c b/block.c index b61d20252f..b44db05d14 100644

[PATCH v2 1/7] block: add forgotten bdrv_abort_perm_update() to bdrv_co_invalidate_cache()

2020-11-06 Thread Vladimir Sementsov-Ogievskiy
Signed-off-by: Vladimir Sementsov-Ogievskiy --- block.c | 1 + 1 file changed, 1 insertion(+) diff --git a/block.c b/block.c index 56bacc9e9f..19db7b7aeb 100644 --- a/block.c +++ b/block.c @@ -5782,6 +5782,7 @@ int coroutine_fn bdrv_co_invalidate_cache(BlockDriverState *bs, Error **errp)

[PATCH v2 2/7] block: add bdrv_replace_node_common()

2020-11-06 Thread Vladimir Sementsov-Ogievskiy
Add new parameter to bdrv_replace_node(): auto_skip. With auto_skip=false we'll have stricter behavior: update _all_ from parents or fail. New behaviour will be used in the following commit in block.c, so keep original function name as public interface. Note: new error message is a bit funny in

[PATCH v2 7/7] block: drop tighten_restrictions

2020-11-06 Thread Vladimir Sementsov-Ogievskiy
The only users of this thing are: 1. bdrv_child_try_set_perm, to ignore failures on loosen restrictions 2. assertion in bdrv_replace_child 3. assertion in bdrv_inactivate_recurse Assertions are not enough reason for overcomplication the permission update system. So, look at

[PATCH v2 3/7] block: make bdrv_drop_intermediate() less wrong

2020-11-06 Thread Vladimir Sementsov-Ogievskiy
First, permission update loop tries to do iterations transactionally, but the whole update is not transactional: nobody roll-back successful loop iterations when some iteration fails. Second, in the iteration we have nested permission update: c->klass->update_filename may point to

[PATCH v2 0/7] block: permission update fix & refactor

2020-11-06 Thread Vladimir Sementsov-Ogievskiy
Hi all! These series supersedes "Fix nested permission update" and includes one more fix (patch 01) and more improvements. I think patch 01 is good to have in 5.2, 02 is probably OK for 5.2 and the others are OK for next release. Still all may be taken to 5.2, up to block maintainers. Actually

[PATCH 1/2] iotests: add another bash sleep command to 247

2020-11-06 Thread Andrey Shinkevich via
This patch paves the way for the one that follows. The following patch makes the QMP monitor to read up to 4K from stdin at once. That results in running the bash 'sleep' command before the _qemu_proc_exec() starts in subshell. Another 'sleep' command with an unobtrusive 'query-status' plays as a

[PATCH v2 5/7] block: bdrv_set_perm() drop redundant parameters.

2020-11-06 Thread Vladimir Sementsov-Ogievskiy
We should never set permissions other than cumulative permissions of parents. During bdrv_reopen_multiple() we _check_ for synthetic permissions but when we do _set_ the graph is already updated. Add an assertion to bdrv_reopen_multiple(), other cases are more obvious. Signed-off-by: Vladimir

[PATCH v2 4/7] block: add bdrv_refresh_perms() helper

2020-11-06 Thread Vladimir Sementsov-Ogievskiy
Make separate function for common pattern. Signed-off-by: Vladimir Sementsov-Ogievskiy --- block.c | 60 - 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/block.c b/block.c index 77a3f8f1e2..fc7633307f 100644 --- a/block.c

[PATCH 0/2] Increase amount of data for monitor to read

2020-11-06 Thread Andrey Shinkevich via
The subject was discussed here: https://lists.gnu.org/archive/html/qemu-devel/2017-05/msg00206.html This series is a solution for the issue with QMP monitor buffered input. A little parser is introduced to throttle JSON commands read from the buffer so that QMP requests do not overwhelm the

Re: [PATCH v9 08/12] hw/block/nvme: Support Zoned Namespace Command Set

2020-11-06 Thread Niklas Cassel
On Thu, Nov 05, 2020 at 11:53:38AM +0900, Dmitry Fomichev wrote: > The emulation code has been changed to advertise NVM Command Set when > "zoned" device property is not set (default) and Zoned Namespace > Command Set otherwise. > > Define values and structures that are needed to support Zoned >

Re: [PATCH 1/2] block: make bdrv_drop_intermediate() less wrong

2020-11-06 Thread Vladimir Sementsov-Ogievskiy
05.11.2020 18:14, Alberto Garcia wrote: On Sat 31 Oct 2020 01:35:01 PM CET, Vladimir Sementsov-Ogievskiy wrote: -QLIST_FOREACH_SAFE(c, >parents, next_parent, next) { /* ... */ +QLIST_FOREACH_SAFE(c, >parents, next_parent, next) { I also wonder, is top->parents and base->parents