Re: [PATCH 2/3] util/main-loop: Introduce the main loop into QOM

2022-02-21 Thread Markus Armbruster
Nicolas Saenz Julienne writes: > 'event-loop-backend' provides basic property handling for all > 'AioContext' based event loops. So let's define a new 'MainLoopClass' > that inherits from it. This will permit tweaking the main loop's > properties through qapi as well as through the command line

Re: [PATCH v8 5/5] multifd: Implement zero copy write in multifd migration (multifd-zero-copy)

2022-02-21 Thread Leonardo Bras Soares Passos
On Mon, Feb 21, 2022 at 4:41 PM Leonardo Bras Soares Passos wrote: > > Hello Juan, thanks for the feedback! > > On Fri, Feb 18, 2022 at 1:57 PM Juan Quintela wrote: > > > > Leonardo Bras wrote: > > > Implement zero copy send on nocomp_send_write(), by making use of > > > QIOChannel > > >

[PATCH v2 18/18] iotests: reimplement img_info_log in terms of qemu_img_log

2022-02-21 Thread John Snow
Now every last call to qemu_img is certifiably either checked or logged. Signed-off-by: John Snow --- tests/qemu-iotests/iotests.py | 14 ++ 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index

[PATCH v2 17/18] iotests: make qemu_img_log() check log level

2022-02-21 Thread John Snow
Improve qemu_img_log() to actually check if logging is turned on. If it isn't, revert to the behavior of qemu_img(). This is done so that there really is no way to avoid scrutinizing qemu-ing subprocess calls by accident. You're gonna have to work for it. Signed-off-by: John Snow ---

[PATCH v2 16/18] iotests: remove qemu_img_pipe()

2022-02-21 Thread John Snow
With the exceptional 'create' calls removed in the prior commit, change qemu_img_log() and img_info_log() to call qemu_img() directly instead. In keeping with the spirit of diff-based tests, allow these calls to qemu_img() to return an unchecked non-zero status code -- because any error we'd see

[PATCH v2 15/18] iotests: remove qemu_img_log('create', ...) calls

2022-02-21 Thread John Snow
qemu_img_log() calls into qemu_img_pipe(), which always removes output for 'create' commands on success anyway. Replace all of these calls to the simpler qemu_img_create(...) which doesn't log, but raises a detailed exception object on failure instead. Blank lines are removed from output files

[PATCH v2 14/18] iotests: move has_working_luks onto qemu_img()

2022-02-21 Thread John Snow
Admittedly a mostly lateral move; the diagnostics are slightly better on program crash. Signed-off-by: John Snow --- tests/qemu-iotests/iotests.py | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py

[PATCH v2 13/18] iotests: remove external calls to qemu_img_pipe()

2022-02-21 Thread John Snow
Several cases here rely on the knowledge that qemu_img_pipe() suppresses *all* output on a successful case when the command being issued is 'create'. 065: This call's output is inspected, but it appears as if it's expected to succeed. Replace this call with the checked qemu_img() variant

[PATCH v2 12/18] iotests: replace unchecked calls to qemu_img_pipe()

2022-02-21 Thread John Snow
qemu_img_pipe() discards the return code in favor of returning just the output. Some tests using this function don't save, log, or check the output either, though. Replace those calls to a checked version as appropriate. Tests affected are 194, 202, 203, 234, 262, and 303. Signed-off-by: John

[PATCH v2 11/18] iotests: change supports_quorum to use qemu_img

2022-02-21 Thread John Snow
Similar to other recent changes: use the qemu_img invocation that supports throwing loud, nasty exceptions when it fails for surprising reasons. (Why would "--help" ever fail? I don't know, but consistency is like a well-manicured bonsai.) Signed-off-by: John Snow ---

[PATCH v2 08/18] iotests: add qemu_img_info()

2022-02-21 Thread John Snow
Add qemu_img_info() by analogy with qemu_img_{measure,check}. Modify image_size() to use this function instead. Signed-off-by: John Snow --- tests/qemu-iotests/065| 5 ++--- tests/qemu-iotests/242| 5 ++--- tests/qemu-iotests/iotests.py | 12 3 files changed, 12

[PATCH v2 07/18] iotests: use qemu_img_json() when applicable

2022-02-21 Thread John Snow
These functions should now give better crash information when something unexpected happens. Signed-off-by: John Snow --- tests/qemu-iotests/iotests.py | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index

[PATCH v2 04/18] iotests: make qemu_img raise on non-zero rc by default

2022-02-21 Thread John Snow
re-write qemu_img() as a function that will by default raise a VerboseProcessException (extended from CalledProcessException) on non-zero return codes. This will produce a stack trace that will show the command line arguments and return code from the failed process run. Users that want something

[PATCH v2 01/18] python/utils: add enboxify() text decoration utility

2022-02-21 Thread John Snow
>>> print(enboxify(msg, width=72, name="commit message")) ┏━ commit message ━┓ ┃ enboxify() takes a chunk of text and wraps it in a text art box that ┃ ┃ adheres to a specified width. An optional title label may be given, ┃ ┃ and any of the

[PATCH v2 02/18] iotests: add VerboseProcessError

2022-02-21 Thread John Snow
This adds an Exception that extends the Python built-in subprocess.CalledProcessError. When this exception is raised, it will still be caught when selecting for the stdlib variant. The difference is that the str() method of this Exception also adds the stdout/stderr logs. In effect, if this

[PATCH v2 10/18] iotests: add qemu_img_map() function

2022-02-21 Thread John Snow
By analogy with qemu_img_{measure, check, info}. Replace calls to qemu_img_pipe('map', '--output=json', ...) with the new function. Signed-off-by: John Snow --- tests/qemu-iotests/041 | 5 ++--- tests/qemu-iotests/211 | 6 +++---

[PATCH v2 09/18] iotests: remove-bitmap-from-backing: use qemu_img_info()

2022-02-21 Thread John Snow
Remove two more usages of qemu_img_pipe(). Signed-off-by: John Snow --- tests/qemu-iotests/tests/remove-bitmap-from-backing | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/qemu-iotests/tests/remove-bitmap-from-backing

[PATCH v2 06/18] iotests: add qemu_img_json()

2022-02-21 Thread John Snow
A little helper built on top of qemu_img() that tries to pull a valid JSON document out of the stdout stream. In the event that the return code is negative (the program crashed), or the code is greater than zero and did not produce valid JSON output, the VerboseProcessError raised by qemu_img is

[PATCH v2 03/18] iotests: Remove explicit checks for qemu_img() == 0

2022-02-21 Thread John Snow
qemu_img() returning zero ought to be the rule, not the exception. Remove all explicit checks against the condition in preparation for making non-zero returns an Exception. Signed-off-by: John Snow Reviewed-by: Eric Blake --- tests/qemu-iotests/163 | 9 +++--

[PATCH v2 05/18] iotests: fortify compare_images() against crashes

2022-02-21 Thread John Snow
Make this helper function a little stricter about what it allows by default. If qemu_img returns some exit code that implies it didn't actually perform the comparison, treat that as an exceptional circumstance and force the caller to be aware of the peril. Signed-off-by: John Snow ---

[PATCH v2 00/18] iotests: add detailed tracebacks to qemu_img() failures

2022-02-21 Thread John Snow
This series does two things: (1) Adds more detailed information to terminal output when qemu-img crashes or returns with a non-zero exit code (2) Ensures that every last call to qemu-img made in the iotest test suite either returns a zero, *or* has its output logged. This is

Re: [PATCH v8 5/5] multifd: Implement zero copy write in multifd migration (multifd-zero-copy)

2022-02-21 Thread Leonardo Bras Soares Passos
On Fri, Feb 18, 2022 at 2:36 PM Juan Quintela wrote: > > Leonardo Bras Soares Passos wrote: > > Hello Peter, thanks for reviewing! > > > > On Mon, Feb 7, 2022 at 11:22 PM Peter Xu wrote: > >> > >> On Tue, Feb 01, 2022 at 03:29:03AM -0300, Leonardo Bras wrote: > >> > -void

Re: [PATCH] block/curl.c: Check error return from curl_easy_setopt()

2022-02-21 Thread Peter Maydell
On Tue, 1 Feb 2022 at 11:25, Hanna Reitz wrote: > > On 28.01.22 17:55, Peter Maydell wrote: > > Coverity points out that we aren't checking the return value > > from curl_easy_setopt() for any of the calls to it we make > > in block/curl.c. > > > > Fixes: Coverity CID 1459336, 1459482, 1460331 >

Re: [PATCH v8 5/5] multifd: Implement zero copy write in multifd migration (multifd-zero-copy)

2022-02-21 Thread Leonardo Bras Soares Passos
Hello Juan, thanks for the feedback! On Fri, Feb 18, 2022 at 1:57 PM Juan Quintela wrote: > > Leonardo Bras wrote: > > Implement zero copy send on nocomp_send_write(), by making use of QIOChannel > > writev + flags & flush interface. > > > > Change multifd_send_sync_main() so flush_zero_copy()

Re: [PULL 00/10] Misc next patches

2022-02-21 Thread Daniel P . Berrangé
On Fri, Feb 18, 2022 at 08:05:12PM +, Peter Maydell wrote: > On Thu, 17 Feb 2022 at 12:01, Daniel P. Berrangé wrote: > > > > The following changes since commit ad38520bdeb2b1e0b487db317f29119e94c1c88d: > > > > Merge remote-tracking branch > >

Re: [PATCH v2 2/2] hw/ide: add ich6 ide controller device emulation

2022-02-21 Thread Liav Albani
On 2/21/22 13:33, Gerd Hoffmann wrote: Hi, ICH6 and ICH7 IDE controllers are quite the same as far as I know. I could change it, but then one could argue that the name ich6-ide seems like "ich9-ide", so not sure if we can really go on this path. I think we don't actually have ich9-ide,

[PATCH v2] iotests: Write test output to TEST_DIR

2022-02-21 Thread Hanna Reitz
Drop the use of OUTPUT_DIR (test/qemu-iotests under the build directory), and instead write test output files (.out.bad, .notrun, and .casenotrun) to TEST_DIR. With this, the same test can be run concurrently without the separate instances interfering, because they will need separate TEST_DIRs

Re: [PATCH 2/2] iotests/303: Check for zstd support

2022-02-21 Thread Thomas Huth
On 21/02/2022 18.08, Hanna Reitz wrote: 303 runs two test cases, one of which requires zstd support. Unfortunately, given that this is not a unittest-style test, we cannot easily skip that single case, and instead can only skip the whole test. (Alternatively, we could split this test into a

[PATCH 0/3] util/thread-pool: Expose minimun and maximum size

2022-02-21 Thread Nicolas Saenz Julienne
As discussed on the previous RFC[1] the thread-pool's dynamic thread management doesn't play well with real-time and latency sensitive systems. This series introduces a set of controls that'll permit achieving more deterministic behaviours, for example by fixing the pool's size. We first

[PATCH 1/3] util & iothread: Introduce event-loop abstract class

2022-02-21 Thread Nicolas Saenz Julienne
Introduce the 'event-loop-backend' abstract class, it'll hold the properties common to all event loops and provide the necessary hooks for their creation. Then have 'IOThread' inherit from it. The class is defined as user creatable and provides a hook for its children to attach themselves to the

[PATCH 0/2] iotests: Check for zstd support

2022-02-21 Thread Hanna Reitz
Hi, We have two tests (as far as I know) that use compression_type=zstd for qcow2 but do not check whether that is actually supported. Thomas reported this for 065, but it’s also the case for 303. This series makes these tests be skipped when qemu-img reports this compression type to not be

Re: [PATCH 1/2] iotests/065: Check for zstd support

2022-02-21 Thread Thomas Huth
On 21/02/2022 18.08, Hanna Reitz wrote: Some test cases run in iotest 065 require zstd support. Skip them if qemu-img reports it not to be available. Reported-by: Thomas Huth Fixes: 12a936171d71f839dc907ff ("iotest 065: explicit compression type") Signed-off-by: Hanna Reitz ---

[PATCH 3/3] util/event-loop: Introduce options to set the thread pool size

2022-02-21 Thread Nicolas Saenz Julienne
The thread pool regulates itself: when idle, it kills threads until empty, when in demand, it creates new threads until full. This behaviour doesn't play well with latency sensitive workloads where the price of creating a new thread is too high. For example, when paired with qemu's '-mlock', or

[PATCH 2/3] util/main-loop: Introduce the main loop into QOM

2022-02-21 Thread Nicolas Saenz Julienne
'event-loop-backend' provides basic property handling for all 'AioContext' based event loops. So let's define a new 'MainLoopClass' that inherits from it. This will permit tweaking the main loop's properties through qapi as well as through the command line using the '-object' keyword[1]. Only one

[PATCH 2/2] iotests/303: Check for zstd support

2022-02-21 Thread Hanna Reitz
303 runs two test cases, one of which requires zstd support. Unfortunately, given that this is not a unittest-style test, we cannot easily skip that single case, and instead can only skip the whole test. (Alternatively, we could split this test into a zlib and a zstd part, but that seems

[PATCH 1/2] iotests/065: Check for zstd support

2022-02-21 Thread Hanna Reitz
Some test cases run in iotest 065 require zstd support. Skip them if qemu-img reports it not to be available. Reported-by: Thomas Huth Fixes: 12a936171d71f839dc907ff ("iotest 065: explicit compression type") Signed-off-by: Hanna Reitz --- tests/qemu-iotests/065 | 11 --- 1 file

RE: [PATCH v1] aio-posix: fix build failure io_uring 2.2

2022-02-21 Thread Wang, Haiyue
> -Original Message- > From: Peter Maydell > Sent: Monday, February 21, 2022 23:55 > To: Stefan Hajnoczi > Cc: Wang, Haiyue ; Fam Zheng ; > qemu-de...@nongnu.org; open > list:Block I/O path > Subject: Re: [PATCH v1] aio-posix: fix build failure io_uring 2.2 > > On Mon, 21 Feb 2022 at

[PATCH v2] aio-posix: fix build failure io_uring 2.2

2022-02-21 Thread Haiyue Wang
The io_uring fixed "Don't truncate addr fields to 32-bit on 32-bit": https://git.kernel.dk/cgit/liburing/commit/?id=d84c29b19ed0b13619cff40141bb1fc3615b This leads to build failure: ../util/fdmon-io_uring.c: In function ‘add_poll_remove_sqe’: ../util/fdmon-io_uring.c:182:36: error: passing

RE: [PATCH v1] aio-posix: fix build failure io_uring 2.2

2022-02-21 Thread Wang, Haiyue
> -Original Message- > From: Stefan Hajnoczi > Sent: Monday, February 21, 2022 22:54 > To: Wang, Haiyue > Cc: qemu-de...@nongnu.org; Fam Zheng ; open list:Block I/O > path > Subject: Re: [PATCH v1] aio-posix: fix build failure io_uring 2.2 > > On Fri, Feb 18, 2022 at 12:16:27AM +0800,

Re: [PATCH v8 1/5] QIOChannel: Add flags on io_writev and introduce io_flush callback

2022-02-21 Thread Leonardo Bras Soares Passos
Thanks for reviewing, Juan! On Fri, Feb 18, 2022 at 1:36 PM Juan Quintela wrote: > > Leonardo Bras wrote: > > Add flags to io_writev and introduce io_flush as optional callback to > > QIOChannelClass, allowing the implementation of zero copy writes by > > subclasses. > > > > How to use them: >

Re: [PATCH 3/4] block: improve block_dirty_bitmap_merge(): don't allocate extra bitmap

2022-02-21 Thread Vladimir Sementsov-Ogievskiy
15.02.2022 20:53, Vladimir Sementsov-Ogievskiy wrote: We don't need extra bitmap. All we need is to backup the original bitmap when we do first merge. So, drop extra temporary bitmap and work directly with target and backup. Note that block_dirty_bitmap_merge() semantics changed: on failure

Re: [PATCH v1] aio-posix: fix build failure io_uring 2.2

2022-02-21 Thread Peter Maydell
On Mon, 21 Feb 2022 at 15:02, Stefan Hajnoczi wrote: > So the QEMU add_poll_remove_sqe() function would do: > > io_uring_prep_poll_remove(sqe, (__u64)(uintptr_t)node); __u64 is a linux-kernel-ism -- we should use uint64_t, I think. thanks -- PMM

Re: [PATCH v4 4/4] cpus: use coroutine TLS macros for iothread_locked

2022-02-21 Thread Philippe Mathieu-Daudé
On 21/2/22 15:29, Stefan Hajnoczi wrote: qemu_mutex_iothread_locked() may be used from coroutines. Standard __thread variables cannot be used by coroutines. Use the coroutine TLS macros instead. Signed-off-by: Stefan Hajnoczi --- softmmu/cpus.c | 8 1 file changed, 4 insertions(+),

Re: [PATCH v4 2/4] util/async: replace __thread with QEMU TLS macros

2022-02-21 Thread Philippe Mathieu-Daudé
On 21/2/22 15:29, Stefan Hajnoczi wrote: QEMU TLS macros must be used to make TLS variables safe with coroutines. Signed-off-by: Stefan Hajnoczi --- util/async.c | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) Reviewed-by: Philippe Mathieu-Daudé

Re: [PATCH v4 4/4] cpus: use coroutine TLS macros for iothread_locked

2022-02-21 Thread Philippe Mathieu-Daudé
On 21/2/22 15:29, Stefan Hajnoczi wrote: qemu_mutex_iothread_locked() may be used from coroutines. Standard __thread variables cannot be used by coroutines. Use the coroutine TLS macros instead. Signed-off-by: Stefan Hajnoczi --- softmmu/cpus.c | 8 1 file changed, 4 insertions(+),

Re: [PATCH v4 1/4] tls: add macros for coroutine-safe TLS variables

2022-02-21 Thread Peter Maydell
On Mon, 21 Feb 2022 at 14:29, Stefan Hajnoczi wrote: > > Compiler optimizations can cache TLS values across coroutine yield > points, resulting in stale values from the previous thread when a > coroutine is re-entered by a new thread. > > Serge Guelton developed an __attribute__((noinline))

Re: [PATCH v1] aio-posix: fix build failure io_uring 2.2

2022-02-21 Thread Stefan Hajnoczi
On Fri, Feb 18, 2022 at 12:16:27AM +0800, Haiyue Wang wrote: > The io_uring fixed "Don't truncate addr fields to 32-bit on 32-bit": > https://git.kernel.dk/cgit/liburing/commit/?id=d84c29b19ed0b13619cff40141bb1fc3615b > > This leads to build failure: > ../util/fdmon-io_uring.c: In function

[PATCH v4 3/4] rcu: use coroutine TLS macros

2022-02-21 Thread Stefan Hajnoczi
RCU may be used from coroutines. Standard __thread variables cannot be used by coroutines. Use the coroutine TLS macros instead. Signed-off-by: Stefan Hajnoczi --- include/qemu/rcu.h | 7 --- tests/unit/rcutorture.c| 10 +- tests/unit/test-rcu-list.c | 4 ++--

[PATCH v4 2/4] util/async: replace __thread with QEMU TLS macros

2022-02-21 Thread Stefan Hajnoczi
QEMU TLS macros must be used to make TLS variables safe with coroutines. Signed-off-by: Stefan Hajnoczi --- util/async.c | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/util/async.c b/util/async.c index 08d25feef5..2ea1172f3e 100644 --- a/util/async.c +++

[PATCH v4 0/4] tls: add macros for coroutine-safe TLS variables

2022-02-21 Thread Stefan Hajnoczi
v4: - Dropped '[RFC]'. - Dropped inline asm for now. -fPIC versions of the code are missing and I hit several issues including a clang LTO bug where thread local variables are incorrectly discarded because inline asm is not analyzed to find symbol dependencies (Serge Guelton is aware). -

[PATCH v4 4/4] cpus: use coroutine TLS macros for iothread_locked

2022-02-21 Thread Stefan Hajnoczi
qemu_mutex_iothread_locked() may be used from coroutines. Standard __thread variables cannot be used by coroutines. Use the coroutine TLS macros instead. Signed-off-by: Stefan Hajnoczi --- softmmu/cpus.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/softmmu/cpus.c

[PATCH v4 1/4] tls: add macros for coroutine-safe TLS variables

2022-02-21 Thread Stefan Hajnoczi
Compiler optimizations can cache TLS values across coroutine yield points, resulting in stale values from the previous thread when a coroutine is re-entered by a new thread. Serge Guelton developed an __attribute__((noinline)) wrapper and tested it with clang and gcc. I formatted his idea

[PATCH] iotests: Write test output to TEST_DIR

2022-02-21 Thread Hanna Reitz
Drop the use of OUTPUT_DIR (test/qemu-iotests under the build directory), and instead write test output files (.out.bad, .notrun, and .casenotrun) to TEST_DIR. With this, the same test can be run concurrently without the separate instances interfering, because they will need separate TEST_DIRs

Re: [PATCH v2 2/2] hw/ide: add ich6 ide controller device emulation

2022-02-21 Thread Gerd Hoffmann
Hi, > > ICH6 and ICH7 IDE controllers are quite the same as far as I know. I > > could change it, but then one could argue that the name ich6-ide seems > > like "ich9-ide", so not sure if we can really go on this path. > > I think we don't actually have ich9-ide, we only have piix3, piix4 and

Re: qemu iotest 161 and make check

2022-02-21 Thread Christian Borntraeger
Am 10.02.22 um 18:44 schrieb Vladimir Sementsov-Ogievskiy: 10.02.2022 20:13, Thomas Huth wrote: On 10/02/2022 15.51, Christian Borntraeger wrote: Am 10.02.22 um 15:47 schrieb Vladimir Sementsov-Ogievskiy: 10.02.2022 10:57, Christian Borntraeger wrote: Hello, I do see spurious failures

Re: [PATCH v2] ide: Increment BB in-flight counter for TRIM BH

2022-02-21 Thread Hanna Reitz
On 17.02.22 22:02, John Snow wrote: On Tue, Feb 15, 2022 at 12:14 PM Hanna Reitz wrote: Ping (I can take it too, if you’d like, John, but you’re listed as the only maintainer for hw/ide, so... Just say the word, though!) Sorry, I sent you a mail off-list at the time where I said you were