<feed xmlns='http://www.w3.org/2005/Atom'>
<title>qemu/hw/block/dataplane, branch master</title>
<subtitle>QEMU development tree</subtitle>
<id>https://git.zx2c4.com/qemu/atom/hw/block/dataplane?h=master</id>
<link rel='self' href='https://git.zx2c4.com/qemu/atom/hw/block/dataplane?h=master'/>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/qemu/'/>
<updated>2024-01-26T10:16:58Z</updated>
<entry>
<title>virtio-blk: move dataplane code into virtio-blk.c</title>
<updated>2024-01-26T10:16:58Z</updated>
<author>
<name>Stefan Hajnoczi</name>
<email>stefanha@redhat.com</email>
</author>
<published>2024-01-19T13:57:43Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/qemu/commit/?id=3bcc17f06526754fd675dcf601414442044fa0b6'/>
<id>urn:sha1:3bcc17f06526754fd675dcf601414442044fa0b6</id>
<content type='text'>
The dataplane code used to be significantly different from the
non-dataplane code and therefore had a separate source file.

Over time the difference has gotten smaller because the I/O code paths
were unified. Nowadays the distinction between the VirtIOBlock and
VirtIOBlockDataPlane structs is more of an inconvenience that hinders
code simplification.

Move hw/block/dataplane/virtio-blk.c into hw/block/virtio-blk.c, merging
VirtIOBlockDataPlane's fields into VirtIOBlock.

hw/block/virtio-blk.c used VirtIOBlock-&gt;dataplane to check if
virtio_blk_data_plane_create() was successful. This is not necessary
because -&gt;dataplane_started and -&gt;dataplane_disabled can be used
instead. This patch makes those changes in order to drop
VirtIOBlock-&gt;dataplane.

Signed-off-by: Stefan Hajnoczi &lt;stefanha@redhat.com&gt;
Message-ID: &lt;20240119135748.270944-2-stefanha@redhat.com&gt;
Reviewed-by: Kevin Wolf &lt;kwolf@redhat.com&gt;
Signed-off-by: Kevin Wolf &lt;kwolf@redhat.com&gt;
</content>
</entry>
<entry>
<title>Rename "QEMU global mutex" to "BQL" in comments and docs</title>
<updated>2024-01-08T15:45:43Z</updated>
<author>
<name>Stefan Hajnoczi</name>
<email>stefanha@redhat.com</email>
</author>
<published>2024-01-02T15:35:29Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/qemu/commit/?id=0b2675c473f68f13bc5ca1dd1c43ce421542e7b8'/>
<id>urn:sha1:0b2675c473f68f13bc5ca1dd1c43ce421542e7b8</id>
<content type='text'>
The term "QEMU global mutex" is identical to the more widely used Big
QEMU Lock ("BQL"). Update the code comments and documentation to use
"BQL" instead of "QEMU global mutex".

Signed-off-by: Stefan Hajnoczi &lt;stefanha@redhat.com&gt;
Acked-by: Markus Armbruster &lt;armbru@redhat.com&gt;
Reviewed-by: Philippe Mathieu-Daudé &lt;philmd@linaro.org&gt;
Reviewed-by: Paul Durrant &lt;paul@xen.org&gt;
Reviewed-by: Akihiko Odaki &lt;akihiko.odaki@daynix.com&gt;
Reviewed-by: Cédric Le Goater &lt;clg@kaod.org&gt;
Reviewed-by: Harsh Prateek Bora &lt;harshpb@linux.ibm.com&gt;
Message-id: 20240102153529.486531-6-stefanha@redhat.com
Signed-off-by: Stefan Hajnoczi &lt;stefanha@redhat.com&gt;
</content>
</entry>
<entry>
<title>virtio-blk: Fix potential nullpointer read access in virtio_blk_data_plane_destroy</title>
<updated>2023-12-25T08:01:01Z</updated>
<author>
<name>Stefan Weil via</name>
<email>qemu-trivial@nongnu.org</email>
</author>
<published>2023-12-24T11:43:14Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/qemu/commit/?id=d819fc9516a4ec71e37a6c9edfcd285b7f98c2dc'/>
<id>urn:sha1:d819fc9516a4ec71e37a6c9edfcd285b7f98c2dc</id>
<content type='text'>
Fixes: CID 1532828
Fixes: b6948ab01d ("virtio-blk: add iothread-vq-mapping parameter")
Signed-off-by: Stefan Weil &lt;sw@weilnetz.de&gt;
Signed-off-by: Michael Tokarev &lt;mjt@tls.msk.ru&gt;
</content>
</entry>
<entry>
<title>virtio-blk: add iothread-vq-mapping parameter</title>
<updated>2023-12-21T21:49:28Z</updated>
<author>
<name>Stefan Hajnoczi</name>
<email>stefanha@redhat.com</email>
</author>
<published>2023-12-20T13:47:55Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/qemu/commit/?id=b6948ab01df068bef591868c22d1f873d2d05cde'/>
<id>urn:sha1:b6948ab01df068bef591868c22d1f873d2d05cde</id>
<content type='text'>
Add the iothread-vq-mapping parameter to assign virtqueues to IOThreads.
Store the vq:AioContext mapping in the new struct
VirtIOBlockDataPlane-&gt;vq_aio_context[] field and refactor the code to
use the per-vq AioContext instead of the BlockDriverState's AioContext.

Reimplement --device virtio-blk-pci,iothread= and non-IOThread mode by
assigning all virtqueues to the IOThread and main loop's AioContext in
vq_aio_context[], respectively.

The comment in struct VirtIOBlockDataPlane about EventNotifiers is
stale. Remove it.

Signed-off-by: Stefan Hajnoczi &lt;stefanha@redhat.com&gt;
Message-ID: &lt;20231220134755.814917-5-stefanha@redhat.com&gt;
Signed-off-by: Kevin Wolf &lt;kwolf@redhat.com&gt;
</content>
</entry>
<entry>
<title>block: remove AioContext locking</title>
<updated>2023-12-21T21:49:27Z</updated>
<author>
<name>Stefan Hajnoczi</name>
<email>stefanha@redhat.com</email>
</author>
<published>2023-12-05T18:20:03Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/qemu/commit/?id=b49f4755c7fa35ea6e17e5b52c1cdaef6b4aa21c'/>
<id>urn:sha1:b49f4755c7fa35ea6e17e5b52c1cdaef6b4aa21c</id>
<content type='text'>
This is the big patch that removes
aio_context_acquire()/aio_context_release() from the block layer and
affected block layer users.

There isn't a clean way to split this patch and the reviewers are likely
the same group of people, so I decided to do it in one patch.

Signed-off-by: Stefan Hajnoczi &lt;stefanha@redhat.com&gt;
Reviewed-by: Eric Blake &lt;eblake@redhat.com&gt;
Reviewed-by: Kevin Wolf &lt;kwolf@redhat.com&gt;
Reviewed-by: Paul Durrant &lt;paul@xen.org&gt;
Message-ID: &lt;20231205182011.1976568-7-stefanha@redhat.com&gt;
Signed-off-by: Kevin Wolf &lt;kwolf@redhat.com&gt;
</content>
</entry>
<entry>
<title>virtio-blk: remove batch notification BH</title>
<updated>2023-10-31T14:42:17Z</updated>
<author>
<name>Stefan Hajnoczi</name>
<email>stefanha@redhat.com</email>
</author>
<published>2023-09-13T20:00:45Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/qemu/commit/?id=073458da5619c8914a91440ef243d1e2b888c1b7'/>
<id>urn:sha1:073458da5619c8914a91440ef243d1e2b888c1b7</id>
<content type='text'>
There is a batching mechanism for virtio-blk Used Buffer Notifications
that is no longer needed because the previous commit added batching to
virtio_notify_irqfd().

Note that this mechanism was rarely used in practice because it is only
enabled when EVENT_IDX is not negotiated by the driver. Modern drivers
enable EVENT_IDX.

Reviewed-by: Eric Blake &lt;eblake@redhat.com&gt;
Signed-off-by: Stefan Hajnoczi &lt;stefanha@redhat.com&gt;
Message-ID: &lt;20230913200045.1024233-5-stefanha@redhat.com&gt;
Reviewed-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
Reviewed-by: Kevin Wolf &lt;kwolf@redhat.com&gt;
Signed-off-by: Kevin Wolf &lt;kwolf@redhat.com&gt;
</content>
</entry>
<entry>
<title>util/defer-call: move defer_call() to util/</title>
<updated>2023-10-31T14:41:42Z</updated>
<author>
<name>Stefan Hajnoczi</name>
<email>stefanha@redhat.com</email>
</author>
<published>2023-09-13T20:00:43Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/qemu/commit/?id=433fcea40c31ff355f84da22a46977c2a1b596c3'/>
<id>urn:sha1:433fcea40c31ff355f84da22a46977c2a1b596c3</id>
<content type='text'>
The networking subsystem may wish to use defer_call(), so move the code
to util/ where it can be reused.

As a reminder of what defer_call() does:

This API defers a function call within a defer_call_begin()/defer_call_end()
section, allowing multiple calls to batch up. This is a performance
optimization that is used in the block layer to submit several I/O requests
at once instead of individually:

  defer_call_begin(); &lt;-- start of section
  ...
  defer_call(my_func, my_obj); &lt;-- deferred my_func(my_obj) call
  defer_call(my_func, my_obj); &lt;-- another
  defer_call(my_func, my_obj); &lt;-- another
  ...
  defer_call_end(); &lt;-- end of section, my_func(my_obj) is called once

Suggested-by: Ilya Maximets &lt;i.maximets@ovn.org&gt;
Reviewed-by: Philippe Mathieu-Daudé &lt;philmd@linaro.org&gt;
Signed-off-by: Stefan Hajnoczi &lt;stefanha@redhat.com&gt;
Message-ID: &lt;20230913200045.1024233-3-stefanha@redhat.com&gt;
Reviewed-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
Reviewed-by: Kevin Wolf &lt;kwolf@redhat.com&gt;
Signed-off-by: Kevin Wolf &lt;kwolf@redhat.com&gt;
</content>
</entry>
<entry>
<title>block: rename blk_io_plug_call() API to defer_call()</title>
<updated>2023-10-31T14:41:24Z</updated>
<author>
<name>Stefan Hajnoczi</name>
<email>stefanha@redhat.com</email>
</author>
<published>2023-09-13T20:00:42Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/qemu/commit/?id=ccee48aa736b97f0ce4ab04ad41815f0e575d526'/>
<id>urn:sha1:ccee48aa736b97f0ce4ab04ad41815f0e575d526</id>
<content type='text'>
Prepare to move the blk_io_plug_call() API out of the block layer so
that other subsystems call use this deferred call mechanism. Rename it
to defer_call() but leave the code in block/plug.c.

The next commit will move the code out of the block layer.

Suggested-by: Ilya Maximets &lt;i.maximets@ovn.org&gt;
Reviewed-by: Philippe Mathieu-Daudé &lt;philmd@linaro.org&gt;
Reviewed-by: Paul Durrant &lt;paul@xen.org&gt;
Signed-off-by: Stefan Hajnoczi &lt;stefanha@redhat.com&gt;
Message-ID: &lt;20230913200045.1024233-2-stefanha@redhat.com&gt;
Reviewed-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
Reviewed-by: Kevin Wolf &lt;kwolf@redhat.com&gt;
Signed-off-by: Kevin Wolf &lt;kwolf@redhat.com&gt;
</content>
</entry>
<entry>
<title>virtio-blk: fix host notifier issues during dataplane start/stop</title>
<updated>2023-07-12T19:20:32Z</updated>
<author>
<name>Stefan Hajnoczi</name>
<email>stefanha@redhat.com</email>
</author>
<published>2023-07-04T15:15:27Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/qemu/commit/?id=75dcb4d790bbe5327169fd72b185960ca58e2fa6'/>
<id>urn:sha1:75dcb4d790bbe5327169fd72b185960ca58e2fa6</id>
<content type='text'>
The main loop thread can consume 100% CPU when using --device
virtio-blk-pci,iothread=&lt;iothread&gt;. ppoll() constantly returns but
reading virtqueue host notifiers fails with EAGAIN. The file descriptors
are stale and remain registered with the AioContext because of bugs in
the virtio-blk dataplane start/stop code.

The problem is that the dataplane start/stop code involves drain
operations, which call virtio_blk_drained_begin() and
virtio_blk_drained_end() at points where the host notifier is not
operational:
- In virtio_blk_data_plane_start(), blk_set_aio_context() drains after
  vblk-&gt;dataplane_started has been set to true but the host notifier has
  not been attached yet.
- In virtio_blk_data_plane_stop(), blk_drain() and blk_set_aio_context()
  drain after the host notifier has already been detached but with
  vblk-&gt;dataplane_started still set to true.

I would like to simplify -&gt;ioeventfd_start/stop() to avoid interactions
with drain entirely, but couldn't find a way to do that. Instead, this
patch accepts the fragile nature of the code and reorders it so that
vblk-&gt;dataplane_started is false during drain operations. This way the
virtio_blk_drained_begin() and virtio_blk_drained_end() calls don't
touch the host notifier. The result is that
virtio_blk_data_plane_start() and virtio_blk_data_plane_stop() have
complete control over the host notifier and stale file descriptors are
no longer left in the AioContext.

This patch fixes the 100% CPU consumption in the main loop thread and
correctly moves host notifier processing to the IOThread.

Fixes: 1665d9326fd2 ("virtio-blk: implement BlockDevOps-&gt;drained_begin()")
Reported-by: Lukáš Doktor &lt;ldoktor@redhat.com&gt;
Signed-off-by: Stefan Hajnoczi &lt;stefanha@redhat.com&gt;
Tested-by: Lukas Doktor &lt;ldoktor@redhat.com&gt;
Message-id: 20230704151527.193586-1-stefanha@redhat.com
Signed-off-by: Stefan Hajnoczi &lt;stefanha@redhat.com&gt;
</content>
</entry>
<entry>
<title>hw/virtio: Build various target-agnostic objects just once</title>
<updated>2023-06-23T06:54:44Z</updated>
<author>
<name>Philippe Mathieu-Daudé</name>
<email>philmd@linaro.org</email>
</author>
<published>2023-05-24T09:37:44Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/qemu/commit/?id=7a0903f7ea8ac7e5b3191c9a2cfd1751b153f48c'/>
<id>urn:sha1:7a0903f7ea8ac7e5b3191c9a2cfd1751b153f48c</id>
<content type='text'>
The previous commit remove the unnecessary "virtio-access.h"
header. These files no longer have target-specific dependency.
Move them to the generic 'softmmu_ss' source set.

Signed-off-by: Philippe Mathieu-Daudé &lt;philmd@linaro.org&gt;
Reviewed-by: Richard Henderson &lt;richard.henderson@linaro.org&gt;
Reviewed-by: Thomas Huth &lt;thuth@redhat.com&gt;
Message-Id: &lt;20230524093744.88442-11-philmd@linaro.org&gt;
Reviewed-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
</content>
</entry>
</feed>
