<feed xmlns='http://www.w3.org/2005/Atom'>
<title>bwlp/qemu.git/hw/virtio, branch spice_video_codecs</title>
<subtitle>Experimental fork of QEMU with video encoding patches</subtitle>
<id>https://git.openslx.org/bwlp/qemu.git/atom/hw/virtio?h=spice_video_codecs</id>
<link rel='self' href='https://git.openslx.org/bwlp/qemu.git/atom/hw/virtio?h=spice_video_codecs'/>
<link rel='alternate' type='text/html' href='https://git.openslx.org/bwlp/qemu.git/'/>
<updated>2022-12-01T07:30:13+00:00</updated>
<entry>
<title>hw/virtio: generalise CHR_EVENT_CLOSED handling</title>
<updated>2022-12-01T07:30:13+00:00</updated>
<author>
<name>Alex Bennée</name>
</author>
<published>2022-11-30T11:24:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.openslx.org/bwlp/qemu.git/commit/?id=71e076a07dc195129fe25d90d4b276be3b2f12d8'/>
<id>urn:sha1:71e076a07dc195129fe25d90d4b276be3b2f12d8</id>
<content type='text'>
..and use for both virtio-user-blk and virtio-user-gpio. This avoids
the circular close by deferring shutdown due to disconnection until a
later point. virtio-user-blk already had this mechanism in place so
generalise it as a vhost-user helper function and use for both blk and
gpio devices.

While we are at it we also fix up vhost-user-gpio to re-establish the
event handler after close down so we can reconnect later.

Signed-off-by: Alex Bennée &lt;alex.bennee@linaro.org&gt;
Reviewed-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
Reviewed-by: Raphael Norwitz &lt;raphael.norwitz@nutanix.com&gt;
Message-Id: &lt;20221130112439.2527228-5-alex.bennee@linaro.org&gt;
Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
</content>
</entry>
<entry>
<title>hw/virtio: add started_vu status field to vhost-user-gpio</title>
<updated>2022-12-01T07:30:09+00:00</updated>
<author>
<name>Alex Bennée</name>
</author>
<published>2022-11-30T11:24:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.openslx.org/bwlp/qemu.git/commit/?id=060f4a944072ecf37cece0f16a0609babfb679b8'/>
<id>urn:sha1:060f4a944072ecf37cece0f16a0609babfb679b8</id>
<content type='text'>
As per the fix to vhost-user-blk in f5b22d06fb (vhost: recheck dev
state in the vhost_migration_log routine) we really should track the
connection and starting separately.

Signed-off-by: Alex Bennée &lt;alex.bennee@linaro.org&gt;
Reviewed-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
Message-Id: &lt;20221130112439.2527228-4-alex.bennee@linaro.org&gt;
Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
</content>
</entry>
<entry>
<title>vhost: enable vrings in vhost_dev_start() for vhost-user devices</title>
<updated>2022-12-01T07:30:04+00:00</updated>
<author>
<name>Stefano Garzarella</name>
</author>
<published>2022-11-30T11:24:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.openslx.org/bwlp/qemu.git/commit/?id=4daa5054c599c8aec70f1264a01341a15921c145'/>
<id>urn:sha1:4daa5054c599c8aec70f1264a01341a15921c145</id>
<content type='text'>
Commit 02b61f38d3 ("hw/virtio: incorporate backend features in features")
properly negotiates VHOST_USER_F_PROTOCOL_FEATURES with the vhost-user
backend, but we forgot to enable vrings as specified in
docs/interop/vhost-user.rst:

    If ``VHOST_USER_F_PROTOCOL_FEATURES`` has not been negotiated, the
    ring starts directly in the enabled state.

    If ``VHOST_USER_F_PROTOCOL_FEATURES`` has been negotiated, the ring is
    initialized in a disabled state and is enabled by
    ``VHOST_USER_SET_VRING_ENABLE`` with parameter 1.

Some vhost-user front-ends already did this by calling
vhost_ops.vhost_set_vring_enable() directly:
- backends/cryptodev-vhost.c
- hw/net/virtio-net.c
- hw/virtio/vhost-user-gpio.c

But most didn't do that, so we would leave the vrings disabled and some
backends would not work. We observed this issue with the rust version of
virtiofsd [1], which uses the event loop [2] provided by the
vhost-user-backend crate where requests are not processed if vring is
not enabled.

Let's fix this issue by enabling the vrings in vhost_dev_start() for
vhost-user front-ends that don't already do this directly. Same thing
also in vhost_dev_stop() where we disable vrings.

[1] https://gitlab.com/virtio-fs/virtiofsd
[2] https://github.com/rust-vmm/vhost/blob/240fc2966/crates/vhost-user-backend/src/event_loop.rs#L217

Fixes: 02b61f38d3 ("hw/virtio: incorporate backend features in features")
Reported-by: German Maglione &lt;gmaglione@redhat.com&gt;
Tested-by: German Maglione &lt;gmaglione@redhat.com&gt;
Signed-off-by: Stefano Garzarella &lt;sgarzare@redhat.com&gt;
Acked-by: Raphael Norwitz &lt;raphael.norwitz@nutanix.com&gt;
Message-Id: &lt;20221123131630.52020-1-sgarzare@redhat.com&gt;
Signed-off-by: Alex Bennée &lt;alex.bennee@linaro.org&gt;
Reviewed-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
Message-Id: &lt;20221130112439.2527228-3-alex.bennee@linaro.org&gt;
Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
</content>
</entry>
<entry>
<title>virtio: disable error for out of spec queue-enable</title>
<updated>2022-11-22T10:19:00+00:00</updated>
<author>
<name>Michael S. Tsirkin</name>
</author>
<published>2022-11-21T20:01:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.openslx.org/bwlp/qemu.git/commit/?id=b7c61789e653086618d1825858a97b3d9891e822'/>
<id>urn:sha1:b7c61789e653086618d1825858a97b3d9891e822</id>
<content type='text'>
Virtio 1.0 is pretty clear that features have to be
negotiated before enabling VQs. Unfortunately Seabios
ignored this ever since gaining 1.0 support (UEFI is ok).
Comment the error out for now, and add a TODO.

Fixes: 3c37f8b8d1 ("virtio: introduce virtio_queue_enable()")
Cc: "Kangjie Xu" &lt;kangjie.xu@linux.alibaba.com&gt;
Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
Message-Id: &lt;20221121200339.362452-1-mst@redhat.com&gt;
</content>
</entry>
<entry>
<title>vhost: mask VIRTIO_F_RING_RESET for vhost and vhost-user devices</title>
<updated>2022-11-22T10:19:00+00:00</updated>
<author>
<name>Stefano Garzarella</name>
</author>
<published>2022-11-21T10:11:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.openslx.org/bwlp/qemu.git/commit/?id=562a7d23bf9a2f978cea799af40a1b2b0b4fc71b'/>
<id>urn:sha1:562a7d23bf9a2f978cea799af40a1b2b0b4fc71b</id>
<content type='text'>
Commit 69e1c14aa2 ("virtio: core: vq reset feature negotation support")
enabled VIRTIO_F_RING_RESET by default for all virtio devices.

This feature is not currently emulated by QEMU, so for vhost and
vhost-user devices we need to make sure it is supported by the offloaded
device emulation (in-kernel or in another process).
To do this we need to add VIRTIO_F_RING_RESET to the features bitmap
passed to vhost_get_features(). This way it will be masked if the device
does not support it.

This issue was initially discovered with vhost-vsock and vhost-user-vsock,
and then also tested with vhost-user-rng which confirmed the same issue.
They fail when sending features through VHOST_SET_FEATURES ioctl or
VHOST_USER_SET_FEATURES message, since VIRTIO_F_RING_RESET is negotiated
by the guest (Linux &gt;= v6.0), but not supported by the device.

Fixes: 69e1c14aa2 ("virtio: core: vq reset feature negotation support")
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1318
Signed-off-by: Stefano Garzarella &lt;sgarzare@redhat.com&gt;
Message-Id: &lt;20221121101101.29400-1-sgarzare@redhat.com&gt;
Reviewed-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
Reviewed-by: Stefan Hajnoczi &lt;stefanha@redhat.com&gt;
Acked-by: Raphael Norwitz &lt;raphael.norwitz@nutanix.com&gt;
Acked-by: Jason Wang &lt;jasowang@redhat.com&gt;
</content>
</entry>
<entry>
<title>hw/virtio: introduce virtio_device_should_start</title>
<updated>2022-11-07T19:08:18+00:00</updated>
<author>
<name>Alex Bennée</name>
</author>
<published>2022-11-07T12:14:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.openslx.org/bwlp/qemu.git/commit/?id=259d69c00b67c02a67f3bdbeeea71c2c0af76c35'/>
<id>urn:sha1:259d69c00b67c02a67f3bdbeeea71c2c0af76c35</id>
<content type='text'>
The previous fix to virtio_device_started revealed a problem in its
use by both the core and the device code. The core code should be able
to handle the device "starting" while the VM isn't running to handle
the restoration of migration state. To solve this duel use introduce a
new helper for use by the vhost-user backends who all use it to feed a
should_start variable.

We can also pick up a change vhost_user_blk_set_status while we are at
it which follows the same pattern.

Fixes: 9f6bcfd99f (hw/virtio: move vm_running check to virtio_device_started)
Signed-off-by: Alex Bennée &lt;alex.bennee@linaro.org&gt;
Cc: "Michael S. Tsirkin" &lt;mst@redhat.com&gt;
Message-Id: &lt;20221107121407.1010913-1-alex.bennee@linaro.org&gt;
</content>
</entry>
<entry>
<title>vhost-user: Support vhost_dev_start</title>
<updated>2022-11-07T19:08:17+00:00</updated>
<author>
<name>Yajun Wu</name>
</author>
<published>2022-10-17T06:44:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.openslx.org/bwlp/qemu.git/commit/?id=923b8921d210763359e96246a58658ac0db6c645'/>
<id>urn:sha1:923b8921d210763359e96246a58658ac0db6c645</id>
<content type='text'>
The motivation of adding vhost-user vhost_dev_start support is to
improve backend configuration speed and reduce live migration VM
downtime.

Today VQ configuration is issued one by one. For virtio net with
multi-queue support, backend needs to update RSS (Receive side
scaling) on every rx queue enable. Updating RSS is time-consuming
(typical time like 7ms).

Implement already defined vhost status and message in the vhost
specification [1].
(a) VHOST_USER_PROTOCOL_F_STATUS
(b) VHOST_USER_SET_STATUS
(c) VHOST_USER_GET_STATUS

Send message VHOST_USER_SET_STATUS with VIRTIO_CONFIG_S_DRIVER_OK for
device start and reset(0) for device stop.

On reception of the DRIVER_OK message, backend can apply the needed setting
only once (instead of incremental) and also utilize parallelism on enabling
queues.

This improves QEMU's live migration downtime with vhost user backend
implementation by great margin, specially for the large number of VQs of 64
from 800 msec to 250 msec.

[1] https://qemu-project.gitlab.io/qemu/interop/vhost-user.html

Signed-off-by: Yajun Wu &lt;yajunw@nvidia.com&gt;
Acked-by: Parav Pandit &lt;parav@nvidia.com&gt;
Message-Id: &lt;20221017064452.1226514-3-yajunw@nvidia.com&gt;
Reviewed-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
</content>
</entry>
<entry>
<title>msix: Assert that specified vector is in range</title>
<updated>2022-11-07T19:08:17+00:00</updated>
<author>
<name>Akihiko Odaki</name>
</author>
<published>2022-08-29T08:35:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.openslx.org/bwlp/qemu.git/commit/?id=15377f6e79cc6aa08dbafe82607e0bda13ca44b5'/>
<id>urn:sha1:15377f6e79cc6aa08dbafe82607e0bda13ca44b5</id>
<content type='text'>
There were several different ways to deal with the situation where the
vector specified for a msix function is out of bound:
- early return a function and keep progresssing
- propagate the error to the caller
- mark msix unusable
- assert it is in bound
- just ignore

An out-of-bound vector should not be specified if the device
implementation is correct so let msix functions always assert that the
specified vector is in range.

An exceptional case is virtio-pci, which allows the guest to configure
vectors. For virtio-pci, it is more appropriate to introduce its own
checks because it is sometimes too late to check the vector range in
msix functions.

Signed-off-by: Akihiko Odaki &lt;akihiko.odaki@daynix.com&gt;
Message-Id: &lt;20220829083524.143640-1-akihiko.odaki@daynix.com&gt;
Reviewed-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
Reviewed-by: Yuval Shaia &lt;yuval.shaia.ml@gmail.com&gt;
Signed-off-by: Akihiko Odaki &amp;lt;&lt;a href="mailto:akihiko.odaki@daynix.com" target="_blank"&gt;akihiko.odaki@daynix.com&lt;/a&gt;&amp;gt;&lt;br&gt;
</content>
</entry>
<entry>
<title>vhost-user: Fix out of order vring host notification handling</title>
<updated>2022-11-07T18:12:20+00:00</updated>
<author>
<name>Yajun Wu</name>
</author>
<published>2022-10-18T02:36:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.openslx.org/bwlp/qemu.git/commit/?id=bd437c960f2b071f7e8ba9bd34af8e2537cd6627'/>
<id>urn:sha1:bd437c960f2b071f7e8ba9bd34af8e2537cd6627</id>
<content type='text'>
vhost backend sends host notification for every VQ. If backend creates
VQs in parallel, the VHOST_USER_SLAVE_VRING_HOST_NOTIFIER_MSG may
arrive to QEMU in different order than incremental queue index order.

For example VQ 1's message arrive earlier than VQ 0's:
After alloc VhostUserHostNotifier for VQ 1. GPtrArray becomes

    [ nil, VQ1 pointer ]

After alloc VhostUserHostNotifier for VQ 0. GPtrArray becomes

    [ VQ0 pointer, nil, VQ1 pointer ]

This is wrong. fetch_notifier will return NULL for VQ 1 in
vhost_user_get_vring_base, causes host notifier miss removal(leak).

The fix is to remove current element from GPtrArray, make the right
position for element to insert.

Fixes: 503e355465 ("virtio/vhost-user: dynamically assign VhostUserHostNotifiers")
Signed-off-by: Yajun Wu &lt;yajunw@nvidia.com&gt;
Acked-by: Parav Pandit &lt;parav@nvidia.com&gt;

Message-Id: &lt;20221018023651.1359420-1-yajunw@nvidia.com&gt;
Reviewed-by: Alex Bennée &lt;alex.bennee@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>
<entry>
<title>virtio-rng-pci: Allow setting nvectors, so we can use MSI-X</title>
<updated>2022-11-07T18:12:20+00:00</updated>
<author>
<name>David Daney</name>
</author>
<published>2022-10-14T16:09:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.openslx.org/bwlp/qemu.git/commit/?id=9ea02e8f13068d5f902c4bce909de2997fd77e41'/>
<id>urn:sha1:9ea02e8f13068d5f902c4bce909de2997fd77e41</id>
<content type='text'>
Most other virtio-pci devices allow MSI-X, let's have it for rng too.

Signed-off-by: David Daney &lt;david.daney@fungible.com&gt;
Reviewed-by: Marcin Nowakowski &lt;marcin.nowakowski@fungible.com&gt;
Signed-off-by: Philippe Mathieu-Daudé &lt;philmd@fungible.com&gt;
Message-Id: &lt;20221014160947.66105-1-philmd@fungible.com&gt;
Reviewed-by: Stefan Hajnoczi &lt;stefanha@redhat.com&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>
