Re: [PATCH v2 3/3] nbd: disable signals and forking on Windows builds

2020-09-02 Thread Yonggang Luo
On Tue, Aug 25, 2020 at 6:40 PM Daniel P. Berrangé wrote: > Disabling these parts are sufficient to get the qemu-nbd program > compiling in a Windows build. > > Signed-off-by: Daniel P. Berrangé > --- > meson.build | 7 ++- > qemu-nbd.c | 5 + > 2 files changed, 7 insertions(+), 5

Re: [PATCH v2 3/3] nbd: disable signals and forking on Windows builds

2020-09-02 Thread Eric Blake
On 9/2/20 5:07 PM, 罗勇刚(Yonggang Luo) wrote: On Tue, Aug 25, 2020 at 6:40 PM Daniel P. Berrangé wrote: Disabling these parts are sufficient to get the qemu-nbd program compiling in a Windows build. Signed-off-by: Daniel P. Berrangé --- meson.build | 7 ++- qemu-nbd.c | 5 + 2

[PATCH 32/63] ahci: Rename ICH_AHCI to ICH9_AHCI

2020-09-02 Thread Eduardo Habkost
Make the type checking macro name consistent with the TYPE_* constant. Signed-off-by: Eduardo Habkost --- Cc: John Snow Cc: qemu-block@nongnu.org Cc: qemu-de...@nongnu.org --- include/hw/ide/ahci.h | 2 +- hw/ide/ahci.c | 4 ++-- hw/ide/ich.c | 8 3 files changed, 7

[PULL 2/6] iotests/259: Fix reference output

2020-09-02 Thread Eric Blake
From: Max Reitz The error message has changed recently, breaking the test. Fix it. Fixes: a2b333c01880f56056d50c238834d62e32001e54 ("block: nbd: Fix convert qcow2 compressed to nbd") Signed-off-by: Max Reitz Message-Id: <20200811080830.289136-1-mre...@redhat.com> Reviewed-by: Eric

[PULL 3/6] block/nbd: use non-blocking connect: fix vm hang on connect()

2020-09-02 Thread Eric Blake
From: Vladimir Sementsov-Ogievskiy This makes nbd's connection_co yield during reconnects, so that reconnect doesn't block the main thread. This is very important in case of an unavailable nbd server host: connect() call may take a long time, blocking the main thread (and due to reconnect, it

[PULL 6/6] nbd: disable signals and forking on Windows builds

2020-09-02 Thread Eric Blake
From: Daniel P. Berrangé Disabling these parts are sufficient to get the qemu-nbd program compiling in a Windows build. Signed-off-by: Daniel P. Berrangé Message-Id: <20200825103850.119911-4-berra...@redhat.com> Reviewed-by: Eric Blake Signed-off-by: Eric Blake --- qemu-nbd.c | 5 +

[PULL 4/6] block: add missing socket_init() calls to tools

2020-09-02 Thread Eric Blake
From: Daniel P. Berrangé Any tool that uses sockets needs to call socket_init() in order to work on the Windows platform. Reviewed-by: Eric Blake Signed-off-by: Daniel P. Berrangé Message-Id: <20200825103850.119911-2-berra...@redhat.com> Signed-off-by: Eric Blake --- qemu-img.c | 2 ++

[PULL 5/6] nbd: skip SIGTERM handler if NBD device support is not built

2020-09-02 Thread Eric Blake
From: Daniel P. Berrangé The termsig_handler function is used by the client thread handling the host NBD device connection to do a graceful shutdown. IOW, if we have disabled NBD device support at compile time, we don't need the SIGTERM handler. This fixes a build issue for Windows.

[PULL 1/6] iotests/059: Fix reference output

2020-09-02 Thread Eric Blake
From: Max Reitz As of the patch to flush qemu-img's "Formatting" message before the error message, 059 has been broken for vmdk. Fix it. Fixes: 4e2f4418784da09cb106264340241856cd2846df ("qemu-img: Flush stdout before before potential stderr messages") Signed-off-by: Max Reitz

Re: [PATCH v2 3/3] nbd: disable signals and forking on Windows builds

2020-09-02 Thread Eric Blake
On 8/25/20 5:38 AM, Daniel P. Berrangé wrote: Disabling these parts are sufficient to get the qemu-nbd program compiling in a Windows build. Signed-off-by: Daniel P. Berrangé --- meson.build | 7 ++- qemu-nbd.c | 5 + 2 files changed, 7 insertions(+), 5 deletions(-) Reviewed-by:

Re: [PATCH v2 2/3] nbd: skip SIGTERM handler if NBD device support is not built

2020-09-02 Thread Eric Blake
On 8/25/20 5:38 AM, Daniel P. Berrangé wrote: The termsig_handler function is used by the client thread handling the host NBD device connection to do a graceful shutdown. IOW, if we have disabled NBD device support at compile time, we don't need the SIGTERM handler. This fixes a build issue for

[PATCH v4 3/5] qmp: expose block-dirty-bitmap-populate

2020-09-02 Thread Eric Blake
From: John Snow This is a new job-creating command. Signed-off-by: John Snow Signed-off-by: Eric Blake --- qapi/block-core.json | 18 +++ qapi/transaction.json | 2 ++ blockdev.c| 74 +++ 3 files changed, 94 insertions(+) diff

[PATCH v4 1/5] block: add bitmap-populate job

2020-09-02 Thread Eric Blake
From: John Snow This job copies the allocation map into a bitmap. It's a job because there's no guarantee that allocation interrogation will be quick (or won't hang), so it cannot be retrofitted into block-dirty-bitmap-merge. It was designed with different possible population patterns in mind,

[PATCH v4 4/5] iotests: move bitmap helpers into their own file

2020-09-02 Thread Eric Blake
From: John Snow Signed-off-by: John Snow Message-Id: <20200514034922.24834-5-js...@redhat.com> Signed-off-by: Eric Blake --- tests/qemu-iotests/257| 110 +--- tests/qemu-iotests/bitmaps.py | 131 ++ 2 files changed, 132

[PATCH v4 2/5] blockdev: combine DriveBackupState and BlockdevBackupState

2020-09-02 Thread Eric Blake
From: John Snow They have the same fields -- rename it BlockJobActionState. Signed-off-by: John Snow Signed-off-by: Eric Blake --- blockdev.c | 30 -- 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/blockdev.c b/blockdev.c index

[PATCH v4 0/5] block: add block-dirty-bitmap-populate job

2020-09-02 Thread Eric Blake
This is NOT the final version of this patch series, but I'm posting it to revive conversation on the topic while fixing it to compile on top of meson changes. v3 was: https://lists.gnu.org/archive/html/qemu-devel/2020-06/msg06258.html 001/5:[0025] [FC] 'block: add bitmap-populate job'

[PATCH] qcow2: Fix removal of list members from BDRVQcow2State.cluster_allocs

2020-09-02 Thread Alberto Garcia
When a write request needs to allocate new clusters (or change the L2 bitmap of existing ones) a QCowL2Meta structure is created so the L2 metadata can be later updated and any copy-on-write can be performed if necessary. A write request can span a region consisting of an arbitrary combination of

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

2020-09-02 Thread Philippe Mathieu-Daudé
On 9/2/20 6:46 PM, P J P wrote: > +-- On Wed, 2 Sep 2020, Philippe Mathieu-Daudé wrote --+ > | > +if (s->data_count <= begin || s->data_count > s->buf_maxsz) { > | > +break; > | > +} > | > | Thanks for your patch. Note however this kind of security fix

Re: [PATCH v4 5/6] util: give a specific error message when O_DIRECT doesn't work

2020-09-02 Thread Daniel P . Berrangé
On Wed, Aug 26, 2020 at 01:19:53PM +0200, Markus Armbruster wrote: > Now back to my dislike of the #ifdeffery I voiced in reply to PATCH 2. > > Code now: > > #ifdef O_CLOEXEC > flags |= O_CLOEXEC; > #endif /* O_CLOEXEC */ > > ret = open(name, flags, mode); > >

[PATCH v5 8/8] block/file: switch to use qemu_open/qemu_create for improved errors

2020-09-02 Thread Daniel P . Berrangé
Currently at startup if using cache=none on a filesystem lacking O_DIRECT such as tmpfs, at startup QEMU prints qemu-system-x86_64: -drive file=/tmp/foo.img,cache=none: file system may not support O_DIRECT qemu-system-x86_64: -drive file=/tmp/foo.img,cache=none: Could not open '/tmp/foo.img':

[PATCH v5 6/8] util: introduce qemu_open and qemu_create with error reporting

2020-09-02 Thread Daniel P . Berrangé
qemu_open_old() works like open(): set errno and return -1 on failure. It has even more failure modes, though. Reporting the error clearly to users is basically impossible for many of them. Our standard cure for "errno is too coarse" is the Error object. Introduce two new helper methods: int

[PATCH v5 7/8] util: give a specific error message when O_DIRECT doesn't work

2020-09-02 Thread Daniel P . Berrangé
A common error scenario is to tell QEMU to use O_DIRECT in combination with a filesystem that doesn't support it. To aid users to diagnosing their mistake we want to provide a clear error message when this happens. Reviewed-by: Markus Armbruster Reviewed-by: Eric Blake Signed-off-by: Daniel P.

[PATCH v5 3/8] util: rename qemu_open() to qemu_open_old()

2020-09-02 Thread Daniel P . Berrangé
We want to introduce a new version of qemu_open() that uses an Error object for reporting problems and make this it the preferred interface. Rename the existing method to release the namespace for the new impl. Reviewed-by: Eric Blake Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Daniel P.

[PATCH v5 2/8] util: split off a helper for dealing with O_CLOEXEC flag

2020-09-02 Thread Daniel P . Berrangé
We're going to have multiple callers to open() from qemu_open() soon. Readability would thus benefit from having a helper for dealing with O_CLOEXEC. Signed-off-by: Daniel P. Berrangé --- util/osdep.c | 23 +++ 1 file changed, 15 insertions(+), 8 deletions(-) diff --git

[PATCH v5 5/8] util: add Error object for qemu_open_internal error reporting

2020-09-02 Thread Daniel P . Berrangé
Instead of relying on the limited information from errno, we can now also provide detailed error messages to callers that ask for it. Signed-off-by: Daniel P. Berrangé --- util/osdep.c | 14 -- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/util/osdep.c

[PATCH v5 4/8] util: refactor qemu_open_old to split off variadic args handling

2020-09-02 Thread Daniel P . Berrangé
This simple refactoring prepares for future patches. The variadic args handling is split from the main bulk of the open logic. The duplicated calls to open() are removed in favour of updating the "flags" variable to have O_CLOEXEC. Signed-off-by: Daniel P. Berrangé --- util/osdep.c | 25

[PATCH v5 0/8] block: improve error reporting for unsupported O_DIRECT

2020-09-02 Thread Daniel P . Berrangé
v1: https://lists.gnu.org/archive/html/qemu-devel/2020-07/msg00269.html v2: https://lists.gnu.org/archive/html/qemu-devel/2020-07/msg00589.html v3: https://lists.gnu.org/archive/html/qemu-devel/2020-07/msg07098.html v4: https://lists.gnu.org/archive/html/qemu-devel/2020-08/msg05334.html See patch

[PATCH v5 1/8] monitor: simplify functions for getting a dup'd fdset entry

2020-09-02 Thread Daniel P . Berrangé
Currently code has to call monitor_fdset_get_fd, then dup the return fd, and then add the duplicate FD back into the fdset. This dance is overly verbose for the caller and introduces extra failure modes which can be avoided by folding all the logic into monitor_fdset_dup_fd_add and removing

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

2020-09-02 Thread P J P
+-- On Tue, 1 Sep 2020, Philippe Mathieu-Daudé wrote --+ | > -> https://ruhr-uni-bochum.sciebo.de/s/NNWP2GfwzYKeKwE?path=%2Fsdhci_oob_write1 | | This directory is 3 months old, I can't find it on the list... | Did I missed that or did the list eat the report? No, it was reported to

Re: [PATCH 2/3] mirror: Freeze backing chain for sync=top

2020-09-02 Thread Max Reitz
On 02.09.20 18:48, Max Reitz wrote: > Reported-by: Kevin Wolf > Signed-off-by: Max Reitz > --- > block/mirror.c | 20 +--- > 1 file changed, 17 insertions(+), 3 deletions(-) > > diff --git a/block/mirror.c b/block/mirror.c > index 11ebffdf99..27422ab7a5 100644 > ---

Re: [PATCH v4 00/18] qom: Automated conversion of type checking boilerplate

2020-09-02 Thread Eduardo Habkost
On Mon, Aug 31, 2020 at 05:07:22PM -0400, Eduardo Habkost wrote: > Latest version of this series can be found at the branch: > https://github.com/ehabkost/qemu-hacks/tree/work/qom-macros-autoconvert > > This is an extension of the series previously submitted by > Daniel[1], including a script

Re: [PATCH] qemu-iotests: move check-block back to Makefiles

2020-09-02 Thread Alex Bennée
Paolo Bonzini writes: > check-block has its own test harness, unlike every other test. If > we capture its output, as is in general nicer to do without V=1, > there will be no sign of progress. So for lack of a better option > just move the invocation of the test back to Makefile rules. > >

[PATCH 2/3] mirror: Freeze backing chain for sync=top

2020-09-02 Thread Max Reitz
Reported-by: Kevin Wolf Signed-off-by: Max Reitz --- block/mirror.c | 20 +--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/block/mirror.c b/block/mirror.c index 11ebffdf99..27422ab7a5 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -649,8 +649,8 @@ static

[PATCH 0/3] mirror: Freeze backing chain for sync=top

2020-09-02 Thread Max Reitz
Hi, On review of the “Deal with filters” series, Kevin noted that mirror doesn’t freeze its backing chain, even though we keep references to the base (for sync=top). That seems like a recipe for disaster, and as the test added in patch 3 shows, indeed it is. Patch 1 could also be squashed into

[PATCH 1/3] mirror: Set s->base_overlay only if s->base is set

2020-09-02 Thread Max Reitz
This way, sync=full will not need a reference to any node other than the source and the target. Signed-off-by: Max Reitz --- block/mirror.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/block/mirror.c b/block/mirror.c index 26acf4af6f..11ebffdf99 100644 ---

[PATCH 3/3] iotests/041: x-blockdev-reopen during mirror

2020-09-02 Thread Max Reitz
Test what happens when you remove the backing file during a mirror with sync=top. Signed-off-by: Max Reitz --- tests/qemu-iotests/041 | 92 ++ tests/qemu-iotests/041.out | 4 +- 2 files changed, 94 insertions(+), 2 deletions(-) diff --git

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

2020-09-02 Thread P J P
+-- On Wed, 2 Sep 2020, Philippe Mathieu-Daudé wrote --+ | > +if (s->data_count <= begin || s->data_count > s->buf_maxsz) { | > +break; | > +} | | Thanks for your patch. Note however this kind of security fix hides | the bug in the model, furthermore it

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

2020-09-02 Thread Philippe Mathieu-Daudé
Hi Prasad, 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

Re: [PATCH v3 1/6] block: add bitmap-populate job

2020-09-02 Thread Eric Blake
[reviving an old thread] On 6/22/20 4:44 PM, Eric Blake wrote: On 6/19/20 11:16 PM, Vladimir Sementsov-Ogievskiy wrote: 19.06.2020 22:56, Eric Blake wrote: From: John Snow This job copies the allocation map into a bitmap. It's a job because there's no guarantee that allocation interrogation

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

2020-09-02 Thread Max Reitz
On 02.09.20 12:23, Kevin Wolf wrote: > Am 01.09.2020 um 16:33 hat Max Reitz geschrieben: >> 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

Re: [PATCH] iotests: Allow running from different directory

2020-09-02 Thread Claudio Fontana
On 9/2/20 1:03 PM, Kevin Wolf wrote: > It is convenient to be able to edit the tests and run them without > changing the current working directory back and forth. Instead of > assuming that $PWD is the qemu-iotests build directory, derive the build > directory from the executed script. > > This

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

2020-09-02 Thread Daniel P . Berrangé
On Wed, Sep 02, 2020 at 11:27:17AM +0200, Markus Armbruster wrote: > Daniel P. Berrangé writes: > > > 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 > >> >

[PATCH] iotests: Allow running from different directory

2020-09-02 Thread Kevin Wolf
It is convenient to be able to edit the tests and run them without changing the current working directory back and forth. Instead of assuming that $PWD is the qemu-iotests build directory, derive the build directory from the executed script. This allows 'check' to find the required files even

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

2020-09-02 Thread P J P
+-- On Tue, 1 Sep 2020, 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. | | Buglink: https://bugs.launchpad.net/qemu/+bug/1892960 +

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

2020-09-02 Thread Kevin Wolf
Am 01.09.2020 um 16:33 hat Max Reitz geschrieben: > 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:

Re: [PATCH] qemu-iotests: move check-block back to Makefiles

2020-09-02 Thread Thomas Huth
On 02/09/2020 10.37, Paolo Bonzini wrote: > On 02/09/20 10:19, Daniel P. Berrangé wrote: >> On Wed, Sep 02, 2020 at 04:00:46AM -0400, Paolo Bonzini wrote: >>> check-block has its own test harness, unlike every other test. If >>> we capture its output, as is in general nicer to do without V=1, >>>

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

2020-09-02 Thread Max Reitz
On 02.09.20 10:53, Kevin Wolf wrote: > Am 01.09.2020 um 16:34 hat Max Reitz geschrieben: >> 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

Re: [PATCH v3 0/5] iotest.FilePath fixes and cleanups

2020-09-02 Thread Max Reitz
On 29.08.20 01:21, Nir Soffer wrote: > Fix some issues introduced when iotests.FilePaths was added and merge it back > into FilePath keeping the option to create multiple file names. Thanks, applied to my block branch: https://git.xanclic.moe/XanClic/qemu/commits/branch/block signature.asc

Re: [PATCH] tests/qtest/ahci: Improve error handling (NEGATIVE_RETURNS)

2020-09-02 Thread Thomas Huth
On 02/09/2020 10.05, Philippe Mathieu-Daudé wrote: > Fix an error handling issue reported by Coverity: > > /qemu/tests/qtest/ahci-test.c: 1452 in prepare_iso() > 1444 int fd = mkstemp(cdrom_path); > >>> CID 1432375: Error handling issues (NEGATIVE_RETURNS) > >>> "fd" is

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

2020-09-02 Thread Markus Armbruster
Daniel P. Berrangé writes: > 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

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

2020-09-02 Thread Kevin Wolf
Am 01.09.2020 um 16:34 hat Max Reitz geschrieben: > 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 s/longer/no longer/ > for such nodes, and that

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

2020-09-02 Thread Kevin Wolf
Am 01.09.2020 um 16:34 hat Max Reitz geschrieben: > 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

Re: [PATCH] qemu-iotests: move check-block back to Makefiles

2020-09-02 Thread Paolo Bonzini
On 02/09/20 10:19, Daniel P. Berrangé wrote: > On Wed, Sep 02, 2020 at 04:00:46AM -0400, Paolo Bonzini wrote: >> check-block has its own test harness, unlike every other test. If >> we capture its output, as is in general nicer to do without V=1, >> there will be no sign of progress. So for lack

Re: [PATCH] qemu-iotests: move check-block back to Makefiles

2020-09-02 Thread Daniel P . Berrangé
On Wed, Sep 02, 2020 at 04:00:46AM -0400, Paolo Bonzini wrote: > check-block has its own test harness, unlike every other test. If > we capture its output, as is in general nicer to do without V=1, > there will be no sign of progress. So for lack of a better option > just move the invocation of

[PATCH] tests/qtest/ahci: Improve error handling (NEGATIVE_RETURNS)

2020-09-02 Thread Philippe Mathieu-Daudé
Fix an error handling issue reported by Coverity: /qemu/tests/qtest/ahci-test.c: 1452 in prepare_iso() 1444 int fd = mkstemp(cdrom_path); >>> CID 1432375: Error handling issues (NEGATIVE_RETURNS) >>> "fd" is passed to a parameter that cannot be negative. 1452

[PATCH] qemu-iotests: move check-block back to Makefiles

2020-09-02 Thread Paolo Bonzini
check-block has its own test harness, unlike every other test. If we capture its output, as is in general nicer to do without V=1, there will be no sign of progress. So for lack of a better option just move the invocation of the test back to Makefile rules. As a side effect, this will also fix

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

2020-09-02 Thread Markus Armbruster
Daniel P. Berrangé writes: > 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 >>