thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone

Blame SOURCES/kvm-vhost-vdpa-backend-feature-should-set-only-once.patch

1be5c7
From 01270bb66a4f7897a4fd06ba248eeeb41dc47571 Mon Sep 17 00:00:00 2001
1be5c7
From: Si-Wei Liu <si-wei.liu@oracle.com>
1be5c7
Date: Fri, 6 May 2022 19:28:16 -0700
1be5c7
Subject: [PATCH 18/24] vhost-vdpa: backend feature should set only once
1be5c7
MIME-Version: 1.0
1be5c7
Content-Type: text/plain; charset=UTF-8
1be5c7
Content-Transfer-Encoding: 8bit
1be5c7
1be5c7
RH-Author: Jason Wang <jasowang@redhat.com>
1be5c7
RH-MergeRequest: 187: Multiqueue fixes for vhost-vDPA
1be5c7
RH-Commit: [5/7] 0ab13542cf25c129dc403db95c7db12cdb012744
1be5c7
RH-Bugzilla: 2069946
1be5c7
RH-Acked-by: Eugenio Pérez <eperezma@redhat.com>
1be5c7
RH-Acked-by: Cindy Lu <lulu@redhat.com>
1be5c7
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
1be5c7
1be5c7
The vhost_vdpa_one_time_request() branch in
1be5c7
vhost_vdpa_set_backend_cap() incorrectly sends down
1be5c7
ioctls on vhost_dev with non-zero index. This may
1be5c7
end up with multiple VHOST_SET_BACKEND_FEATURES
1be5c7
ioctl calls sent down on the vhost-vdpa fd that is
1be5c7
shared between all these vhost_dev's.
1be5c7
1be5c7
To fix it, send down ioctl only once via the first
1be5c7
vhost_dev with index 0. Toggle the polarity of the
1be5c7
vhost_vdpa_one_time_request() test should do the
1be5c7
trick.
1be5c7
1be5c7
Fixes: 4d191cfdc7de ("vhost-vdpa: classify one time request")
1be5c7
Signed-off-by: Si-Wei Liu <si-wei.liu@oracle.com>
1be5c7
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
1be5c7
Acked-by: Jason Wang <jasowang@redhat.com>
1be5c7
Acked-by: Eugenio Pérez <eperezma@redhat.com>
1be5c7
Message-Id: <1651890498-24478-6-git-send-email-si-wei.liu@oracle.com>
1be5c7
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
1be5c7
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
1be5c7
(cherry picked from commit 6aee7e4233f6467f69531fcd352adff028f3f5ea)
1be5c7
Signed-off-by: Jason Wang <jasowang@redhat.com>
1be5c7
---
1be5c7
 hw/virtio/vhost-vdpa.c | 2 +-
1be5c7
 1 file changed, 1 insertion(+), 1 deletion(-)
1be5c7
1be5c7
diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c
1be5c7
index 78da48a333..a9be24776a 100644
1be5c7
--- a/hw/virtio/vhost-vdpa.c
1be5c7
+++ b/hw/virtio/vhost-vdpa.c
1be5c7
@@ -525,7 +525,7 @@ static int vhost_vdpa_set_backend_cap(struct vhost_dev *dev)
1be5c7
 
1be5c7
     features &= f;
1be5c7
 
1be5c7
-    if (vhost_vdpa_one_time_request(dev)) {
1be5c7
+    if (!vhost_vdpa_one_time_request(dev)) {
1be5c7
         r = vhost_vdpa_call(dev, VHOST_SET_BACKEND_FEATURES, &features);
1be5c7
         if (r) {
1be5c7
             return -EFAULT;
1be5c7
-- 
1be5c7
2.35.3
1be5c7