[PATCH v1] vhost: always lock all qp if handlers request it

Serhii Iliushyk sil-plv at napatech.com
Tue Oct 7 16:56:16 CEST 2025


The check for VIRTIO_DEV_VDPA_CONFIGURED flag is not neede
since each handler has its own lock_all_qps flag
to indicate whether it needs all queue pairs.

Checking the VIRTIO_DEV_VDPA_CONFIGURED flag caused certain handlers
(for example SET_MEM_TABLE for memory hot plug) to run without holding
the per-vq access_lock and trigger vq_assert_lock failures.

Signed-off-by: Serhii Iliushyk <sil-plv at napatech.com>
---
 lib/vhost/vhost_user.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c
index 4bfb13fb98..9288da9322 100644
--- a/lib/vhost/vhost_user.c
+++ b/lib/vhost/vhost_user.c
@@ -3171,10 +3171,8 @@ vhost_user_msg_handler(int vid, int fd)
 	 * would cause a dead lock.
 	 */
 	if (msg_handler != NULL && msg_handler->lock_all_qps) {
-		if (!(dev->flags & VIRTIO_DEV_VDPA_CONFIGURED)) {
-			vhost_user_lock_all_queue_pairs(dev);
-			unlock_required = 1;
-		}
+		vhost_user_lock_all_queue_pairs(dev);
+		unlock_required = 1;
 	}
 
 	handled = false;
-- 
2.47.3



More information about the dev mailing list