Re: [PATCH v2 00/15] hw/nvme: SR-IOV with Virtualization Enhancements

2021-11-24 Thread Klaus Jensen
Hi Lukasz, I've been through this. I have a couple of review comments, but overall looks good for inclusion in nvme-next. Would be nice to get this in early in the cycle so it can mature there for 7.0. I'd like that we mark this support experimental, so we can easily do some changes to how parame

Re: [PATCH 3/4] include/sysemu/blockdev.h: move drive_add and inline drive_def

2021-11-24 Thread Philippe Mathieu-Daudé
On 11/24/21 07:36, Emanuele Giuseppe Esposito wrote: > drive_add is only used in softmmu/vl.c, so it can be a static > function there, and drive_def is only a particular use case of > qemu_opts_parse_noisily, so it can be inlined. > > Also remove drive_mark_claimed_by_board, as it is only defined

Re: [PATCH 4/4] include/sysemu/blockdev.h: remove drive_get_max_devs

2021-11-24 Thread Philippe Mathieu-Daudé
On 11/24/21 07:36, Emanuele Giuseppe Esposito wrote: > Remove drive_get_max_devs, as it is not used by anyone. Maybe complete: Last use was removed in commit 8f2d75e81d5 ("hw: Drop superfluous special checks for orphaned -drive"). > Signed-off-by: Emanuele Giuseppe Esposito > --- > include

Re: [PATCH v2 12/15] hw/nvme: Initialize capability structures for primary/secondary controllers

2021-11-24 Thread Klaus Jensen
On Nov 16 16:34, Łukasz Gieryk wrote: > With four new properties: > - sriov_v{i,q}_flexible, > - sriov_max_v{i,q}_per_vf, > one can configure the number of available flexible resources, as well as > the limits. The primary and secondary controller capability structures > are initialized according

Re: [PATCH v2 13/15] hw/nvme: Add support for the Virtualization Management command

2021-11-24 Thread Klaus Jensen
On Nov 16 16:34, Łukasz Gieryk wrote: > With the new Virtualization Management command one can: > - assign flexible resources (queues, interrupts) to primary and >secondary controllers, > - toggle the online/offline state of given controller. > > Signed-off-by: Łukasz Gieryk > --- > hw/nvm

Re: [PATCH-for-6.2 v3 2/2] tests/qtest/fdc-test: Add a regression test for CVE-2021-20196

2021-11-24 Thread Philippe Mathieu-Daudé
On 11/23/21 15:14, Hanna Reitz wrote: > On 23.11.21 14:49, Philippe Mathieu-Daudé wrote: >> On 11/23/21 14:42, Hanna Reitz wrote: >>> On 18.11.21 13:06, Philippe Mathieu-Daudé wrote: From: Alexander Bulekov Without the previous commit, when running 'make check-qtest-i386' with

Questions about losing the write lock of raw-format disks after migration

2021-11-24 Thread Peng Liang via
Hi folks, When we test migration with raw-format disk, we found that the QEMU process in the dst will lose the write lock after migration. However, the QEMU process in the dst will still hold the write lock for qcow2-format disk. After reading some block layer's code, I found that the first blk_

Re: [PATCH-for-6.2 v3 2/2] tests/qtest/fdc-test: Add a regression test for CVE-2021-20196

2021-11-24 Thread Hanna Reitz
On 24.11.21 13:50, Philippe Mathieu-Daudé wrote: On 11/23/21 15:14, Hanna Reitz wrote: On 23.11.21 14:49, Philippe Mathieu-Daudé wrote: On 11/23/21 14:42, Hanna Reitz wrote: On 18.11.21 13:06, Philippe Mathieu-Daudé wrote: From: Alexander Bulekov Without the previous commit, when running 'm

[RFC for-6.2] block/nbd: forbid incompatible change of server options on reconnect

2021-11-24 Thread Vladimir Sementsov-Ogievskiy
Reconnect feature was never prepared to handle server options changed on reconnect. Let's be stricter and check what exactly is changed. If server capabilities just got richer don't worry. Otherwise fail and drop the established connection. Signed-off-by: Vladimir Sementsov-Ogievskiy --- Hi all!

Re: [PATCH v2 13/15] hw/nvme: Add support for the Virtualization Management command

2021-11-24 Thread Łukasz Gieryk
On Wed, Nov 24, 2021 at 09:06:23AM +0100, Klaus Jensen wrote: > On Nov 16 16:34, Łukasz Gieryk wrote: > > With the new Virtualization Management command one can: > > - assign flexible resources (queues, interrupts) to primary and > >secondary controllers, > > - toggle the online/offline state

Re: [PATCH v2 12/15] hw/nvme: Initialize capability structures for primary/secondary controllers

2021-11-24 Thread Łukasz Gieryk
On Wed, Nov 24, 2021 at 09:04:31AM +0100, Klaus Jensen wrote: > On Nov 16 16:34, Łukasz Gieryk wrote: > > With four new properties: > > - sriov_v{i,q}_flexible, > > - sriov_max_v{i,q}_per_vf, > > one can configure the number of available flexible resources, as well as > > the limits. The primary

Re: [PATCH-for-6.2 v3 2/2] tests/qtest/fdc-test: Add a regression test for CVE-2021-20196

2021-11-24 Thread Philippe Mathieu-Daudé
On 11/24/21 15:00, Hanna Reitz wrote: > On 24.11.21 13:50, Philippe Mathieu-Daudé wrote: >> On 11/23/21 15:14, Hanna Reitz wrote: >>> On 23.11.21 14:49, Philippe Mathieu-Daudé wrote: On 11/23/21 14:42, Hanna Reitz wrote: > On 18.11.21 13:06, Philippe Mathieu-Daudé wrote: >> From: Alexa

[PATCH v4 0/3] hw/block/fdc: Fix CVE-2021-20196

2021-11-24 Thread Philippe Mathieu-Daudé
Since v3: - Preliminary extract blk_create_empty_drive() - qtest checks qtest_check_clang_sanitizer() enabled - qtest uses null-co:// driver instead of file Philippe Mathieu-Daudé (3): hw/block/fdc: Extract blk_create_empty_drive() hw/block/fdc: Kludge missing floppy drive to fix CVE-2021-2019

[PATCH v4 1/3] hw/block/fdc: Extract blk_create_empty_drive()

2021-11-24 Thread Philippe Mathieu-Daudé
We are going to re-use this code in the next commit, so extract it as a new blk_create_empty_drive() function. Inspired-by: Hanna Reitz Signed-off-by: Philippe Mathieu-Daudé --- hw/block/fdc.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/hw/block/fdc.c b/hw/block

[PATCH v4 3/3] tests/qtest/fdc-test: Add a regression test for CVE-2021-20196

2021-11-24 Thread Philippe Mathieu-Daudé
Without the previous commit, when running 'make check-qtest-i386' with QEMU configured with '--enable-sanitizers' we get: AddressSanitizer:DEADLYSIGNAL = ==287878==ERROR: AddressSanitizer: SEGV on unknown address 0x0344

[PATCH v4 2/3] hw/block/fdc: Kludge missing floppy drive to fix CVE-2021-20196

2021-11-24 Thread Philippe Mathieu-Daudé
Guest might select another drive on the bus by setting the DRIVE_SEL bit of the DIGITAL OUTPUT REGISTER (DOR). The current controller model doesn't expect a BlockBackend to be NULL. A simple way to fix CVE-2021-20196 is to create an empty BlockBackend when it is missing. All further accesses will b

Re: [RFC PATCH v3] hw/nvme:Adding Support for namespace management

2021-11-24 Thread Lukasz Maniak
On Tue, Nov 23, 2021 at 11:11:37AM +0100, Lukasz Maniak wrote: > On Wed, Nov 10, 2021 at 04:56:29PM +0530, Naveen wrote: > > From: Naveen Nagar > > > > This patch supports namespace management : create and delete operations > > This patch has been tested with the following command and size of ima

[PATCH 01/23] python/aqmp: add __del__ method to legacy interface

2021-11-24 Thread John Snow
asyncio can complain *very* loudly if you forget to back out of things gracefully before the garbage collector starts destroying objects that contain live references to asyncio Tasks. The usual fix is just to remember to call aqmp.disconnect(), but for the sake of the legacy wrapper and quick, one

[PATCH 04/23] python/aqmp: add SocketAddrT to package root

2021-11-24 Thread John Snow
It's a commonly needed definition, it can be re-exported by the root. Signed-off-by: John Snow --- python/qemu/aqmp/__init__.py | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/python/qemu/aqmp/__init__.py b/python/qemu/aqmp/__init__.py index 880d5b6fa7..c6fa2dda58 1

[PATCH 05/23] python/qemu-ga-client: update instructions to newer CLI syntax

2021-11-24 Thread John Snow
Signed-off-by: John Snow --- python/qemu/qmp/qemu_ga_client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/qemu/qmp/qemu_ga_client.py b/python/qemu/qmp/qemu_ga_client.py index 67ac0b4211..b3e1d98c9e 100644 --- a/python/qemu/qmp/qemu_ga_client.py +++ b/python/qemu/q

[PATCH 02/23] python/aqmp: handle asyncio.TimeoutError on execute()

2021-11-24 Thread John Snow
This exception can be injected into any await statement. If we are canceled via timeout, we want to clear the pending execution record on our way out. Signed-off-by: John Snow --- python/qemu/aqmp/qmp_client.py | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/python/qe

[PATCH 03/23] python/aqmp: copy type definitions from qmp

2021-11-24 Thread John Snow
Copy the remaining type definitions from QMP into the qemu.aqmp.legacy module. Now, most users don't need to import anything else but qemu.aqmp.legacy. Signed-off-by: John Snow --- python/qemu/aqmp/legacy.py | 22 -- python/qemu/aqmp/protocol.py | 16 ++-- 2 fil

[PATCH 09/23] python: move qmp utilities to python/qemu/utils

2021-11-24 Thread John Snow
In order to upload a QMP package to PyPI, I want to remove any scripts that I am not 100% confident I want to support upstream, beyond our castle walls. Move most of our QMP utilities into the utils package so we can split them out from the PyPI upload. Signed-off-by: John Snow --- python/qemu/

[PATCH 08/23] python/qmp: switch qmp-shell to AQMP

2021-11-24 Thread John Snow
We have a replacement for async QMP, but it doesn't have feature parity yet. For now, then, port the old tool onto the new backend. Signed-off-by: John Snow --- python/qemu/aqmp/legacy.py | 3 +++ python/qemu/qmp/qmp_shell.py | 31 +-- 2 files changed, 20 insertion

[PATCH 07/23] python/qmp: switch qom tools to AQMP

2021-11-24 Thread John Snow
Signed-off-by: John Snow --- python/qemu/qmp/qom.py| 5 +++-- python/qemu/qmp/qom_common.py | 7 --- python/qemu/qmp/qom_fuse.py | 11 ++- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/python/qemu/qmp/qom.py b/python/qemu/qmp/qom.py index 8ff28a8343..bb5

[PATCH 00/23] Python: delete qemu.qmp package

2021-11-24 Thread John Snow
GitLab: https://gitlab.com/jsnow/qemu/-/commits/python-qmp-legacy-switch CI: https://gitlab.com/jsnow/qemu/-/pipelines/415801786 NOT intended for 6.2. This series swaps out qemu.qmp for qemu.aqmp permanently, instead of hiding it behind an environment variable toggle. This leaves us with just one

[PATCH 06/23] python/qmp: switch qemu-ga-client to AQMP

2021-11-24 Thread John Snow
Signed-off-by: John Snow --- python/qemu/qmp/qemu_ga_client.py | 22 +++--- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/python/qemu/qmp/qemu_ga_client.py b/python/qemu/qmp/qemu_ga_client.py index b3e1d98c9e..15ed430c61 100644 --- a/python/qemu/qmp/qemu_ga_clie

[PATCH 11/23] python/machine: permanently switch to AQMP

2021-11-24 Thread John Snow
Remove the QEMU_PYTHON_LEGACY_QMP environment variable, making the switch permanent. Update Exceptions and import paths as necessary. Signed-off-by: John Snow --- python/qemu/machine/machine.py | 18 +++--- python/qemu/machine/qtest.py | 2 +- 2 files changed, 8 insertions(+), 12

[PATCH 10/23] python: move qmp-shell under the AQMP package

2021-11-24 Thread John Snow
Signed-off-by: John Snow --- python/README.rst | 2 +- python/qemu/{qmp => aqmp}/qmp_shell.py | 0 python/setup.cfg | 2 +- scripts/qmp/qmp-shell | 2 +- 4 files changed, 3 insertions(+), 3 deletions(-) rename python/qemu/{qmp => aqmp}/

[PATCH 16/23] iotests/mirror-top-perms: switch to AQMP

2021-11-24 Thread John Snow
Signed-off-by: John Snow --- Note: I still need to adjust the logging. The problem now is that the logging messages include the PID of the test process, so they need to be filtered out. I'll investigate that for a follow-up, or for v2. I could just add yet another filtering function somewhere,

[PATCH 17/23] iotests: switch to AQMP

2021-11-24 Thread John Snow
Simply import the type defition from the new location. Signed-off-by: John Snow --- tests/qemu-iotests/iotests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 83bfedb902..cb21aebe36 100644 --- a/tests/qemu

[PATCH 15/23] scripts/bench-block-job: switch to AQMP

2021-11-24 Thread John Snow
For this commit, we only need to remove accommodations for the synchronous QMP library. Signed-off-by: John Snow --- scripts/simplebench/bench_block_job.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/simplebench/bench_block_job.py b/scripts/simplebench/bench_bl

[PATCH 14/23] scripts/render-block-graph: switch to AQMP

2021-11-24 Thread John Snow
Creating an instance of qemu.aqmp.ExecuteError is too involved here, so just drop the specificity down to a generic AQMPError. Signed-off-by: John Snow --- scripts/render_block_graph.py | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/scripts/render_block_graph.py b/sc

[PATCH 21/23] python/aqmp: copy qmp docstrings to qemu.aqmp.legacy

2021-11-24 Thread John Snow
Copy the docstrings out of qemu.qmp, adjusting them as necessary to more accurately reflect the current state of this class. Signed-off-by: John Snow --- python/qemu/aqmp/legacy.py | 110 ++--- 1 file changed, 102 insertions(+), 8 deletions(-) diff --git a/python

[PATCH 23/23] python: re-enable pylint duplicate-code warnings

2021-11-24 Thread John Snow
With the old library gone, there's nothing duplicated in the tree, so the warning suppression can be removed. Signed-off-by: John Snow --- python/setup.cfg | 1 - 1 file changed, 1 deletion(-) diff --git a/python/setup.cfg b/python/setup.cfg index 5140a5b322..c341e922c2 100644 --- a/python/setu

[PATCH 19/23] python/aqmp: take QMPBadPortError and parse_address from qemu.qmp

2021-11-24 Thread John Snow
Shift these definitions over from the qmp package to the async qmp package. Signed-off-by: John Snow --- python/qemu/aqmp/aqmp_tui.py | 2 +- python/qemu/aqmp/legacy.py | 30 ++ python/qemu/qmp/__init__.py | 26 -- 3 files changed, 27 inser

[PATCH 18/23] python: temporarily silence pylint duplicate-code warnings

2021-11-24 Thread John Snow
The next several commits copy some code from qemu.qmp to qemu.aqmp, then delete qemu.qmp. In the interim, to prevent test failures, the duplicate code detection needs to be silenced to prevent bisect problems with CI testing. Signed-off-by: John Snow --- python/setup.cfg | 1 + 1 file changed, 1

[PATCH 12/23] scripts/cpu-x86-uarch-abi: fix CLI parsing

2021-11-24 Thread John Snow
Signed-off-by: John Snow --- scripts/cpu-x86-uarch-abi.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/cpu-x86-uarch-abi.py b/scripts/cpu-x86-uarch-abi.py index 08acc52a81..8963d90f0b 100644 --- a/scripts/cpu-x86-uarch-abi.py +++ b/scripts/cpu-x86-uarch-abi.py @@

[PATCH 13/23] scripts/cpu-x86-uarch-abi: switch to AQMP

2021-11-24 Thread John Snow
Signed-off-by: John Snow --- scripts/cpu-x86-uarch-abi.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/cpu-x86-uarch-abi.py b/scripts/cpu-x86-uarch-abi.py index 8963d90f0b..c262d2f027 100644 --- a/scripts/cpu-x86-uarch-abi.py +++ b/scripts/cpu-x86-uarch-abi.py @

[PATCH 22/23] python: remove the old QMP package

2021-11-24 Thread John Snow
Thank you for your service! Signed-off-by: John Snow --- python/PACKAGE.rst | 4 +- python/README.rst | 2 +- python/qemu/qmp/README.rst | 9 - python/qemu/qmp/__init__.py | 396 python/qemu/qmp/py.typed| 0 python/setup.cfg

[PATCH 20/23] python/aqmp: fully separate from qmp.QEMUMonitorProtocol

2021-11-24 Thread John Snow
After this patch, qemu.aqmp.legacy.QEMUMonitorProtocol no longer inherits from qemu.qmp.QEMUMonitorProtocol. To do this, several inherited methods need to be explicitly re-defined. Signed-off-by: John Snow --- python/qemu/aqmp/legacy.py | 38 -- 1 file changed

Re: [PATCH v4 0/3] hw/block/fdc: Fix CVE-2021-20196

2021-11-24 Thread John Snow
On Wed, Nov 24, 2021 at 11:15 AM Philippe Mathieu-Daudé wrote: > Since v3: > - Preliminary extract blk_create_empty_drive() > - qtest checks qtest_check_clang_sanitizer() enabled > - qtest uses null-co:// driver instead of file > > Philippe Mathieu-Daudé (3): > hw/block/fdc: Extract blk_create_

Re: [PATCH-for-6.2 2/2] tests/qtest/fdc-test: Add a regression test for CVE-2021-3507

2021-11-24 Thread John Snow
On Tue, Nov 23, 2021 at 11:08 AM Hanna Reitz wrote: > On 18.11.21 12:57, Philippe Mathieu-Daudé wrote: > > Add the reproducer from > https://gitlab.com/qemu-project/qemu/-/issues/339 > > > > Without the previous commit, when running 'make check-qtest-i386' > > with QEMU configured with '--enable-

[PATCH for-7.0 0/4] hw/nvme: zoned random write area

2021-11-24 Thread Klaus Jensen
From: Klaus Jensen This series adds support for a zoned random write area as standardized in TP 4076 ("Zoned Random Write Area"). Klaus Jensen (4): hw/nvme: add struct for zone management send hw/nvme: add zone attribute get/set helpers hw/nvme: add ozcs enum hw/nvme: add support for zon

[PATCH for-7.0 1/4] hw/nvme: add struct for zone management send

2021-11-24 Thread Klaus Jensen
From: Klaus Jensen Add struct for Zone Management Send in preparation for more zone send flags. Signed-off-by: Klaus Jensen --- hw/nvme/ctrl.c | 10 -- include/block/nvme.h | 18 ++ 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/hw/nvme/ctrl.c b/h

[PATCH for-7.0 2/4] hw/nvme: add zone attribute get/set helpers

2021-11-24 Thread Klaus Jensen
From: Klaus Jensen Add some get/set helpers for zone attributes. Signed-off-by: Klaus Jensen --- hw/nvme/ctrl.c | 4 ++-- include/block/nvme.h | 4 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c index 489d586ab9d7..7ac6ec50a0d1 100644

[PATCH for-7.0 3/4] hw/nvme: add ozcs enum

2021-11-24 Thread Klaus Jensen
From: Klaus Jensen Add enumeration for OZCS values. Signed-off-by: Klaus Jensen --- hw/nvme/ns.c | 3 ++- include/block/nvme.h | 4 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/hw/nvme/ns.c b/hw/nvme/ns.c index 8b5f98c76180..356b6c1c2f14 100644 --- a/hw/nvme/ns.c

[PATCH for-7.0 4/4] hw/nvme: add support for zoned random write area

2021-11-24 Thread Klaus Jensen
From: Klaus Jensen Add support for TP 4076 ("Zoned Random Write Area"), v2021.08.23 ("Ratified"). This adds three new namespace parameters: "zoned.numzrwa" (number of zrwa resources, i.e. number of zones that can have a zrwa), "zoned.zrwas" (zrwa size in LBAs), "zoned.zrwafg" (granularity in LBA