- kvm-rbd-Run-co-BH-CB-in-the-coroutine-s-AioContext.patch [RHEL-79118] - kvm-curl-Fix-coroutine-waking.patch [RHEL-79118] - kvm-block-io-Take-reqs_lock-for-tracked_requests.patch [RHEL-79118] - kvm-qcow2-Re-initialize-lock-in-invalidate_cache.patch [RHEL-79118] - kvm-qcow2-Fix-cache_clean_timer.patch [RHEL-79118] - kvm-net-bundle-all-offloads-in-a-single-struct.patch [RHEL-143785] - kvm-linux-headers-deal-with-counted_by-annotation.patch [RHEL-143785] - kvm-linux-headers-Update-to-Linux-v6.17-rc1.patch [RHEL-143785] - kvm-virtio-introduce-extended-features-type.patch [RHEL-143785] - kvm-virtio-serialize-extended-features-state.patch [RHEL-143785] - kvm-virtio-add-support-for-negotiating-extended-features.patch [RHEL-143785] - kvm-virtio-pci-implement-support-for-extended-features.patch [RHEL-143785] - kvm-vhost-add-support-for-negotiating-extended-features.patch [RHEL-143785] - kvm-qmp-update-virtio-features-map-to-support-extended-f.patch [RHEL-143785] - kvm-vhost-backend-implement-extended-features-support.patch [RHEL-143785] - kvm-vhost-net-implement-extended-features-support.patch [RHEL-143785] - kvm-virtio-net-implement-extended-features-support.patch [RHEL-143785] - kvm-net-implement-tunnel-probing.patch [RHEL-143785] - kvm-net-implement-UDP-tunnel-features-offloading.patch [RHEL-143785] - Resolves: RHEL-79118 ([network-storage][rbd][core-dump]installation of guest failed sometimes with multiqueue enabled [rhel10]) - Resolves: RHEL-143785 (backport support for GSO over UDP tunnel offload)
134 lines
4.8 KiB
Diff
134 lines
4.8 KiB
Diff
From d0e31af77cd51df8c17fa4d304571f8b1eb5ce29 Mon Sep 17 00:00:00 2001
|
|
From: Paolo Abeni <pabeni@redhat.com>
|
|
Date: Mon, 22 Sep 2025 16:18:24 +0200
|
|
Subject: [PATCH 15/19] vhost-backend: implement extended features support
|
|
|
|
RH-Author: Laurent Vivier <lvivier@redhat.com>
|
|
RH-MergeRequest: 456: backport support for GSO over UDP tunnel offload
|
|
RH-Jira: RHEL-143785
|
|
RH-Acked-by: Cindy Lu <lulu@redhat.com>
|
|
RH-Acked-by: MST <mst@redhat.com>
|
|
RH-Commit: [10/14] bd12c2f08dad502a7359d4344a2220b10ac96a48 (lvivier/qemu-kvm-centos)
|
|
|
|
JIRA: https://issues.redhat.com/browse/RHEL-143785
|
|
|
|
Leverage the kernel extended features manipulation ioctls(), if
|
|
available, and fallback to old ops otherwise. Error out when setting
|
|
extended features but kernel support is not available.
|
|
|
|
Note that extended support for get/set backend features is not needed,
|
|
as the only feature that can be changed belongs to the 64 bit range.
|
|
|
|
Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
|
|
Acked-by: Jason Wang <jasowang@redhat.com>
|
|
Acked-by: Stefano Garzarella <sgarzare@redhat.com>
|
|
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
|
Tested-by: Lei Yang <leiyang@redhat.com>
|
|
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
|
|
Message-ID: <150daade3d59e77629276920e014ee8e5fc12121.1758549625.git.pabeni@redhat.com>
|
|
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
|
|
(cherry picked from commit f412c1f57ab58fd595efee26264193759220ca6f)
|
|
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
|
|
---
|
|
hw/virtio/vhost-backend.c | 62 ++++++++++++++++++++++++++++++++-------
|
|
1 file changed, 51 insertions(+), 11 deletions(-)
|
|
|
|
diff --git a/hw/virtio/vhost-backend.c b/hw/virtio/vhost-backend.c
|
|
index 833804dd40..4367db0d95 100644
|
|
--- a/hw/virtio/vhost-backend.c
|
|
+++ b/hw/virtio/vhost-backend.c
|
|
@@ -20,6 +20,11 @@
|
|
#include <linux/vhost.h>
|
|
#include <sys/ioctl.h>
|
|
|
|
+struct vhost_features {
|
|
+ uint64_t count;
|
|
+ uint64_t features[VIRTIO_FEATURES_NU64S];
|
|
+};
|
|
+
|
|
static int vhost_kernel_call(struct vhost_dev *dev, unsigned long int request,
|
|
void *arg)
|
|
{
|
|
@@ -182,12 +187,6 @@ static int vhost_kernel_get_vring_worker(struct vhost_dev *dev,
|
|
return vhost_kernel_call(dev, VHOST_GET_VRING_WORKER, worker);
|
|
}
|
|
|
|
-static int vhost_kernel_set_features(struct vhost_dev *dev,
|
|
- uint64_t features)
|
|
-{
|
|
- return vhost_kernel_call(dev, VHOST_SET_FEATURES, &features);
|
|
-}
|
|
-
|
|
static int vhost_kernel_set_backend_cap(struct vhost_dev *dev)
|
|
{
|
|
uint64_t features;
|
|
@@ -210,10 +209,51 @@ static int vhost_kernel_set_backend_cap(struct vhost_dev *dev)
|
|
return 0;
|
|
}
|
|
|
|
-static int vhost_kernel_get_features(struct vhost_dev *dev,
|
|
- uint64_t *features)
|
|
+static int vhost_kernel_set_features(struct vhost_dev *dev,
|
|
+ const uint64_t *features)
|
|
{
|
|
- return vhost_kernel_call(dev, VHOST_GET_FEATURES, features);
|
|
+ struct vhost_features farray;
|
|
+ bool extended_in_use;
|
|
+ int r;
|
|
+
|
|
+ farray.count = VIRTIO_FEATURES_NU64S;
|
|
+ virtio_features_copy(farray.features, features);
|
|
+ extended_in_use = virtio_features_use_ex(farray.features);
|
|
+
|
|
+ /*
|
|
+ * Can't check for ENOTTY: for unknown ioctls the kernel interprets
|
|
+ * the argument as a virtio queue id and most likely errors out validating
|
|
+ * such id, instead of reporting an unknown operation.
|
|
+ */
|
|
+ r = vhost_kernel_call(dev, VHOST_SET_FEATURES_ARRAY, &farray);
|
|
+ if (!r) {
|
|
+ return 0;
|
|
+ }
|
|
+
|
|
+ if (extended_in_use) {
|
|
+ error_report("Trying to set extended features without kernel support");
|
|
+ return -EINVAL;
|
|
+ }
|
|
+ return vhost_kernel_call(dev, VHOST_SET_FEATURES, &farray.features[0]);
|
|
+}
|
|
+
|
|
+static int vhost_kernel_get_features(struct vhost_dev *dev, uint64_t *features)
|
|
+{
|
|
+ struct vhost_features farray;
|
|
+ int r;
|
|
+
|
|
+ farray.count = VIRTIO_FEATURES_NU64S;
|
|
+ r = vhost_kernel_call(dev, VHOST_GET_FEATURES_ARRAY, &farray);
|
|
+ if (r) {
|
|
+ memset(&farray, 0, sizeof(farray));
|
|
+ r = vhost_kernel_call(dev, VHOST_GET_FEATURES, &farray.features[0]);
|
|
+ }
|
|
+ if (r) {
|
|
+ return r;
|
|
+ }
|
|
+
|
|
+ virtio_features_copy(features, farray.features);
|
|
+ return 0;
|
|
}
|
|
|
|
static int vhost_kernel_set_owner(struct vhost_dev *dev)
|
|
@@ -341,8 +381,8 @@ const VhostOps kernel_ops = {
|
|
.vhost_attach_vring_worker = vhost_kernel_attach_vring_worker,
|
|
.vhost_new_worker = vhost_kernel_new_worker,
|
|
.vhost_free_worker = vhost_kernel_free_worker,
|
|
- .vhost_set_features = vhost_kernel_set_features,
|
|
- .vhost_get_features = vhost_kernel_get_features,
|
|
+ .vhost_set_features_ex = vhost_kernel_set_features,
|
|
+ .vhost_get_features_ex = vhost_kernel_get_features,
|
|
.vhost_set_backend_cap = vhost_kernel_set_backend_cap,
|
|
.vhost_set_owner = vhost_kernel_set_owner,
|
|
.vhost_get_vq_index = vhost_kernel_get_vq_index,
|
|
--
|
|
2.47.3
|
|
|