[PATCH v5 12/16] qemu-iotests: allow valgrind to read/delete the generated log file

2021-06-04 Thread Emanuele Giuseppe Esposito
When using --valgrind on the script tests, it generates a log file in $TEST_DIR that is either read (if valgrind finds problems) or otherwise deleted. Provide the same exact behavior when using --valgrind on the python tests. Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Vladimir

[PATCH v4 2/6] blkdebug: move post-resume handling to resume_req_by_tag

2021-06-04 Thread Emanuele Giuseppe Esposito
to handle the yielding. Co-developed-by: Paolo Bonzini Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Vladimir Sementsov-Ogievskiy --- block/blkdebug.c | 31 ++- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/block/blkdebug.c b/block/blkdebug.c

[PATCH v4 3/6] blkdebug: track all actions

2021-06-04 Thread Emanuele Giuseppe Esposito
Add a counter for each action that a rule can trigger. This is mainly used to keep track of how many coroutine_yield() we need to perform after processing all rules in the list. Co-developed-by: Paolo Bonzini Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Vladimir Sementsov-Ogievskiy

[PATCH v4 0/6] blkdebug: fix racing condition when iterating on

2021-06-04 Thread Emanuele Giuseppe Esposito
smaller granularity locks to allow multiple iothread execution in the same block device. Signed-off-by: Emanuele Giuseppe Esposito --- v4: * Patch 5 (new): get rid of new_state and instead use a local variable * Patch 6: move the state update inside the same guard lock where the new one

Re: [PATCH v4 01/15] python: qemu: add timer parameter for qmp.accept socket

2021-06-04 Thread Emanuele Giuseppe Esposito
On 03/06/2021 21:02, John Snow wrote: On 6/3/21 4:06 AM, Emanuele Giuseppe Esposito wrote: On 03/06/2021 01:23, John Snow wrote: On 5/20/21 3:52 AM, Emanuele Giuseppe Esposito wrote: Alsp add a new _qmp_timer field to the QEMUMachine class. Let's change the default socket timeout

[PATCH v5 02/16] python: Reduce strictness of pylint's duplicate-code check

2021-06-04 Thread Emanuele Giuseppe Esposito
From: John Snow Pylint prior to 2.8.3 (We pin at >= 2.8.0) includes function and method signatures as part of its duplicate checking algorithm. This check does not listen to pragmas, so the only way to disable it is to turn it off completely or increase the minimum duplicate lines so that it

[PATCH v5 05/16] qemu-iotests: add option to attach gdbserver

2021-06-04 Thread Emanuele Giuseppe Esposito
-off-by: Emanuele Giuseppe Esposito Reviewed-by: Vladimir Sementsov-Ogievskiy --- tests/qemu-iotests/check | 6 +- tests/qemu-iotests/iotests.py | 5 + tests/qemu-iotests/testenv.py | 17 +++-- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/tests/qemu

[PATCH v5 00/16] qemu_iotests: improve debugging options

2021-06-04 Thread Emanuele Giuseppe Esposito
181659.365531-1-vsement...@virtuozzo.com> Signed-off-by: Emanuele Giuseppe Esposito --- v5: * base this serie on the double dash options, so define --gdb instead of -gdb * return error if -gdb and -valgrind are used together [Vladimir] * style changes (do not use subprocess_check_valgrind() but

[PATCH v5 01/16] python: qemu: add timer parameter for qmp.accept socket

2021-06-04 Thread Emanuele Giuseppe Esposito
to the QMP monitor test command execution. Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Vladimir Sementsov-Ogievskiy --- python/qemu/machine/machine.py | 7 +-- python/qemu/machine/qtest.py | 5 +++-- tests/qemu-iotests/iotests.py | 3 ++- 3 files changed, 10 insertions(+), 5

[PATCH v5 04/16] docs/devel/testing: add debug section to the QEMU iotests chapter

2021-06-04 Thread Emanuele Giuseppe Esposito
Introduce the "Debugging a test case" section, in preparation to the additional flags that will be added in the next patches. Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Vladimir Sementsov-Ogievskiy --- docs/devel/testing.rst | 8 1 file changed, 8 insertions(+)

[PATCH v4 5/6] block/blkdebug: remove new_state field and instead use a local variable

2021-06-04 Thread Emanuele Giuseppe Esposito
There seems to be no benefit in using a field. Replace it with a local variable. Signed-off-by: Emanuele Giuseppe Esposito --- block/blkdebug.c | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/block/blkdebug.c b/block/blkdebug.c index dffd869b32..d597753139

[PATCH v5 06/16] qemu-iotests: delay QMP socket timers

2021-06-04 Thread Emanuele Giuseppe Esposito
Attaching gdbserver implies that the qmp socket should wait indefinitely for an answer from QEMU. For Timeout class, create a @contextmanager that switches Timeout with NoTimeout (empty context manager) so that if --gdb is set, no timeout will be triggered. Signed-off-by: Emanuele Giuseppe

[PATCH v5 03/16] python: qemu: pass the wrapper field from QEMUQtestmachine to QEMUMachine

2021-06-04 Thread Emanuele Giuseppe Esposito
Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: John Snow Reviewed-by: Max Reitz --- python/qemu/machine/qtest.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/python/qemu/machine/qtest.py b/python/qemu/machine/qtest.py

[PATCH v5 09/16] docs/devel/testing: add --gdb option to the debugging section of QEMU iotests

2021-06-04 Thread Emanuele Giuseppe Esposito
Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Vladimir Sementsov-Ogievskiy --- docs/devel/testing.rst | 11 +++ 1 file changed, 11 insertions(+) diff --git a/docs/devel/testing.rst b/docs/devel/testing.rst index 9d6a8f8636..11a0359218 100644 --- a/docs/devel/testing.rst +++ b

[PATCH v4 6/6] blkdebug: protect rules and suspended_reqs with a lock

2021-06-04 Thread Emanuele Giuseppe Esposito
Giuseppe Esposito --- block/blkdebug.c | 46 +++--- 1 file changed, 35 insertions(+), 11 deletions(-) diff --git a/block/blkdebug.c b/block/blkdebug.c index d597753139..ac3799f739 100644 --- a/block/blkdebug.c +++ b/block/blkdebug.c @@ -38,24 +38,27 @@ #include

[PATCH v5 14/16] docs/devel/testing: add --valgrind option to the debug section of QEMU iotests

2021-06-04 Thread Emanuele Giuseppe Esposito
Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Max Reitz Reviewed-by: Vladimir Sementsov-Ogievskiy --- docs/devel/testing.rst | 7 +++ 1 file changed, 7 insertions(+) diff --git a/docs/devel/testing.rst b/docs/devel/testing.rst index 11a0359218..9cac707ee5 100644 --- a/docs/devel

[PATCH v5 07/16] qemu_iotests: insert gdbserver command line as wrapper for qemu binary

2021-06-04 Thread Emanuele Giuseppe Esposito
Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Vladimir Sementsov-Ogievskiy --- tests/qemu-iotests/iotests.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index d4bfd8f1d6..c547e8c07b 100644

[PATCH v5 08/16] qemu-iotests: add gdbserver option to script tests too

2021-06-04 Thread Emanuele Giuseppe Esposito
The only limitation here is that running a script with gdbserver will make the test output mismatch with the expected results, making the test fail. Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Vladimir Sementsov-Ogievskiy --- tests/qemu-iotests/common.rc | 8 +++- 1 file changed

[PATCH v5 15/16] qemu-iotests: add option to show qemu binary logs on stdout

2021-06-04 Thread Emanuele Giuseppe Esposito
Using the flag -p, allow the qemu binary to print to stdout. Also create the common function _close_qemu_log_file() to avoid accessing machine.py private fields directly and have duplicate code. Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Vladimir Sementsov-Ogievskiy --- python

[PATCH v5 11/16] qemu-iotests: extend QMP socket timeout when using valgrind

2021-06-04 Thread Emanuele Giuseppe Esposito
As with gdbserver, valgrind delays the test execution, so the default QMP socket timeout and the generic class Timeout in iotests.py timeouts too soon. Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Vladimir Sementsov-Ogievskiy --- tests/qemu-iotests/iotests.py | 4 ++-- 1 file changed

[PATCH v5 13/16] qemu-iotests: insert valgrind command line as wrapper for qemu binary

2021-06-04 Thread Emanuele Giuseppe Esposito
If --gdb and --valgrind are both defined, return an error. Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Vladimir Sementsov-Ogievskiy --- tests/qemu-iotests/iotests.py | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu

[PATCH v5 16/16] docs/devel/testing: add -p option to the debug section of QEMU iotests

2021-06-04 Thread Emanuele Giuseppe Esposito
Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Vladimir Sementsov-Ogievskiy --- docs/devel/testing.rst | 4 1 file changed, 4 insertions(+) diff --git a/docs/devel/testing.rst b/docs/devel/testing.rst index 9cac707ee5..c038ca93d4 100644 --- a/docs/devel/testing.rst +++ b/docs

[PATCH v4 4/6] blkdebug: do not suspend in the middle of QLIST_FOREACH_SAFE

2021-06-04 Thread Emanuele Giuseppe Esposito
affect the existing testcases. Use actions_count to see how many yield to issue. Co-developed-by: Paolo Bonzini Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Vladimir Sementsov-Ogievskiy --- block/blkdebug.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/block

[PATCH v4 1/6] blkdebug: refactor removal of a suspended request

2021-06-04 Thread Emanuele Giuseppe Esposito
lo Bonzini Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Vladimir Sementsov-Ogievskiy --- block/blkdebug.c | 28 +--- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/block/blkdebug.c b/block/blkdebug.c index 2c0b9b0ee8..8f19d991fa 100644 -

Re: [PATCH v4 05/15] qemu-iotests: delay QMP socket timers

2021-06-03 Thread Emanuele Giuseppe Esposito
On 03/06/2021 14:25, Vladimir Sementsov-Ogievskiy wrote: 03.06.2021 14:03, Emanuele Giuseppe Esposito wrote: So, you just make the class do nothing.. I'd prefer something like this: @contextmanager def NoTimeout:     yield if qemu_gdb:    Timeout = NoTimeout I am not sure I understand

[PATCH v8 06/16] qemu-iotests: delay QMP socket timers

2021-07-05 Thread Emanuele Giuseppe Esposito
Attaching gdbserver implies that the qmp socket should wait indefinitely for an answer from QEMU. Signed-off-by: Emanuele Giuseppe Esposito --- tests/qemu-iotests/iotests.py | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu

[PATCH v8 11/16] qemu-iotests: extend QMP socket timeout when using valgrind

2021-07-05 Thread Emanuele Giuseppe Esposito
As with gdbserver, valgrind delays the test execution, so the default QMP socket timeout and the generic class Timeout in iotests.py timeouts too soon. Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Vladimir Sementsov-Ogievskiy --- tests/qemu-iotests/iotests.py | 6 +++--- 1 file

[PATCH v8 07/16] qemu_iotests: insert gdbserver command line as wrapper for qemu binary

2021-07-05 Thread Emanuele Giuseppe Esposito
Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Vladimir Sementsov-Ogievskiy --- tests/qemu-iotests/iotests.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index e176a84620..e7e3d92d3e 100644

[PATCH v8 10/16] qemu-iotests: extend the check script to prepare supporting valgrind for python tests

2021-07-05 Thread Emanuele Giuseppe Esposito
lgrind PID to assign to the log file name, use the "%p" flag in valgrind log file name that automatically puts the process PID at runtime. Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Max Reitz Reviewed-by: Vladimir Sementsov-Ogievskiy --- tests/qemu-iotests/check | 7

[PATCH v8 14/16] docs/devel/testing: add -valgrind option to the debug section of QEMU iotests

2021-07-05 Thread Emanuele Giuseppe Esposito
Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Max Reitz Reviewed-by: Vladimir Sementsov-Ogievskiy --- docs/devel/testing.rst | 6 ++ 1 file changed, 6 insertions(+) diff --git a/docs/devel/testing.rst b/docs/devel/testing.rst index 8b24e6fb47..719accdb1e 100644 --- a/docs/devel

[PATCH v8 16/16] docs/devel/testing: add -p option to the debug section of QEMU iotests

2021-07-05 Thread Emanuele Giuseppe Esposito
Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Vladimir Sementsov-Ogievskiy --- docs/devel/testing.rst | 4 1 file changed, 4 insertions(+) diff --git a/docs/devel/testing.rst b/docs/devel/testing.rst index 719accdb1e..e5311cb167 100644 --- a/docs/devel/testing.rst +++ b/docs

[PATCH v8 12/16] qemu-iotests: allow valgrind to read/delete the generated log file

2021-07-05 Thread Emanuele Giuseppe Esposito
When using -valgrind on the script tests, it generates a log file in $TEST_DIR that is either read (if valgrind finds problems) or otherwise deleted. Provide the same exact behavior when using -valgrind on the python tests. Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Vladimir

[PATCH v8 09/16] docs/devel/testing: add -gdb option to the debugging section of QEMU iotests

2021-07-05 Thread Emanuele Giuseppe Esposito
Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Vladimir Sementsov-Ogievskiy --- docs/devel/testing.rst | 11 +++ 1 file changed, 11 insertions(+) diff --git a/docs/devel/testing.rst b/docs/devel/testing.rst index 9d6a8f8636..8b24e6fb47 100644 --- a/docs/devel/testing.rst +++ b

[PATCH v8 04/16] docs/devel/testing: add debug section to the QEMU iotests chapter

2021-07-05 Thread Emanuele Giuseppe Esposito
Introduce the "Debugging a test case" section, in preparation to the additional flags that will be added in the next patches. Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Vladimir Sementsov-Ogievskiy --- docs/devel/testing.rst | 8 1 file changed, 8 insertions(+)

[PATCH v8 05/16] qemu-iotests: add option to attach gdbserver

2021-07-05 Thread Emanuele Giuseppe Esposito
-off-by: Emanuele Giuseppe Esposito Reviewed-by: Vladimir Sementsov-Ogievskiy --- tests/qemu-iotests/check | 6 +- tests/qemu-iotests/iotests.py | 5 + tests/qemu-iotests/testenv.py | 17 +++-- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/tests/qemu

[PATCH v8 00/16] qemu_iotests: improve debugging options

2021-07-05 Thread Emanuele Giuseppe Esposito
. Signed-off-by: Emanuele Giuseppe Esposito --- v7: * Adjust documentation and error message when -gdb and -valgrind are set at the same time [Eric] * Add missing Acked-by [John] Emanuele Giuseppe Esposito (15): python: qemu: add timer parameter for qmp.accept socket python: qemu: pass the wrapper

[PATCH v8 02/16] python: Reduce strictness of pylint's duplicate-code check

2021-07-05 Thread Emanuele Giuseppe Esposito
From: John Snow Pylint prior to 2.8.3 (We pin at >= 2.8.0) includes function and method signatures as part of its duplicate checking algorithm. This check does not listen to pragmas, so the only way to disable it is to turn it off completely or increase the minimum duplicate lines so that it

[PATCH v8 01/16] python: qemu: add timer parameter for qmp.accept socket

2021-07-05 Thread Emanuele Giuseppe Esposito
to the QMP monitor test command execution. Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: John Snow Acked-by: John Snow --- python/qemu/machine/machine.py | 7 +-- python/qemu/machine/qtest.py | 5 +++-- tests/qemu-iotests/iotests.py | 3

[PATCH v8 03/16] python: qemu: pass the wrapper field from QEMUQtestmachine to QEMUMachine

2021-07-05 Thread Emanuele Giuseppe Esposito
Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: John Snow Reviewed-by: Max Reitz Acked-by: John Snow --- python/qemu/machine/qtest.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/python/qemu/machine/qtest.py b/python

[PATCH v8 13/16] qemu-iotests: insert valgrind command line as wrapper for qemu binary

2021-07-05 Thread Emanuele Giuseppe Esposito
If -gdb and -valgrind are both defined, return an error. Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Vladimir Sementsov-Ogievskiy --- tests/qemu-iotests/iotests.py | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu

[PATCH v8 15/16] qemu-iotests: add option to show qemu binary logs on stdout

2021-07-05 Thread Emanuele Giuseppe Esposito
Using the flag -p, allow the qemu binary to print to stdout. Also create the common function _close_qemu_log_file() to avoid accessing machine.py private fields directly and have duplicate code. Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Vladimir Sementsov-Ogievskiy --- python

[PATCH v8 08/16] qemu-iotests: add gdbserver option to script tests too

2021-07-05 Thread Emanuele Giuseppe Esposito
Remove read timer in test script when GDB_OPTIONS are set, so that the bash tests won't timeout while running gdb. The only limitation here is that running a script with gdbserver will make the test output mismatch with the expected results, making the test fail. Signed-off-by: Emanuele Giuseppe

[RFC PATCH 6/6] jobs: remove unnecessary AioContext aquire/release pairs

2021-07-07 Thread Emanuele Giuseppe Esposito
it with aiocontext_acquire/release pairs. These sections will also be removed in future, when the underlaying bdrv_* API will also be free of context locks. Signed-off-by: Emanuele Giuseppe Esposito --- block/mirror.c | 6 ++ block/monitor/block-hmp-cmds.c | 6 -- blockdev.c

[RFC PATCH 1/6] job: use getter/setters instead of accessing the Job fields directly

2021-07-07 Thread Emanuele Giuseppe Esposito
patches. No functional change intended. Signed-off-by: Emanuele Giuseppe Esposito --- include/qemu/job.h | 33 +++ block.c | 2 +- block/commit.c | 4 +-- block/mirror.c | 17 +- block/replication.c | 3 +- blockdev.c | 2 +- blockjob.c

[RFC PATCH 2/6] job: _locked functions and public job_lock/unlock for next patch

2021-07-07 Thread Emanuele Giuseppe Esposito
Create _locked functions, to make next patch a little bit smaller. Also set the locking functions as public, so that they can be used also from structures using the Job struct. Signed-off-by: Emanuele Giuseppe Esposito --- include/qemu/job.h | 23 + job.c | 85

[RFC PATCH 0/6] job: replace AioContext lock with job_mutex

2021-07-07 Thread Emanuele Giuseppe Esposito
unt of changes in patch 5, any suggestion on how to improve the patch layout is also very much appreciated. Emanuele Giuseppe Esposito (6): job: use getter/setters instead of accessing the Job fields directly job: _locked functions and public job_lock/unlock for next patch job: minor changes to simpl

[RFC PATCH 5/6] job: use global job_mutex to protect struct Job

2021-07-07 Thread Emanuele Giuseppe Esposito
This lock is going to replace most of the AioContext locks in the job and blockjob, so that a Job can run in an arbitrary AioContext. Signed-off-by: Emanuele Giuseppe Esposito --- include/block/blockjob_int.h | 1 + include/qemu/job.h | 2 + block/backup.c | 4

[RFC PATCH 3/6] job: minor changes to simplify locking

2021-07-07 Thread Emanuele Giuseppe Esposito
Check for NULL id to job_get, so that in the next patch we can move job_get inside a single critical section of job_create. Also add missing notifier_list_init for the on_idle NotifierList, which seems to have been forgot. Signed-off-by: Emanuele Giuseppe Esposito --- job.c | 16

[RFC PATCH 4/6] job.h: categorize job fields

2021-07-07 Thread Emanuele Giuseppe Esposito
This makes it easier to understand what needs to be protected by a lock and what doesn't. Signed-off-by: Emanuele Giuseppe Esposito --- include/qemu/job.h | 101 - 1 file changed, 82 insertions(+), 19 deletions(-) diff --git a/include/qemu/job.h b

[PATCH v5 2/5] block-copy: streamline choice of copy_range vs. read/write

2021-06-24 Thread Emanuele Giuseppe Esposito
-by: Emanuele Giuseppe Esposito Signed-off-by: Paolo Bonzini --- block/block-copy.c | 176 +++-- 1 file changed, 90 insertions(+), 86 deletions(-) diff --git a/block/block-copy.c b/block/block-copy.c index f0dbb4912b..bbcc53ff70 100644 --- a/block/block-copy.c

[PATCH v5 4/5] block-copy: add CoMutex lock

2021-06-24 Thread Emanuele Giuseppe Esposito
so outside coroutines. - .skip_unallocated is atomic. Including it under the mutex would increase the critical sections and make them also much more complex. We can have it as atomic since it is only written from outside and read by block-copy coroutines. Signed-off-by: Emanuele Giuseppe Esposito

[PATCH v5 3/5] block-copy: move progress_set_remaining in block_copy_task_end

2021-06-24 Thread Emanuele Giuseppe Esposito
Moving this function in task_end ensures to update the progress anyways, even if there is an error. It also helps in next patch, allowing task_end to have only one critical section. Reviewed-by: Vladimir Sementsov-Ogievskiy Signed-off-by: Emanuele Giuseppe Esposito --- block/block-copy.c | 6

[PATCH v5 0/5] block-copy: protect block-copy internal structures

2021-06-24 Thread Emanuele Giuseppe Esposito
-on: <20210518094058.25952-1-eespo...@redhat.com> Signed-off-by: Emanuele Giuseppe Esposito --- v5: * Squash patch 3 (improve comments) with patch 5 (add CoMutex). * Better comments in block-copy, drop IN/OUT/State categories * Remove some load_acquire in patch 6, replace them with atomic

[PATCH v5 1/5] block-copy: small refactor in block_copy_task_entry and block_copy_common

2021-06-24 Thread Emanuele Giuseppe Esposito
Use a local variable instead of referencing BlockCopyState through a BlockCopyCallState or BlockCopyTask every time. This is in preparation for next patches. No functional change intended. Reviewed-by: Vladimir Sementsov-Ogievskiy Signed-off-by: Emanuele Giuseppe Esposito --- block/block

[PATCH v5 5/5] block-copy: atomic .cancelled and .finished fields in BlockCopyCallState

2021-06-24 Thread Emanuele Giuseppe Esposito
, and read outside. Signed-off-by: Emanuele Giuseppe Esposito --- include/block/block-copy.h | 2 ++ block/block-copy.c | 37 ++--- 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/include/block/block-copy.h b/include/block/block-copy.h index

[PATCH v7 16/16] docs/devel/testing: add -p option to the debug section of QEMU iotests

2021-06-28 Thread Emanuele Giuseppe Esposito
Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Vladimir Sementsov-Ogievskiy --- docs/devel/testing.rst | 4 1 file changed, 4 insertions(+) diff --git a/docs/devel/testing.rst b/docs/devel/testing.rst index fa85592a38..28a0b37b84 100644 --- a/docs/devel/testing.rst +++ b/docs

[PATCH v7 15/16] qemu-iotests: add option to show qemu binary logs on stdout

2021-06-28 Thread Emanuele Giuseppe Esposito
Using the flag -p, allow the qemu binary to print to stdout. Also create the common function _close_qemu_log_file() to avoid accessing machine.py private fields directly and have duplicate code. Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Vladimir Sementsov-Ogievskiy --- python

[PATCH v7 01/16] python: qemu: add timer parameter for qmp.accept socket

2021-06-28 Thread Emanuele Giuseppe Esposito
to the QMP monitor test command execution. Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: John Snow --- python/qemu/machine/machine.py | 7 +-- python/qemu/machine/qtest.py | 5 +++-- tests/qemu-iotests/iotests.py | 3 ++- 3 files changed, 10

[PATCH v7 14/16] docs/devel/testing: add -valgrind option to the debug section of QEMU iotests

2021-06-28 Thread Emanuele Giuseppe Esposito
Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Max Reitz Reviewed-by: Vladimir Sementsov-Ogievskiy --- docs/devel/testing.rst | 7 +++ 1 file changed, 7 insertions(+) diff --git a/docs/devel/testing.rst b/docs/devel/testing.rst index 8b24e6fb47..fa85592a38 100644 --- a/docs/devel

[PATCH v7 07/16] qemu_iotests: insert gdbserver command line as wrapper for qemu binary

2021-06-28 Thread Emanuele Giuseppe Esposito
Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Vladimir Sementsov-Ogievskiy --- tests/qemu-iotests/iotests.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index e176a84620..e7e3d92d3e 100644

[PATCH v7 11/16] qemu-iotests: extend QMP socket timeout when using valgrind

2021-06-28 Thread Emanuele Giuseppe Esposito
As with gdbserver, valgrind delays the test execution, so the default QMP socket timeout and the generic class Timeout in iotests.py timeouts too soon. Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Vladimir Sementsov-Ogievskiy --- tests/qemu-iotests/iotests.py | 6 +++--- 1 file

[PATCH v7 10/16] qemu-iotests: extend the check script to prepare supporting valgrind for python tests

2021-06-28 Thread Emanuele Giuseppe Esposito
lgrind PID to assign to the log file name, use the "%p" flag in valgrind log file name that automatically puts the process PID at runtime. Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Max Reitz Reviewed-by: Vladimir Sementsov-Ogievskiy --- tests/qemu-iotests/check | 7

[PATCH v7 06/16] qemu-iotests: delay QMP socket timers

2021-06-28 Thread Emanuele Giuseppe Esposito
Attaching gdbserver implies that the qmp socket should wait indefinitely for an answer from QEMU. Signed-off-by: Emanuele Giuseppe Esposito --- tests/qemu-iotests/iotests.py | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu

[PATCH v7 03/16] python: qemu: pass the wrapper field from QEMUQtestmachine to QEMUMachine

2021-06-28 Thread Emanuele Giuseppe Esposito
Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: John Snow Reviewed-by: Max Reitz --- python/qemu/machine/qtest.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/python/qemu/machine/qtest.py b/python/qemu/machine/qtest.py

[PATCH v7 00/16] qemu_iotests: improve debugging options

2021-06-28 Thread Emanuele Giuseppe Esposito
-off-by: Emanuele Giuseppe Esposito --- v7: * While using debugging tests with gdb, I found out that there is a timer also in bash scripts (common.qemu). Modify patch 8 to remove the timer when gdb is used. Emanuele Giuseppe Esposito (15): python: qemu: add timer parameter for qmp.accept

[PATCH v7 02/16] python: Reduce strictness of pylint's duplicate-code check

2021-06-28 Thread Emanuele Giuseppe Esposito
From: John Snow Pylint prior to 2.8.3 (We pin at >= 2.8.0) includes function and method signatures as part of its duplicate checking algorithm. This check does not listen to pragmas, so the only way to disable it is to turn it off completely or increase the minimum duplicate lines so that it

[PATCH v7 04/16] docs/devel/testing: add debug section to the QEMU iotests chapter

2021-06-28 Thread Emanuele Giuseppe Esposito
Introduce the "Debugging a test case" section, in preparation to the additional flags that will be added in the next patches. Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Vladimir Sementsov-Ogievskiy --- docs/devel/testing.rst | 8 1 file changed, 8 insertions(+)

[PATCH v7 05/16] qemu-iotests: add option to attach gdbserver

2021-06-28 Thread Emanuele Giuseppe Esposito
-off-by: Emanuele Giuseppe Esposito Reviewed-by: Vladimir Sementsov-Ogievskiy --- tests/qemu-iotests/check | 6 +- tests/qemu-iotests/iotests.py | 5 + tests/qemu-iotests/testenv.py | 17 +++-- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/tests/qemu

[PATCH v7 08/16] qemu-iotests: add gdbserver option to script tests too

2021-06-28 Thread Emanuele Giuseppe Esposito
Remove read timer in test script when GDB_OPTIONS are set, so that the bash tests won't timeout while running gdb. The only limitation here is that running a script with gdbserver will make the test output mismatch with the expected results, making the test fail. Signed-off-by: Emanuele Giuseppe

[PATCH v7 13/16] qemu-iotests: insert valgrind command line as wrapper for qemu binary

2021-06-28 Thread Emanuele Giuseppe Esposito
If -gdb and -valgrind are both defined, return an error. Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Vladimir Sementsov-Ogievskiy --- tests/qemu-iotests/iotests.py | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu

[PATCH v7 09/16] docs/devel/testing: add -gdb option to the debugging section of QEMU iotests

2021-06-28 Thread Emanuele Giuseppe Esposito
Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Vladimir Sementsov-Ogievskiy --- docs/devel/testing.rst | 11 +++ 1 file changed, 11 insertions(+) diff --git a/docs/devel/testing.rst b/docs/devel/testing.rst index 9d6a8f8636..8b24e6fb47 100644 --- a/docs/devel/testing.rst +++ b

[PATCH v7 12/16] qemu-iotests: allow valgrind to read/delete the generated log file

2021-06-28 Thread Emanuele Giuseppe Esposito
When using -valgrind on the script tests, it generates a log file in $TEST_DIR that is either read (if valgrind finds problems) or otherwise deleted. Provide the same exact behavior when using -valgrind on the python tests. Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Vladimir

Re: [PATCH v7 14/16] docs/devel/testing: add -valgrind option to the debug section of QEMU iotests

2021-06-29 Thread Emanuele Giuseppe Esposito
On 28/06/2021 23:00, Eric Blake wrote: On Mon, Jun 28, 2021 at 02:31:48PM +0200, Emanuele Giuseppe Esposito wrote: Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Max Reitz Reviewed-by: Vladimir Sementsov-Ogievskiy --- docs/devel/testing.rst | 7 +++ 1 file changed, 7

Re: [PATCH v7 00/16] qemu_iotests: improve debugging options

2021-06-29 Thread Emanuele Giuseppe Esposito
On 28/06/2021 18:48, John Snow wrote: On Mon, Jun 28, 2021 at 8:32 AM Emanuele Giuseppe Esposito mailto:eespo...@redhat.com>> wrote: This series adds the option to attach gdbserver and valgrind to the QEMU binary running in qemu_iotests. It also allows to redirec

Re: [RFC PATCH 3/6] job: minor changes to simplify locking

2021-07-12 Thread Emanuele Giuseppe Esposito
On 08/07/2021 12:55, Stefan Hajnoczi wrote: On Wed, Jul 07, 2021 at 06:58:10PM +0200, Emanuele Giuseppe Esposito wrote: @@ -406,15 +410,18 @@ void *job_create(const char *job_id, const JobDriver *driver, JobTxn *txn, error_setg(errp, "Invalid job ID '%s'&quo

Re: [RFC PATCH 5/6] job: use global job_mutex to protect struct Job

2021-07-12 Thread Emanuele Giuseppe Esposito
On 08/07/2021 14:56, Stefan Hajnoczi wrote: On Wed, Jul 07, 2021 at 06:58:12PM +0200, Emanuele Giuseppe Esposito wrote: This lock is going to replace most of the AioContext locks in the job and blockjob, so that a Job can run in an arbitrary AioContext. Signed-off-by: Emanuele Giuseppe

Re: [RFC PATCH 4/6] job.h: categorize job fields

2021-07-12 Thread Emanuele Giuseppe Esposito
On 08/07/2021 13:02, Stefan Hajnoczi wrote: On Wed, Jul 07, 2021 at 06:58:11PM +0200, Emanuele Giuseppe Esposito wrote: -/** AioContext to run the job coroutine in */ +/** + * AioContext to run the job coroutine in. + * Atomic. + */ AioContext *aio_context

Re: [RFC PATCH 2/6] job: _locked functions and public job_lock/unlock for next patch

2021-07-12 Thread Emanuele Giuseppe Esposito
On 08/07/2021 12:50, Stefan Hajnoczi wrote: On Wed, Jul 07, 2021 at 06:58:09PM +0200, Emanuele Giuseppe Esposito wrote: diff --git a/job.c b/job.c index 872bbebb01..96fb8e9730 100644 --- a/job.c +++ b/job.c @@ -32,6 +32,10 @@ #include "trace/trace-root.h" #include "qapi/qa

Re: [RFC PATCH 0/6] job: replace AioContext lock with job_mutex

2021-07-12 Thread Emanuele Giuseppe Esposito
On 08/07/2021 15:04, Stefan Hajnoczi wrote: On Thu, Jul 08, 2021 at 01:32:12PM +0200, Paolo Bonzini wrote: On 08/07/21 12:36, Stefan Hajnoczi wrote: What is very clear from this patch is that it is strictly related to the brdv_* and lower level calls, because they also internally check or

Re: [RFC PATCH 0/6] job: replace AioContext lock with job_mutex

2021-07-12 Thread Emanuele Giuseppe Esposito
On 08/07/2021 15:09, Stefan Hajnoczi wrote: On Wed, Jul 07, 2021 at 06:58:07PM +0200, Emanuele Giuseppe Esposito wrote: This is a continuation on the work to reduce (and possibly get rid of) the usage of AioContext lock, by introducing smaller granularity locks to keep the thread safety

Re: [PATCH v3 05/15] qemu-iotests: delay QMP socket timers

2021-04-30 Thread Emanuele Giuseppe Esposito
On 30/04/2021 13:59, Max Reitz wrote: On 14.04.21 19:03, Emanuele Giuseppe Esposito wrote: Attaching a gdbserver implies that the qmp socket should wait indefinitely for an answer from QEMU. Signed-off-by: Emanuele Giuseppe Esposito ---   python/qemu/machine.py    |  3 +++   tests/qemu

Re: [PATCH v3 14/15] qemu_iotests: add option to show qemu binary logs on stdout

2021-04-30 Thread Emanuele Giuseppe Esposito
On 30/04/2021 15:50, Max Reitz wrote: On 14.04.21 19:03, Emanuele Giuseppe Esposito wrote: Using the flag -p, allow the qemu binary to print to stdout. This helps especially when doing print-debugging. I think this shouldn’t refer to prints but to qemu’s stdout/stderr in general, i.e

Re: [PATCH v3 04/15] qemu-iotests: add option to attach gdbserver

2021-04-30 Thread Emanuele Giuseppe Esposito
On 30/04/2021 13:38, Max Reitz wrote: On 14.04.21 19:03, Emanuele Giuseppe Esposito wrote: Add -gdb flag and GDB_QEMU environmental variable to python tests to attach a gdbserver to each qemu instance. Well, this patch doesn’t do this, but OK. Maybe "define" rather

Re: [PATCH v3 10/15] qemu_iotests: extent QMP socket timeout when using valgrind

2021-04-30 Thread Emanuele Giuseppe Esposito
On 30/04/2021 15:02, Max Reitz wrote: On 14.04.21 19:03, Emanuele Giuseppe Esposito wrote: As with gdbserver, valgrind delays the test execution, so the default QMP socket timeout timeout too soon. I’m curious: The default timeouts should be long enough for slow systems, too, though (e.g

Re: [PATCH] block: simplify write-threshold and drop write notifiers

2021-04-22 Thread Emanuele Giuseppe Esposito
On 22/04/2021 00:09, Vladimir Sementsov-Ogievskiy wrote: write-notifiers are used only for write-threshold. New code for such purpose should create filters. Let's handle write-threshold simply in generic code and drop write notifiers at all. Also move part of write-threshold API that is

Re: [PATCH v2 0/5] qemu-iotests: quality of life improvements

2021-03-24 Thread Emanuele Giuseppe Esposito
-- tests/qemu-iotests/testrunner.py | 15 +- 4 files changed, 81 insertions(+), 49 deletions(-) I can confirm that this helps a lot when debugging tests. Tested-by: Emanuele Giuseppe Esposito

[RFC PATCH 2/3] qemu-iotests: add option to attach gdbserver

2021-04-01 Thread Emanuele Giuseppe Esposito
e script will ignore the environmental variable. Signed-off-by: Emanuele Giuseppe Esposito --- python/qemu/machine.py| 4 +++- python/qemu/qtest.py | 4 +++- tests/qemu-iotests/check | 5 - tests/qemu-iotests/iotests.py | 7 ++- tests/qemu-iotests/testenv.py | 15

[RFC PATCH 1/3] python: qemu: add timer parameter for qmp.accept socket

2021-04-01 Thread Emanuele Giuseppe Esposito
Extend the _post_launch function to include the timer as parameter instead of defaulting to 15 sec. Signed-off-by: Emanuele Giuseppe Esposito --- python/qemu/machine.py | 4 ++-- python/qemu/qtest.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/python/qemu

[RFC PATCH 0/3] qemu-iotests: attach gdbserver to qemu instance

2021-04-01 Thread Emanuele Giuseppe Esposito
separately. Emanuele Giuseppe Esposito (3): python: qemu: add timer parameter for qmp.accept socket qemu-iotests: add option to attach gdbserver qemu-iotests: add gdbserver option to script tests too python/qemu/machine.py| 8 +--- python/qemu/qtest.py | 8 +--- tests/qe

[RFC PATCH 3/3] qemu-iotests: add gdbserver option to script tests too

2021-04-01 Thread Emanuele Giuseppe Esposito
The only limitation here is that running a script with gdbserver will make the test output mismatch with the expected results, making the test fail. Signed-off-by: Emanuele Giuseppe Esposito --- tests/qemu-iotests/common.rc | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff

[RFC PATCH v2 08/11] qemu_iotests: extent QMP socket timeout when using valgrind

2021-04-07 Thread Emanuele Giuseppe Esposito
As with gdbserver, valgrind delays the test execution, so the default QMP socket timeout expires too soon. Signed-off-by: Emanuele Giuseppe Esposito --- python/qemu/machine.py| 4 +++- tests/qemu-iotests/iotests.py | 8 2 files changed, 7 insertions(+), 5 deletions(-) diff

[RFC PATCH v2 02/11] python: qemu: pass the wrapper field from QEMUQtestmachine to QEMUMachine

2021-04-07 Thread Emanuele Giuseppe Esposito
Signed-off-by: Emanuele Giuseppe Esposito --- python/qemu/machine.py | 2 +- python/qemu/qtest.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/python/qemu/machine.py b/python/qemu/machine.py index c721e07d63..18d32ebe45 100644 --- a/python/qemu/machine.py +++ b

[RFC PATCH v2 00/11] qemu_iotests: improve debugging options

2021-04-07 Thread Emanuele Giuseppe Esposito
. This series is tested on the previous serie "qemu-iotests: quality of life improvements" but independent from it, so it can be applied separately. Signed-off-by: Emanuele Giuseppe Esposito --- v2: - add valgrind and print patches - better splitup of patches, and clearer commit messages Emanuel

[RFC PATCH v2 01/11] python: qemu: add timer parameter for qmp.accept socket

2021-04-07 Thread Emanuele Giuseppe Esposito
Extend the _post_launch function to include the timer as parameter instead of defaulting to 15 sec. Signed-off-by: Emanuele Giuseppe Esposito --- python/qemu/machine.py | 4 ++-- python/qemu/qtest.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/python/qemu

[RFC PATCH v2 06/11] qemu-iotests: add gdbserver option to script tests too

2021-04-07 Thread Emanuele Giuseppe Esposito
The only limitation here is that running a script with gdbserver will make the test output mismatch with the expected results, making the test fail. Signed-off-by: Emanuele Giuseppe Esposito --- tests/qemu-iotests/common.rc | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff

[RFC PATCH v2 10/11] qemu_iotests: insert valgrind command line as wrapper for qemu binary

2021-04-07 Thread Emanuele Giuseppe Esposito
The priority will be given to gdb command line, meaning if -gdb and -valgrind parameters are given, only gdb will be wrapped around the qemu binary. Signed-off-by: Emanuele Giuseppe Esposito --- tests/qemu-iotests/iotests.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git

[RFC PATCH v2 04/11] qemu-iotests: delay QMP socket timers

2021-04-07 Thread Emanuele Giuseppe Esposito
Attaching a gdbserver implies that the qmp socket should wait indefinitely for an answer from QEMU. Signed-off-by: Emanuele Giuseppe Esposito --- python/qemu/machine.py| 4 +++- tests/qemu-iotests/iotests.py | 21 + 2 files changed, 20 insertions(+), 5 deletions

[RFC PATCH v2 05/11] qemu_iotests: insert gdbserver command line as wrapper for qemu binary

2021-04-07 Thread Emanuele Giuseppe Esposito
Signed-off-by: Emanuele Giuseppe Esposito --- tests/qemu-iotests/iotests.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 17f07710db..8f6bb20af5 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu

[RFC PATCH v2 03/11] qemu-iotests: add option to attach gdbserver

2021-04-07 Thread Emanuele Giuseppe Esposito
Add -gdb flag and GDB_QEMU environmental variable to python tests to attach a gdbserver to each qemu instance. if -gdb is not provided but $GDB_QEMU is set, ignore the environmental variable. Signed-off-by: Emanuele Giuseppe Esposito --- tests/qemu-iotests/check | 6 +- tests/qemu

[RFC PATCH v2 11/11] qemu_iotests: add option to show qemu binary logs on stdout

2021-04-07 Thread Emanuele Giuseppe Esposito
Using the flag -p, allow the qemu binary to print to stdout. This is helpful especially for print-debugging. Signed-off-by: Emanuele Giuseppe Esposito --- tests/qemu-iotests/check | 3 ++- tests/qemu-iotests/iotests.py | 9 + tests/qemu-iotests/testenv.py | 9 +++-- 3 files

<    1   2   3   4   5   6   7   8   9   10   >