Re: [PATCH v4 2/2] nvme: allow cmb and pmr to be enabled on same device

2020-07-07 Thread Andrzej Jakowski
On 7/6/20 12:15 AM, Klaus Jensen wrote: > On Jul 2 16:33, Andrzej Jakowski wrote: >> On 7/2/20 10:51 AM, Klaus Jensen wrote: >>> On Jul 2 08:07, Andrzej Jakowski wrote: On 7/2/20 3:31 AM, Klaus Jensen wrote: > Aight, an update here. This only happens when QEMU is run with a virtual

Re: [PATCH] MAINTAINERS: update nvme entry

2020-07-07 Thread Klaus Jensen
On Jul 7 08:30, Philippe Mathieu-Daudé wrote: > On 7/6/20 9:43 PM, Keith Busch wrote: > > The nvme emulated device development pace has increased recently. Klaus > > has offered to co-maintain, and since we have many new contributions > > coming through, we're adding a repository to accumulate

Re: [PATCH v3 07/44] qemu-option: Make uses of find_desc_by_name() more similar

2020-07-07 Thread Greg Kurz
On Mon, 6 Jul 2020 10:09:13 +0200 Markus Armbruster wrote: > This is to make the next commit easier to review. > > Signed-off-by: Markus Armbruster > Reviewed-by: Eric Blake > Reviewed-by: Vladimir Sementsov-Ogievskiy > --- Reviewed-by: Greg Kurz > util/qemu-option.c | 32

Re: [PATCH] trivial: Remove trailing whitespaces

2020-07-07 Thread David Gibson
On Mon, Jul 06, 2020 at 06:23:00PM +0200, Christophe de Dinechin wrote: > There are a number of unnecessary trailing whitespaces that have > accumulated over time in the source code. They cause stray changes > in patches if you use tools that automatically remove them. > > Tested by doing a `git

Re: [PATCH 0/1] hw/block/nvme: fix assert on invalid irq vector

2020-07-07 Thread Klaus Jensen
On Jul 7 12:10, Maxim Levitsky wrote: > On Tue, 2020-06-09 at 17:32 +0200, Kevin Wolf wrote: > > Am 09.06.2020 um 16:18 hat Philippe Mathieu-Daudé geschrieben: > > > On 6/9/20 4:14 PM, Kevin Wolf wrote: > > > > Am 09.06.2020 um 13:46 hat Klaus Jensen geschrieben: > > > > > On Jun 9 13:17,

Re: [PATCH 1/3] qemu: implementation of transient option for qcow2 file

2020-07-07 Thread Peter Krempa
On Mon, Jul 06, 2020 at 14:20:23 -0400, Masayoshi Mizuma wrote: > From: Masayoshi Mizuma > > Here is the implementation of transient option for qcow2 file. > This gets available directive in domain xml file > like as: > > > > > > > > > The internal

Re: [PATCH] MAINTAINERS: update nvme entry

2020-07-07 Thread Klaus Jensen
On Jul 6 12:43, Keith Busch wrote: > The nvme emulated device development pace has increased recently. Klaus > has offered to co-maintain, and since we have many new contributions > coming through, we're adding a repository to accumulate and test new > features. > > Cc: Klaus Jensen >

Re: [PATCH 2/6] migration: introduce savevm, loadvm, delvm QMP commands

2020-07-07 Thread Peter Krempa
On Mon, Jul 06, 2020 at 18:15:55 +0200, Kevin Wolf wrote: > Am 03.07.2020 um 18:02 hat Daniel P. Berrangé geschrieben: > > On Fri, Jul 03, 2020 at 04:49:33PM +0100, Dr. David Alan Gilbert wrote: > > > * Daniel P. Berrangé (berra...@redhat.com) wrote: > > > > On Thu, Jul 02, 2020 at 01:12:52PM

Re: [PATCH v7 05/17] hw/sd/sdcard: Do not switch to ReceivingData if address is invalid

2020-07-07 Thread Philippe Mathieu-Daudé
On Tue, Jun 30, 2020 at 3:39 PM Philippe Mathieu-Daudé wrote: > > Only move the state machine to ReceivingData if there is no > pending error. This avoids later OOB access while processing > commands queued. > > "SD Specifications Part 1 Physical Layer Simplified Spec. v3.01" > > 4.3.3 Data

Re: [PATCH 0/1] hw/block/nvme: fix assert on invalid irq vector

2020-07-07 Thread Maxim Levitsky
On Tue, 2020-06-09 at 17:32 +0200, Kevin Wolf wrote: > Am 09.06.2020 um 16:18 hat Philippe Mathieu-Daudé geschrieben: > > On 6/9/20 4:14 PM, Kevin Wolf wrote: > > > Am 09.06.2020 um 13:46 hat Klaus Jensen geschrieben: > > > > On Jun 9 13:17, Philippe Mathieu-Daudé wrote: > > > > > On 6/9/20

Re: [PATCH 0/6] migration: bring savevm/loadvm/delvm over to QMP

2020-07-07 Thread Daniel P . Berrangé
On Mon, Jul 06, 2020 at 06:21:56PM +0200, Kevin Wolf wrote: > Am 06.07.2020 um 18:03 hat Daniel P. Berrangé geschrieben: > > On Mon, Jul 06, 2020 at 05:50:11PM +0200, Kevin Wolf wrote: > > > Am 06.07.2020 um 17:29 hat Daniel P. Berrangé geschrieben: > > > > On Mon, Jul 06, 2020 at 05:27:01PM

Re: [PATCH 3/3] qemublocktest: add test of transient option for qcow2 disk

2020-07-07 Thread Peter Krempa
On Mon, Jul 06, 2020 at 14:20:25 -0400, Masayoshi Mizuma wrote: > From: Masayoshi Mizuma > > Add a unit test for transient option for qcow2 file. > > Signed-off-by: Masayoshi Mizuma > --- > tests/qemublocktest.c | 10 ++ >

Re: [PATCH v3 06/44] qemu-option: Check return value instead of @err where convenient

2020-07-07 Thread Greg Kurz
On Mon, 06 Jul 2020 22:01:38 +0200 Markus Armbruster wrote: > Greg Kurz writes: > > > On Mon, 6 Jul 2020 10:09:12 +0200 > > Markus Armbruster wrote: > > > >> Convert uses like > >> > >> opts = qemu_opts_create(..., ); > >> if (err) { > >> ... > >> } > >> > >> to > >> >

Re: [PATCH 5/6] migration: support excluding block devs in QMP snapshot commands

2020-07-07 Thread Daniel P . Berrangé
On Mon, Jul 06, 2020 at 05:57:08PM +0200, Kevin Wolf wrote: > Am 02.07.2020 um 19:57 hat Daniel P. Berrangé geschrieben: > > This wires up support for a new "exclude" parameter to the QMP commands > > for snapshots (savevm, loadvm, delvm). This parameter accepts a list of > > block driver state

Re: [PATCH] MAINTAINERS: update nvme entry

2020-07-07 Thread Philippe Mathieu-Daudé
On 7/6/20 9:43 PM, Keith Busch wrote: > The nvme emulated device development pace has increased recently. Klaus > has offered to co-maintain, and since we have many new contributions > coming through, we're adding a repository to accumulate and test new > features. Thanks Klaus for helping! >

Re: [PATCH v3 08/44] qemu-option: Factor out helper find_default_by_name()

2020-07-07 Thread Greg Kurz
On Mon, 6 Jul 2020 10:09:14 +0200 Markus Armbruster wrote: > Signed-off-by: Markus Armbruster > Reviewed-by: Eric Blake > Reviewed-by: Vladimir Sementsov-Ogievskiy > --- > util/qemu-option.c | 47 ++ > 1 file changed, 27 insertions(+), 20

Re: [PATCH v7 05/17] hw/sd/sdcard: Do not switch to ReceivingData if address is invalid

2020-07-07 Thread Philippe Mathieu-Daudé
On 7/7/20 12:24 PM, Philippe Mathieu-Daudé wrote: > On 7/7/20 10:30 AM, Philippe Mathieu-Daudé wrote: >> On Tue, Jun 30, 2020 at 3:39 PM Philippe Mathieu-Daudé >> wrote: >>> >>> Only move the state machine to ReceivingData if there is no >>> pending error. This avoids later OOB access while

Re: [PATCH] trivial: Remove trailing whitespaces

2020-07-07 Thread Laurent Vivier
Le 06/07/2020 à 18:23, Christophe de Dinechin a écrit : > There are a number of unnecessary trailing whitespaces that have > accumulated over time in the source code. They cause stray changes > in patches if you use tools that automatically remove them. > > Tested by doing a `git diff -w` after

Re: [PATCH v7 05/17] hw/sd/sdcard: Do not switch to ReceivingData if address is invalid

2020-07-07 Thread Philippe Mathieu-Daudé
On 7/7/20 10:30 AM, Philippe Mathieu-Daudé wrote: > On Tue, Jun 30, 2020 at 3:39 PM Philippe Mathieu-Daudé > wrote: >> >> Only move the state machine to ReceivingData if there is no >> pending error. This avoids later OOB access while processing >> commands queued. >> >> "SD Specifications

Re: [PATCH 1/3] qemu: implementation of transient option for qcow2 file

2020-07-07 Thread Peter Krempa
On Tue, Jul 07, 2020 at 06:36:23 -0500, Eric Blake wrote: > On 7/7/20 2:12 AM, Peter Krempa wrote: > > > > 1) the virDomainBlockCopy operation flattens the backing chain into the > > top level only. This means that must be stripped or the > > operation rejected, as otherwise shutting down the VM

Re: [PATCH 2/6] migration: introduce savevm, loadvm, delvm QMP commands

2020-07-07 Thread Kevin Wolf
Am 07.07.2020 um 08:38 hat Peter Krempa geschrieben: > On Mon, Jul 06, 2020 at 18:15:55 +0200, Kevin Wolf wrote: > > Am 03.07.2020 um 18:02 hat Daniel P. Berrangé geschrieben: > > > On Fri, Jul 03, 2020 at 04:49:33PM +0100, Dr. David Alan Gilbert wrote: > > > > * Daniel P. Berrangé

Re: [PATCH 1/3] qemu: implementation of transient option for qcow2 file

2020-07-07 Thread Eric Blake
On 7/7/20 2:12 AM, Peter Krempa wrote: You can install a qcow2 overlay on top of a raw file too. IMO the implications of using allow that. As said above I'd strongly prefer if the overlay is created in qemu using the blockdev-create blockjob (there is already infrastructure in libvirt to

Re: [PATCH v11 7/8] nbd: introduce ERRP_AUTO_PROPAGATE

2020-07-07 Thread Markus Armbruster
Vladimir Sementsov-Ogievskiy writes: > If we want to add some info to errp (by error_prepend() or > error_append_hint()), we must use the ERRP_AUTO_PROPAGATE macro. > Otherwise, this info will not be added when errp == _fatal Same for _abort, but to fix that, ERRP_AUTO_PROPAGATE() would have to

Re: [PATCH 5/6] migration: support excluding block devs in QMP snapshot commands

2020-07-07 Thread Kevin Wolf
Am 07.07.2020 um 11:14 hat Daniel P. Berrangé geschrieben: > On Mon, Jul 06, 2020 at 05:57:08PM +0200, Kevin Wolf wrote: > > Am 02.07.2020 um 19:57 hat Daniel P. Berrangé geschrieben: > > > This wires up support for a new "exclude" parameter to the QMP commands > > > for snapshots (savevm,

Re: [PATCH] trivial: Remove trailing whitespaces

2020-07-07 Thread Daniel P . Berrangé
On Mon, Jul 06, 2020 at 06:23:00PM +0200, Christophe de Dinechin wrote: > There are a number of unnecessary trailing whitespaces that have > accumulated over time in the source code. They cause stray changes > in patches if you use tools that automatically remove them. > > Tested by doing a `git

Re: [PATCH 2/6] migration: introduce savevm, loadvm, delvm QMP commands

2020-07-07 Thread Peter Krempa
On Tue, Jul 07, 2020 at 12:33:31 +0200, Kevin Wolf wrote: > Am 07.07.2020 um 08:38 hat Peter Krempa geschrieben: > > On Mon, Jul 06, 2020 at 18:15:55 +0200, Kevin Wolf wrote: > > > Am 03.07.2020 um 18:02 hat Daniel P. Berrangé geschrieben: [...] > > IMO we really want this also for external

[PATCH 2/2] hw/sd/sdcard: Do not allow invalid SD card sizes

2020-07-07 Thread Philippe Mathieu-Daudé
QEMU allows to create SD card with unrealistic sizes. This could work, but some guests (at least Linux) consider sizes that are not a power of 2 as a firmware bug and fix the card size to the next power of 2. Before CVE-2020-13253 fix, this would allow OOB read/write accesses past the image size

[PATCH 1/2] tests/acceptance/boot_linux: Truncate SD card image to power of 2

2020-07-07 Thread Philippe Mathieu-Daudé
In the next commit we won't allow SD card images with invalid size (not aligned to a power of 2). Prepare the tests: add the pow2ceil() and image_pow2ceil_truncate() methods and truncate the images of the tests using SD cards. Signed-off-by: Philippe Mathieu-Daudé ---

[PATCH 0/2] hw/sd/sdcard: Fix CVE-2020-13253 (Do not allow invalid SD card sizes)

2020-07-07 Thread Philippe Mathieu-Daudé
Part 1 is already reviewed: https://www.mail-archive.com/qemu-devel@nongnu.org/msg718150.html However the CVE fix break Linux guests: https://www.mail-archive.com/qemu-devel@nongnu.org/msg720737.html This series fixes that, by checking the SD card image size is correct. Based-on:

Re: [PATCH] qemu-img map: Don't limit block status request size

2020-07-07 Thread Eric Blake
On 7/7/20 9:46 AM, Kevin Wolf wrote: Limiting each loop iteration of qemu-img map to 1 GB was arbitrary from the beginning, though it only cut the maximum in half then because the interface a signed 32 bit byte count. These days, bdrv_block_status() supports a 64 bit byte count, so the arbitrary

[PATCH for-5.1] file-posix: Mitigate file fragmentation with extent size hints

2020-07-07 Thread Kevin Wolf
Espeically when O_DIRECT is used with image files so that the page cache indirection can't cause a merge of allocating requests, the file will fragment on the file system layer, with a potentially very small fragment size (this depends on the requests the guest sent). On Linux, fragmentation can

Re: [PATCH for-5.1] file-posix: Mitigate file fragmentation with extent size hints

2020-07-07 Thread Eric Blake
On 7/7/20 9:23 AM, Kevin Wolf wrote: Espeically when O_DIRECT is used with image files so that the page cache Especially indirection can't cause a merge of allocating requests, the file will fragment on the file system layer, with a potentially very small fragment size (this depends on the

[PATCH] qemu-img map: Don't limit block status request size

2020-07-07 Thread Kevin Wolf
Limiting each loop iteration of qemu-img map to 1 GB was arbitrary from the beginning, though it only cut the maximum in half then because the interface a signed 32 bit byte count. These days, bdrv_block_status() supports a 64 bit byte count, so the arbitrary limit is even worse. On file-posix,

Re: [PULL 00/12] Block patches

2020-07-07 Thread Philippe Mathieu-Daudé
On 6/26/20 12:25 PM, Stefan Hajnoczi wrote: > On Thu, Jun 25, 2020 at 02:31:14PM +0100, Peter Maydell wrote: >> On Wed, 24 Jun 2020 at 11:02, Stefan Hajnoczi wrote: >>> >>> The following changes since commit 171199f56f5f9bdf1e5d670d09ef1351d8f01bae: >>> >>> Merge remote-tracking branch >>>

[PATCH v4 12/45] qemu-option: Replace opt_set() by cleaner opt_validate()

2020-07-07 Thread Markus Armbruster
opt_set() frees its argument @value on failure. Slightly unclean; functions ideally do nothing on failure. To tidy this up, move opt_create() from opt_set() into its callers, along with the cleanup. Rename opt_set() to opt_validate(), noting its similarity to qemu_opts_validate(). Drop

[PATCH v4 30/45] qom: Make functions taking Error ** return bool, not 0/-1

2020-07-07 Thread Markus Armbruster
Just for consistency. Also fix the example in object_set_props()'s documentation. Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake Reviewed-by: Vladimir Sementsov-Ogievskiy --- include/qom/object.h | 28 +++- qom/object.c | 14 +++--- 2 files

[PATCH v4 27/45] qom: Make functions taking Error ** return bool, not void

2020-07-07 Thread Markus Armbruster
See recent commit "error: Document Error API usage rules" for rationale. Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake Reviewed-by: Vladimir Sementsov-Ogievskiy --- include/qom/object.h| 42 ++ include/qom/object_interfaces.h | 12 +++-

[PATCH v4 36/45] error: Eliminate error_propagate() manually

2020-07-07 Thread Markus Armbruster
When all we do with an Error we receive into a local variable is propagating to somewhere else, we can just as well receive it there right away. The previous two commits did that for sufficiently simple cases with Coccinelle. Do it for several more manually. Signed-off-by: Markus Armbruster

[PATCH v4 33/45] error: Avoid unnecessary error_propagate() after error_setg()

2020-07-07 Thread Markus Armbruster
Replace error_setg(, ...); error_propagate(errp, err); by error_setg(errp, ...); Related pattern: if (...) { error_setg(, ...); goto out; } ... out: error_propagate(errp, err); return; When all paths to label out are that way, replace by

[PATCH v4 42/45] error: Avoid error_propagate() after migrate_add_blocker()

2020-07-07 Thread Markus Armbruster
When migrate_add_blocker(blocker, ) is followed by error_propagate(errp, err), we can often just as well do migrate_add_blocker(..., errp). Do that with this Coccinelle script: @@ expression blocker, err, errp; expression ret; @@ -ret = migrate_add_blocker(blocker, );

Re: [PATCH for-5.1] file-posix: Mitigate file fragmentation with extent size hints

2020-07-07 Thread Kevin Wolf
Am 07.07.2020 um 16:23 hat Kevin Wolf geschrieben: > Espeically when O_DIRECT is used with image files so that the page cache > indirection can't cause a merge of allocating requests, the file will > fragment on the file system layer, with a potentially very small > fragment size (this depends on

Re: [PATCH 2/2] hw/sd/sdcard: Do not allow invalid SD card sizes

2020-07-07 Thread Philippe Mathieu-Daudé
On 7/7/20 6:06 PM, Peter Maydell wrote: > On Tue, 7 Jul 2020 at 17:04, Alistair Francis wrote: >> >> On Tue, Jul 7, 2020 at 6:22 AM Philippe Mathieu-Daudé >> wrote: >>> >>> QEMU allows to create SD card with unrealistic sizes. This could work, >>> but some guests (at least Linux) consider sizes

[PATCH v4 22/45] qom: Rename qdev_get_type() to object_get_type()

2020-07-07 Thread Markus Armbruster
Commit 2f262e06f0 lifted qdev_get_type() from qdev to object without renaming it accordingly. Do that now. Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Vladimir Sementsov-Ogievskiy --- qom/object.c | 4 ++-- 1 file changed, 2

[PATCH v4 25/45] qom: Use return values to check for error where that's simpler

2020-07-07 Thread Markus Armbruster
When using the Error object to check for error, we need to receive it into a local variable, then propagate() it to @errp. Using the return value permits allows receiving it straight to @errp. Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake Reviewed-by: Vladimir Sementsov-Ogievskiy

[PULL 12/12] qemu-img: Deprecate use of -b without -F

2020-07-07 Thread Kevin Wolf
From: Eric Blake Creating an image that requires format probing of the backing image is potentially unsafe (we've had several CVEs over the years based on probes leaking information to the guest on a subsequent boot, although these days tools like libvirt are aware of the issue enough to prevent

[PATCH v12 3/8] sd: Use ERRP_AUTO_PROPAGATE()

2020-07-07 Thread Markus Armbruster
From: Vladimir Sementsov-Ogievskiy If we want to add some info to errp (by error_prepend() or error_append_hint()), we must use the ERRP_AUTO_PROPAGATE macro. Otherwise, this info will not be added when errp == _fatal (the program will exit prior to the error_append_hint() or error_prepend()

[PATCH v12 4/8] pflash: Use ERRP_AUTO_PROPAGATE()

2020-07-07 Thread Markus Armbruster
From: Vladimir Sementsov-Ogievskiy If we want to add some info to errp (by error_prepend() or error_append_hint()), we must use the ERRP_AUTO_PROPAGATE macro. Otherwise, this info will not be added when errp == _fatal (the program will exit prior to the error_append_hint() or error_prepend()

[PATCH v12 1/8] error: New macro ERRP_AUTO_PROPAGATE()

2020-07-07 Thread Markus Armbruster
From: Vladimir Sementsov-Ogievskiy Introduce a new ERRP_AUTO_PROPAGATE macro, to be used at start of functions with an errp OUT parameter. It has three goals: 1. Fix issue with error_fatal and error_prepend/error_append_hint: user can't see this additional information, because exit() happens

[PULL 03/12] qemu-img: Flush stdout before before potential stderr messages

2020-07-07 Thread Kevin Wolf
From: Eric Blake During 'qemu-img create ... 2>&1', if --quiet is not in force, we can end up with buffered I/O in stdout that was produced before failure, but which appears in output after failure. This is confusing; the fix is to flush stdout prior to attempting anything that might produce an

Re: [PATCH] qemu-img map: Don't limit block status request size

2020-07-07 Thread Eric Blake
On 7/7/20 10:21 AM, Kevin Wolf wrote: Am 07.07.2020 um 16:54 hat Eric Blake geschrieben: On 7/7/20 9:46 AM, Kevin Wolf wrote: Limiting each loop iteration of qemu-img map to 1 GB was arbitrary from the beginning, though it only cut the maximum in half then because the interface a signed 32 bit

Re: [PATCH v5 1/5] virtio-pci: add virtio_pci_optimal_num_queues() helper

2020-07-07 Thread Cornelia Huck
On Mon, 6 Jul 2020 14:56:46 +0100 Stefan Hajnoczi wrote: > Multi-queue devices achieve the best performance when each vCPU has a > dedicated queue. This ensures that virtqueue used notifications are > handled on the same vCPU that submitted virtqueue buffers. When another > vCPU handles the

Re: [PATCH 1/5] block/io: introduce bdrv_try_mark_request_serialising

2020-07-07 Thread Stefan Hajnoczi
On Sat, Jun 20, 2020 at 05:36:45PM +0300, Vladimir Sementsov-Ogievskiy wrote: > Introduce a function to mark the request serialising only if there are > no conflicting request to wait for. > > The function is static, so mark it unused. The attribute is to be > dropped in the next commit. > >

Re: [PATCH 1/2] tests/acceptance/boot_linux: Truncate SD card image to power of 2

2020-07-07 Thread Alistair Francis
n Tue, Jul 7, 2020 at 6:21 AM Philippe Mathieu-Daudé wrote: > > In the next commit we won't allow SD card images with invalid > size (not aligned to a power of 2). Prepare the tests: add the > pow2ceil() and image_pow2ceil_truncate() methods and truncate > the images of the tests using SD cards.

[PATCH v4 05/45] macio: Tidy up error handling in macio_newworld_realize()

2020-07-07 Thread Markus Armbruster
macio_newworld_realize() effectively ignores ns->gpio realization errors, leaking the Error object. Fortunately, macio_gpio_realize() can't actually fail. Tidy up. Cc: Mark Cave-Ayland Cc: David Gibson Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake Acked-by: David Gibson

Re: [PATCH 2/2] hw/sd/sdcard: Do not allow invalid SD card sizes

2020-07-07 Thread Alistair Francis
On Tue, Jul 7, 2020 at 6:22 AM Philippe Mathieu-Daudé wrote: > > QEMU allows to create SD card with unrealistic sizes. This could work, > but some guests (at least Linux) consider sizes that are not a power > of 2 as a firmware bug and fix the card size to the next power of 2. > > Before

[PATCH v4 01/45] error: Fix examples in error.h's big comment

2020-07-07 Thread Markus Armbruster
Mark a bad example more clearly. Fix the error_propagate_prepend() example. Add a missing declaration and a second error pileup example. Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Greg Kurz --- include/qapi/error.h | 16

[PATCH v4 06/45] virtio-crypto-pci: Tidy up virtio_crypto_pci_realize()

2020-07-07 Thread Markus Armbruster
virtio_crypto_pci_realize() continues after realization of its "virtio-crypto-device" fails. Only an object_property_set_link() follows; looks harmless to me. Tidy up anyway: return after failure, just like virtio_rng_pci_realize() does. Cc: "Gonglei (Arei)" Cc: Michael S. Tsirkin

[PATCH v4 13/45] qemu-option: Make functions taking Error ** return bool, not void

2020-07-07 Thread Markus Armbruster
See recent commit "error: Document Error API usage rules" for rationale. Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake Reviewed-by: Vladimir Sementsov-Ogievskiy --- include/qemu/option.h | 16 blockdev.c| 5 ++- util/qemu-option.c| 92

[PATCH v4 32/45] qdev: Use returned bool to check for failure, Coccinelle part

2020-07-07 Thread Markus Armbruster
The previous commit enables conversion of qdev_prop_set_drive_err(..., ); if (err) { ... } to if (!qdev_prop_set_drive_err(..., errp)) { ... } Coccinelle script: @@ identifier fun = qdev_prop_set_drive_err; expression list args; typedef Error;

[PATCH v4 07/45] qemu-option: Check return value instead of @err where convenient

2020-07-07 Thread Markus Armbruster
Convert uses like opts = qemu_opts_create(..., ); if (err) { ... } to opts = qemu_opts_create(..., errp); if (!opts) { ... } Eliminate error_propagate() that are now unnecessary. Delete @err that are now unused. Note that we can't drop

[PATCH v4 28/45] qom: Use returned bool to check for failure, Coccinelle part

2020-07-07 Thread Markus Armbruster
The previous commit enables conversion of foo(..., ); if (err) { ... } to if (!foo(..., errp)) { ... } for QOM functions that now return true / false on success / error. Coccinelle script: @@ identifier fun = { object_apply_global_props,

[PATCH v4 09/45] qemu-option: Factor out helper find_default_by_name()

2020-07-07 Thread Markus Armbruster
Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Greg Kurz --- util/qemu-option.c | 47 ++ 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/util/qemu-option.c

[PATCH v4 35/45] error: Eliminate error_propagate() with Coccinelle, part 2

2020-07-07 Thread Markus Armbruster
When all we do with an Error we receive into a local variable is propagating to somewhere else, we can just as well receive it there right away. The previous commit did that with a Coccinelle script I consider fairly trustworthy. This commit uses the same script with the matching of return taken

[PATCH v4 00/45] Less clumsy error checking

2020-07-07 Thread Markus Armbruster
When the Error API was created, we adopted the (unwritten) rule to return void when the function returns no useful value on success, unlike GError, which recommends to return true on success and false on error then. When a function returns a distinct error value, say false, a checked call that

[PATCH v4 21/45] qom: Use error_reportf_err() instead of g_printerr() in examples

2020-07-07 Thread Markus Armbruster
Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake Reviewed-by: Vladimir Sementsov-Ogievskiy --- include/qom/object.h | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/include/qom/object.h b/include/qom/object.h index 94a61ccc3f..b70edd8cd9 100644 ---

Re: [PATCH 2/2] hw/sd/sdcard: Do not allow invalid SD card sizes

2020-07-07 Thread Peter Maydell
On Tue, 7 Jul 2020 at 17:04, Alistair Francis wrote: > > On Tue, Jul 7, 2020 at 6:22 AM Philippe Mathieu-Daudé wrote: > > > > QEMU allows to create SD card with unrealistic sizes. This could work, > > but some guests (at least Linux) consider sizes that are not a power > > of 2 as a firmware bug

[PULL 08/12] block: Error if backing file fails during creation without -u

2020-07-07 Thread Kevin Wolf
From: Eric Blake Back in commit 6e6e55f5 (Jul 2017, v2.10), we tweaked the code to warn if the backing file could not be opened but the user gave a size, unless the user also passes the -u option to bypass the open of the backing file. As one common reason for failure to open the backing file

Re: [PATCH v4 1/2] nvme: indicate CMB support through controller capabilities register

2020-07-07 Thread Maxim Levitsky
On Wed, 2020-07-01 at 14:48 -0700, Andrzej Jakowski wrote: > This patch sets CMBS bit in controller capabilities register when user > configures NVMe driver with CMB support, so capabilites are correctly > reported to guest OS. > > Signed-off-by: Andrzej Jakowski > Reviewed-by: Klaus Jensen >

[PULL 09/12] qcow2: Deprecate use of qemu-img amend to change backing file

2020-07-07 Thread Kevin Wolf
From: Eric Blake The use of 'qemu-img amend' to change qcow2 backing files is not tested very well. In particular, our implementation has a bug where if a new backing file is provided without a format, then the prior format is blindly reused, even if this results in data corruption, but this is

Re: [PATCH] MAINTAINERS: update nvme entry

2020-07-07 Thread Kevin Wolf
Am 06.07.2020 um 21:43 hat Keith Busch geschrieben: > The nvme emulated device development pace has increased recently. Klaus > has offered to co-maintain, and since we have many new contributions > coming through, we're adding a repository to accumulate and test new > features. > > Cc: Klaus

Re: [PATCH v5 3/5] virtio-scsi: default num_queues to -smp N

2020-07-07 Thread Cornelia Huck
On Mon, 6 Jul 2020 14:56:48 +0100 Stefan Hajnoczi wrote: Maybe mention 'pci' in the subject as well? > Automatically size the number of virtio-scsi-pci, vhost-scsi-pci, and > vhost-user-scsi-pci request virtqueues to match the number of vCPUs. > Other transports continue to default to 1

[PATCH v4 04/45] qdev: Use returned bool to check for qdev_realize() etc. failure

2020-07-07 Thread Markus Armbruster
Convert foo(..., ); if (err) { ... } to if (!foo(..., )) { ... } for qdev_realize(), qdev_realize_and_unref(), qbus_realize() and their wrappers isa_realize_and_unref(), pci_realize_and_unref(), sysbus_realize(), sysbus_realize_and_unref(),

[PATCH v4 18/45] qapi: Use returned bool to check for failure, Coccinelle part

2020-07-07 Thread Markus Armbruster
The previous commit enables conversion of visit_foo(..., ); if (err) { ... } to if (!visit_foo(..., errp)) { ... } for visitor functions that now return true / false on success / error. Coccinelle script: @@ identifier fun =~

[PATCH v4 19/45] qapi: Use returned bool to check for failure, manual part

2020-07-07 Thread Markus Armbruster
The previous commit used Coccinelle to convert from checking the Error object to checking the return value. Convert a few more manually. Also tweak control flow in places to conform to the conventional "if error bail out" pattern. Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake

[PATCH v4 29/45] qom: Use returned bool to check for failure, manual part

2020-07-07 Thread Markus Armbruster
The previous commit used Coccinelle to convert from checking the Error object to checking the return value. Convert a few more manually. Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake Reviewed-by: Vladimir Sementsov-Ogievskiy --- hw/core/bus.c | 6 +-

[PATCH v4 37/45] error: Reduce unnecessary error propagation

2020-07-07 Thread Markus Armbruster
When all we do with an Error we receive into a local variable is propagating to somewhere else, we can just as well receive it there right away, even when we need to keep error_propagate() for other error paths. Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake --- block.c |

[PATCH v4 16/45] hmp: Eliminate a variable in hmp_migrate_set_parameter()

2020-07-07 Thread Markus Armbruster
Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake Reviewed-by: Vladimir Sementsov-Ogievskiy --- monitor/hmp-cmds.c | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index 2b0b58a336..d7810cb564 100644 ---

[PATCH v4 38/45] block/parallels: Simplify parallels_open() after previous commit

2020-07-07 Thread Markus Armbruster
Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake Reviewed-by: Vladimir Sementsov-Ogievskiy --- block/parallels.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/block/parallels.c b/block/parallels.c index 180dd41e2b..cb5259ac44 100644 --- a/block/parallels.c

[PATCH v4 31/45] qdev: Make functions taking Error ** return bool, not void

2020-07-07 Thread Markus Armbruster
See recent commit "error: Document Error API usage rules" for rationale. Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake Reviewed-by: Vladimir Sementsov-Ogievskiy --- include/hw/qdev-properties.h | 4 ++-- hw/core/qdev-properties-system.c | 4 ++-- 2 files changed, 4

[PATCH v4 39/45] qapi: Smooth another visitor error checking pattern

2020-07-07 Thread Markus Armbruster
Convert visit_type_FOO(v, ..., , ); ... if (err) { ... } to visit_type_FOO(v, ..., , errp); ... if (!ptr) { ... } for functions that set @ptr to non-null / null on success / error. Eliminate error_propagate() that are now unnecessary. Delete

[PATCH v4 45/45] hmp: Ignore Error objects where the return value suffices

2020-07-07 Thread Markus Armbruster
qdev_print_props() receives and throws away Error objects just to check for object_property_get_str() and object_property_print() failure. Unnecessary, both return suitable values, so use those instead. Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake --- qdev-monitor.c | 12

[PATCH v4 44/45] qdev: Ignore Error objects where the return value suffices

2020-07-07 Thread Markus Armbruster
Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake --- hw/core/qdev-properties.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 2bec8a80b8..098298c78e 100644 --- a/hw/core/qdev-properties.c +++

Re: [PATCH v4 00/45] Less clumsy error checking

2020-07-07 Thread Markus Armbruster
Neglected to mention: code changes are limited to resolving rebase conflicts in PATCH 26. v4 is about comments, mostly to reduce churn when combined with Vladimir's auto propagation work.

Re: [PATCH v6 08/10] iotests: Specify explicit backing format where sensible

2020-07-07 Thread Kevin Wolf
Am 06.07.2020 um 22:39 hat Eric Blake geschrieben: > There are many existing qcow2 images that specify a backing file but > no format. This has been the source of CVEs in the past, but has > become more prominent of a problem now that libvirt has switched to > -blockdev. With older -drive, at

[PULL 05/12] sheepdog: Add trivial backing_fmt support

2020-07-07 Thread Kevin Wolf
From: Eric Blake Sheepdog already requires that if backing_file is present, that it be another sheepdog image (see sd_co_create). Meanwhile, we want to move towards always being explicit about the backing format for other drivers where it matters. So for convenience, make qemu-img create -F

[PULL 07/12] qcow: Tolerate backing_fmt=

2020-07-07 Thread Kevin Wolf
From: Eric Blake qcow has no space in the metadata to store a backing format, and there are existing qcow images backed both by raw or by other formats (usually qcow) images, reliant on probing to tell the difference. On the bright side, because we probe every time, raw files are marked as

[PULL 06/12] vmdk: Add trivial backing_fmt support

2020-07-07 Thread Kevin Wolf
From: Eric Blake vmdk already requires that if backing_file is present, that it be another vmdk image (see vmdk_co_do_create). Meanwhile, we want to move towards always being explicit about the backing format for other drivers where it matters. So for convenience, make qemu-img create -F vmdk

[PATCH v4 43/45] qemu-img: Ignore Error objects where the return value suffices

2020-07-07 Thread Markus Armbruster
Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake --- qemu-img.c | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/qemu-img.c b/qemu-img.c index fc405ee171..a6af0eaf80 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -464,22 +464,18 @@ static int

[PATCH v12 8/8] xen: Use ERRP_AUTO_PROPAGATE()

2020-07-07 Thread Markus Armbruster
From: Vladimir Sementsov-Ogievskiy If we want to add some info to errp (by error_prepend() or error_append_hint()), we must use the ERRP_AUTO_PROPAGATE macro. Otherwise, this info will not be added when errp == _fatal (the program will exit prior to the error_append_hint() or error_prepend()

[PULL 01/12] qemu-img map: Don't limit block status request size

2020-07-07 Thread Kevin Wolf
Limiting each loop iteration of qemu-img map to 1 GB was arbitrary from the beginning, though it only cut the maximum in half then because the interface was a signed 32 bit byte count. These days, bdrv_block_status supports a 64 bit byte count, so the arbitrary limit is even worse. On file-posix,

[PATCH v12 6/8] virtio-9p: Use ERRP_AUTO_PROPAGATE()

2020-07-07 Thread Markus Armbruster
From: Vladimir Sementsov-Ogievskiy If we want to add some info to errp (by error_prepend() or error_append_hint()), we must use the ERRP_AUTO_PROPAGATE macro. Otherwise, this info will not be added when errp == _fatal (the program will exit prior to the error_append_hint() or error_prepend()

Re: [PATCH] qemu-img map: Don't limit block status request size

2020-07-07 Thread Kevin Wolf
Am 07.07.2020 um 16:54 hat Eric Blake geschrieben: > On 7/7/20 9:46 AM, Kevin Wolf wrote: > > Limiting each loop iteration of qemu-img map to 1 GB was arbitrary from > > the beginning, though it only cut the maximum in half then because the > > interface a signed 32 bit byte count. These days,

[PATCH v4 14/45] qemu-option: Use returned bool to check for failure

2020-07-07 Thread Markus Armbruster
The previous commit enables conversion of foo(..., ); if (err) { ... } to if (!foo(..., )) { ... } for QemuOpts functions that now return true / false on success / error. Coccinelle script: @@ identifier fun = { opts_do_parse,

[PATCH v4 11/45] qemu-option: Factor out helper opt_create()

2020-07-07 Thread Markus Armbruster
There is just one use so far. The next commit will add more. Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake Reviewed-by: Vladimir Sementsov-Ogievskiy --- util/qemu-option.c | 27 ++- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git

[PATCH v4 15/45] block: Avoid error accumulation in bdrv_img_create()

2020-07-07 Thread Markus Armbruster
When creating an image fails because the format doesn't support option "backing_file" or "backing_fmt", bdrv_img_create() first has qemu_opt_set() put a generic error into @local_err, then puts the real error into @errp with error_setg(), and then propagates the former to the latter, which throws

[PATCH v4 23/45] qom: Crash more nicely on object_property_get_link() failure

2020-07-07 Thread Markus Armbruster
Pass _abort instead of NULL where the returned value is dereferenced or asserted to be non-null. Drop a now redundant assertion. Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake Reviewed-by: Vladimir Sementsov-Ogievskiy --- hw/core/platform-bus.c | 6 +++--- hw/ppc/spapr_drc.c

[PATCH v4 10/45] qemu-option: Simplify around find_default_by_name()

2020-07-07 Thread Markus Armbruster
Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake Reviewed-by: Vladimir Sementsov-Ogievskiy --- util/qemu-option.c | 18 +- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/util/qemu-option.c b/util/qemu-option.c index 14e211ddd8..e7b540a21b 100644 ---

[PATCH v4 20/45] s390x/pci: Fix harmless mistake in zpci's property fid's setter

2020-07-07 Thread Markus Armbruster
s390_pci_set_fid() sets zpci->fid_defined to true even when visit_type_uint32() failed. Reproducer: "-device zpci,fid=junk". Harmless in practice, because qdev_device_add() then fails, throwing away @zpci. Fix it anyway. Cc: Matthew Rosato Cc: Cornelia Huck Signed-off-by: Markus Armbruster

[PATCH v4 08/45] qemu-option: Make uses of find_desc_by_name() more similar

2020-07-07 Thread Markus Armbruster
This is to make the next commit easier to review. Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Greg Kurz --- util/qemu-option.c | 32 ++-- 1 file changed, 18 insertions(+), 14 deletions(-) diff

[PATCH v4 03/45] error: Document Error API usage rules

2020-07-07 Thread Markus Armbruster
This merely codifies existing practice, with one exception: the rule advising against returning void, where existing practice is mixed. When the Error API was created, we adopted the (unwritten) rule to return void when the function returns no useful value on success, unlike GError, which

  1   2   >