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

586cba
From 46c5a35aa56cf0dd55376638dbf7d46e85f497e1 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
586cba
Subject: [PATCH 12/16] 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
586cba
RH-Author: Jason Wang <jasowang@redhat.com>
586cba
RH-MergeRequest: 98: Multiqueue fixes for vhost-vDPA
586cba
RH-Commit: [5/7] 7531bb8da0c99b29997e8bfc6d1e811daf3cdd38 (jasowang/qemu-kvm-cs)
586cba
RH-Bugzilla: 2070804
24c150
RH-Acked-by: Eugenio Pérez <eperezma@redhat.com>
586cba
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
586cba
RH-Acked-by: Cindy Lu <lulu@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)
586cba
Signed-off-by: Jason Wang <jasowang@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
586cba
index 8adf7c0b92..6e3dbd9e89 100644
24c150
--- a/hw/virtio/vhost-vdpa.c
24c150
+++ b/hw/virtio/vhost-vdpa.c
586cba
@@ -665,7 +665,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