From: "Eugenio Pérez" <eperezma@redhat.com>
To: "Michael S . Tsirkin" <mst@redhat.com>
Cc: "Maxime Coquelin" <mcoqueli@redhat.com>,
"Stefano Garzarella" <sgarzare@redhat.com>,
"Jason Wang" <jasowang@redhat.com>,
"Eugenio Pérez" <eperezma@redhat.com>,
"Xuan Zhuo" <xuanzhuo@linux.alibaba.com>,
"Laurent Vivier" <lvivier@redhat.com>,
virtualization@lists.linux.dev, linux-kernel@vger.kernel.org,
"Cindy Lu" <lulu@redhat.com>,
"Yongji Xie" <xieyongji@bytedance.com>
Subject: [PATCH 2/2] vduse: not take the device semaphore while holding vq spinlock
Date: Thu, 11 Jun 2026 15:38:06 +0200 [thread overview]
Message-ID: <20260611133806.198402-3-eperezma@redhat.com> (raw)
In-Reply-To: <20260611133806.198402-1-eperezma@redhat.com>
It's an invalid lock pattern, so take them reversely.
This also makes the lock ordering coherent with vduse_dev_reset.
Fixes: e4a249d15eb2 ("vduse: Fix error around jumping over a __cleanup() variable")
Fixes: 6c141c034c1b ("vduse: Add suspend")
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
---
drivers/vdpa/vdpa_user/vduse_dev.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/vdpa/vdpa_user/vduse_dev.c b/drivers/vdpa/vdpa_user/vduse_dev.c
index 86bd3116eda7..2c1cafea6536 100644
--- a/drivers/vdpa/vdpa_user/vduse_dev.c
+++ b/drivers/vdpa/vdpa_user/vduse_dev.c
@@ -561,14 +561,14 @@ static int vduse_vdpa_set_vq_address(struct vdpa_device *vdpa, u16 idx,
static void vduse_vq_kick(struct vduse_virtqueue *vq)
{
- guard(spinlock)(&vq->kick_lock);
- if (!vq->ready)
- return;
-
guard(rwsem_read)(&vq->dev->rwsem);
if (vq->dev->suspended)
return;
+ guard(spinlock)(&vq->kick_lock);
+ if (!vq->ready)
+ return;
+
if (vq->kickfd)
eventfd_signal(vq->kickfd);
else
--
2.54.0
next prev parent reply other threads:[~2026-06-11 13:38 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-11 13:38 [PATCH 0/2] Fix lock errors in VDUSE suspend feature Eugenio Pérez
2026-06-11 13:38 ` [PATCH 1/2] vduse: fix not releasing taken semaphore in vduse_dev_queue_irq_work Eugenio Pérez
2026-06-11 13:38 ` Eugenio Pérez [this message]
2026-06-11 14:12 ` [PATCH 0/2] Fix lock errors in VDUSE suspend feature Michael S. Tsirkin
2026-06-11 14:14 ` Michael S. Tsirkin
2026-06-11 14:46 ` Michael S. Tsirkin
2026-06-11 14:49 ` Michael S. Tsirkin
2026-06-11 14:53 ` Michael S. Tsirkin
2026-06-11 16:33 ` Eugenio Perez Martin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260611133806.198402-3-eperezma@redhat.com \
--to=eperezma@redhat.com \
--cc=jasowang@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lulu@redhat.com \
--cc=lvivier@redhat.com \
--cc=mcoqueli@redhat.com \
--cc=mst@redhat.com \
--cc=sgarzare@redhat.com \
--cc=virtualization@lists.linux.dev \
--cc=xieyongji@bytedance.com \
--cc=xuanzhuo@linux.alibaba.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.