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

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