<feed xmlns='http://www.w3.org/2005/Atom'>
<title>bwlp/qemu.git/block/nvme.c, branch spice_video_codecs</title>
<subtitle>Experimental fork of QEMU with video encoding patches</subtitle>
<id>https://git.openslx.org/bwlp/qemu.git/atom/block/nvme.c?h=spice_video_codecs</id>
<link rel='self' href='https://git.openslx.org/bwlp/qemu.git/atom/block/nvme.c?h=spice_video_codecs'/>
<link rel='alternate' type='text/html' href='https://git.openslx.org/bwlp/qemu.git/'/>
<updated>2022-10-26T18:56:42+00:00</updated>
<entry>
<title>block: return errors from bdrv_register_buf()</title>
<updated>2022-10-26T18:56:42+00:00</updated>
<author>
<name>Stefan Hajnoczi</name>
</author>
<published>2022-10-13T18:59:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.openslx.org/bwlp/qemu.git/commit/?id=f4ec04bae9577eaa55ac35f3971dc3086a4a9192'/>
<id>urn:sha1:f4ec04bae9577eaa55ac35f3971dc3086a4a9192</id>
<content type='text'>
Registering an I/O buffer is only a performance optimization hint but it
is still necessary to return errors when it fails.

Later patches will need to detect errors when registering buffers but an
immediate advantage is that error_report() calls are no longer needed in
block driver .bdrv_register_buf() functions.

Signed-off-by: Stefan Hajnoczi &lt;stefanha@redhat.com&gt;
Message-id: 20221013185908.1297568-8-stefanha@redhat.com
Signed-off-by: Stefan Hajnoczi &lt;stefanha@redhat.com&gt;
</content>
</entry>
<entry>
<title>block: pass size to bdrv_unregister_buf()</title>
<updated>2022-10-26T18:56:42+00:00</updated>
<author>
<name>Stefan Hajnoczi</name>
</author>
<published>2022-10-13T18:58:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.openslx.org/bwlp/qemu.git/commit/?id=4f384011c5a37f80dc6cadefffac61ffb1c3aa1e'/>
<id>urn:sha1:4f384011c5a37f80dc6cadefffac61ffb1c3aa1e</id>
<content type='text'>
The only implementor of bdrv_register_buf() is block/nvme.c, where the
size is not needed when unregistering a buffer. This is because
util/vfio-helpers.c can look up mappings by address.

Future block drivers that implement bdrv_register_buf() may not be able
to do their job given only the buffer address. Add a size argument to
bdrv_unregister_buf().

Also document the assumptions about
bdrv_register_buf()/bdrv_unregister_buf() calls. The same &lt;host, size&gt;
values that were given to bdrv_register_buf() must be given to
bdrv_unregister_buf().

gcc 11.2.1 emits a spurious warning that img_bench()'s buf_size local
variable might be uninitialized, so it's necessary to silence the
compiler.

Signed-off-by: Stefan Hajnoczi &lt;stefanha@redhat.com&gt;
Reviewed-by: Stefano Garzarella &lt;sgarzare@redhat.com&gt;
Message-id: 20221013185908.1297568-5-stefanha@redhat.com
Signed-off-by: Stefan Hajnoczi &lt;stefanha@redhat.com&gt;
</content>
</entry>
<entry>
<title>nvme: add missing coroutine_fn annotations</title>
<updated>2022-10-07T10:11:40+00:00</updated>
<author>
<name>Paolo Bonzini</name>
</author>
<published>2022-09-22T08:49:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.openslx.org/bwlp/qemu.git/commit/?id=711b12e7c35fc0c8970ac9e8a8dca72e18458c09'/>
<id>urn:sha1:711b12e7c35fc0c8970ac9e8a8dca72e18458c09</id>
<content type='text'>
Callers of coroutine_fn must be coroutine_fn themselves, or the call
must be within "if (qemu_in_coroutine())".  Apply coroutine_fn to
functions where this holds.

Reviewed-by: Alberto Faria &lt;afaria@redhat.com&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
Message-Id: &lt;20220922084924.201610-13-pbonzini@redhat.com&gt;
[kwolf: Fixed up coding style]
Reviewed-by: Kevin Wolf &lt;kwolf@redhat.com&gt;
Signed-off-by: Kevin Wolf &lt;kwolf@redhat.com&gt;
</content>
</entry>
<entry>
<title>block/nvme: separate nvme_get_free_req cases for coroutine/non-coroutine context</title>
<updated>2022-10-07T10:11:40+00:00</updated>
<author>
<name>Paolo Bonzini</name>
</author>
<published>2022-09-22T08:48:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.openslx.org/bwlp/qemu.git/commit/?id=82c45371ba698ff63e9d3d4792a34593f73e54d8'/>
<id>urn:sha1:82c45371ba698ff63e9d3d4792a34593f73e54d8</id>
<content type='text'>
nvme_get_free_req has very difference semantics when called in
coroutine context (where it waits) and in non-coroutine context
(where it doesn't).  Split the two cases to make it clear what
is being requested.

Cc: qemu-block@nongnu.org
Reviewed-by: Alberto Faria &lt;afaria@redhat.com&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
Message-Id: &lt;20220922084924.201610-2-pbonzini@redhat.com&gt;
[kwolf: Fixed up coding style]
Reviewed-by: Kevin Wolf &lt;kwolf@redhat.com&gt;
Signed-off-by: Kevin Wolf &lt;kwolf@redhat.com&gt;
</content>
</entry>
<entry>
<title>Replace qemu_real_host_page variables with inlined functions</title>
<updated>2022-04-06T08:50:38+00:00</updated>
<author>
<name>Marc-André Lureau</name>
</author>
<published>2022-03-23T15:57:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.openslx.org/bwlp/qemu.git/commit/?id=8e3b0cbb7212a1e5707ed2d4c26b4e3d2483768d'/>
<id>urn:sha1:8e3b0cbb7212a1e5707ed2d4c26b4e3d2483768d</id>
<content type='text'>
Replace the global variables with inlined helper functions. getpagesize() is very
likely annotated with a "const" function attribute (at least with glibc), and thus
optimization should apply even better.

This avoids the need for a constructor initialization too.

Signed-off-by: Marc-André Lureau &lt;marcandre.lureau@redhat.com&gt;
Message-Id: &lt;20220323155743.1585078-12-marcandre.lureau@redhat.com&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
</content>
</entry>
<entry>
<title>osdep: Move memalign-related functions to their own header</title>
<updated>2022-03-07T13:16:49+00:00</updated>
<author>
<name>Peter Maydell</name>
</author>
<published>2022-02-26T18:07:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.openslx.org/bwlp/qemu.git/commit/?id=5df022cf2e5e24910a7d579d5780ae78bc24f247'/>
<id>urn:sha1:5df022cf2e5e24910a7d579d5780ae78bc24f247</id>
<content type='text'>
Move the various memalign-related functions out of osdep.h and into
their own header, which we include only where they are used.
While we're doing this, add some brief documentation comments.

Signed-off-by: Peter Maydell &lt;peter.maydell@linaro.org&gt;
Reviewed-by: Richard Henderson &lt;richard.henderson@linaro.org&gt;
Reviewed-by: Philippe Mathieu-Daudé &lt;f4bug@amsat.org&gt;
Message-id: 20220226180723.1706285-10-peter.maydell@linaro.org
</content>
</entry>
<entry>
<title>aio-posix: split poll check from ready handler</title>
<updated>2022-01-12T17:09:39+00:00</updated>
<author>
<name>Stefan Hajnoczi</name>
</author>
<published>2021-12-07T13:23:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.openslx.org/bwlp/qemu.git/commit/?id=826cc32423db2a99d184dbf4f507c737d7e7a4ae'/>
<id>urn:sha1:826cc32423db2a99d184dbf4f507c737d7e7a4ae</id>
<content type='text'>
Adaptive polling measures the execution time of the polling check plus
handlers called when a polled event becomes ready. Handlers can take a
significant amount of time, making it look like polling was running for
a long time when in fact the event handler was running for a long time.

For example, on Linux the io_submit(2) syscall invoked when a virtio-blk
device's virtqueue becomes ready can take 10s of microseconds. This
can exceed the default polling interval (32 microseconds) and cause
adaptive polling to stop polling.

By excluding the handler's execution time from the polling check we make
the adaptive polling calculation more accurate. As a result, the event
loop now stays in polling mode where previously it would have fallen
back to file descriptor monitoring.

The following data was collected with virtio-blk num-queues=2
event_idx=off using an IOThread. Before:

168k IOPS, IOThread syscalls:

  9837.115 ( 0.020 ms): IO iothread1/620155 io_submit(ctx_id: 140512552468480, nr: 16, iocbpp: 0x7fcb9f937db0)    = 16
  9837.158 ( 0.002 ms): IO iothread1/620155 write(fd: 103, buf: 0x556a2ef71b88, count: 8)                         = 8
  9837.161 ( 0.001 ms): IO iothread1/620155 write(fd: 104, buf: 0x556a2ef71b88, count: 8)                         = 8
  9837.163 ( 0.001 ms): IO iothread1/620155 ppoll(ufds: 0x7fcb90002800, nfds: 4, tsp: 0x7fcb9f1342d0, sigsetsize: 8) = 3
  9837.164 ( 0.001 ms): IO iothread1/620155 read(fd: 107, buf: 0x7fcb9f939cc0, count: 512)                        = 8
  9837.174 ( 0.001 ms): IO iothread1/620155 read(fd: 105, buf: 0x7fcb9f939cc0, count: 512)                        = 8
  9837.176 ( 0.001 ms): IO iothread1/620155 read(fd: 106, buf: 0x7fcb9f939cc0, count: 512)                        = 8
  9837.209 ( 0.035 ms): IO iothread1/620155 io_submit(ctx_id: 140512552468480, nr: 32, iocbpp: 0x7fca7d0cebe0)    = 32

174k IOPS (+3.6%), IOThread syscalls:

  9809.566 ( 0.036 ms): IO iothread1/623061 io_submit(ctx_id: 140539805028352, nr: 32, iocbpp: 0x7fd0cdd62be0)    = 32
  9809.625 ( 0.001 ms): IO iothread1/623061 write(fd: 103, buf: 0x5647cfba5f58, count: 8)                         = 8
  9809.627 ( 0.002 ms): IO iothread1/623061 write(fd: 104, buf: 0x5647cfba5f58, count: 8)                         = 8
  9809.663 ( 0.036 ms): IO iothread1/623061 io_submit(ctx_id: 140539805028352, nr: 32, iocbpp: 0x7fd0d0388b50)    = 32

Notice that ppoll(2) and eventfd read(2) syscalls are eliminated because
the IOThread stays in polling mode instead of falling back to file
descriptor monitoring.

As usual, polling is not implemented on Windows so this patch ignores
the new io_poll_read() callback in aio-win32.c.

Signed-off-by: Stefan Hajnoczi &lt;stefanha@redhat.com&gt;
Reviewed-by: Stefano Garzarella &lt;sgarzare@redhat.com&gt;
Message-id: 20211207132336.36627-2-stefanha@redhat.com

[Fixed up aio_set_event_notifier() calls in
tests/unit/test-fdmon-epoll.c added after this series was queued.
--Stefan]

Signed-off-by: Stefan Hajnoczi &lt;stefanha@redhat.com&gt;
</content>
</entry>
<entry>
<title>block/nvme: fix infinite loop in nvme_free_req_queue_cb()</title>
<updated>2021-12-09T09:19:49+00:00</updated>
<author>
<name>Stefan Hajnoczi</name>
</author>
<published>2021-12-08T15:22:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.openslx.org/bwlp/qemu.git/commit/?id=cf4fbc3030c974fff726756a7ceef8386cdf500b'/>
<id>urn:sha1:cf4fbc3030c974fff726756a7ceef8386cdf500b</id>
<content type='text'>
When the request free list is exhausted the coroutine waits on
q-&gt;free_req_queue for the next free request. Whenever a request is
completed a BH is scheduled to invoke nvme_free_req_queue_cb() and wake
up waiting coroutines.

1. nvme_get_free_req() waits for a free request:

    while (q-&gt;free_req_head == -1) {
        ...
            trace_nvme_free_req_queue_wait(q-&gt;s, q-&gt;index);
            qemu_co_queue_wait(&amp;q-&gt;free_req_queue, &amp;q-&gt;lock);
        ...
    }

2. nvme_free_req_queue_cb() wakes up the coroutine:

    while (qemu_co_enter_next(&amp;q-&gt;free_req_queue, &amp;q-&gt;lock)) {
       ^--- infinite loop when free_req_head == -1
    }

nvme_free_req_queue_cb() and the coroutine form an infinite loop when
q-&gt;free_req_head == -1. Fix this by checking q-&gt;free_req_head in
nvme_free_req_queue_cb(). If the free request list is exhausted, don't
wake waiting coroutines. Eventually an in-flight request will complete
and the BH will be scheduled again, guaranteeing forward progress.

Signed-off-by: Stefan Hajnoczi &lt;stefanha@redhat.com&gt;
Reviewed-by: Philippe Mathieu-Daudé &lt;philmd@redhat.com&gt;
Message-id: 20211208152246.244585-1-stefanha@redhat.com
Signed-off-by: Stefan Hajnoczi &lt;stefanha@redhat.com&gt;
</content>
</entry>
<entry>
<title>block/nvme: Extract nvme_free_queue() from nvme_free_queue_pair()</title>
<updated>2021-11-02T14:49:13+00:00</updated>
<author>
<name>Philippe Mathieu-Daudé</name>
</author>
<published>2021-10-06T16:49:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.openslx.org/bwlp/qemu.git/commit/?id=a8951438946d72d74c9bdbdb38fce95aa2973a88'/>
<id>urn:sha1:a8951438946d72d74c9bdbdb38fce95aa2973a88</id>
<content type='text'>
Instead of duplicating code, extract the common helper to free
a single queue.

Signed-off-by: Philippe Mathieu-Daudé &lt;philmd@redhat.com&gt;
Message-Id: &lt;20211006164931.172349-4-philmd@redhat.com&gt;
Reviewed-by: Stefan Hajnoczi &lt;stefanha@redhat.com&gt;
Signed-off-by: Kevin Wolf &lt;kwolf@redhat.com&gt;
</content>
</entry>
<entry>
<title>block/nvme: Display CQ/SQ pointer in nvme_free_queue_pair()</title>
<updated>2021-11-02T14:49:12+00:00</updated>
<author>
<name>Philippe Mathieu-Daudé</name>
</author>
<published>2021-10-06T16:49:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.openslx.org/bwlp/qemu.git/commit/?id=53cedeaaee9d585bd07eb921fa5557c64531f69b'/>
<id>urn:sha1:53cedeaaee9d585bd07eb921fa5557c64531f69b</id>
<content type='text'>
For debugging purpose it is helpful to know the CQ/SQ pointers.
We already have a trace event in nvme_free_queue_pair(), extend
it to report these pointer addresses.

Signed-off-by: Philippe Mathieu-Daudé &lt;philmd@redhat.com&gt;
Message-Id: &lt;20211006164931.172349-3-philmd@redhat.com&gt;
Reviewed-by: Stefan Hajnoczi &lt;stefanha@redhat.com&gt;
Signed-off-by: Kevin Wolf &lt;kwolf@redhat.com&gt;
</content>
</entry>
</feed>
