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 1/2] vduse: fix not releasing taken semaphore in vduse_dev_queue_irq_work
Date: Thu, 11 Jun 2026 15:38:05 +0200 [thread overview]
Message-ID: <20260611133806.198402-2-eperezma@redhat.com> (raw)
In-Reply-To: <20260611133806.198402-1-eperezma@redhat.com>
If dev->suspended the function returns not relasing the semaphore, so
the only solution to be able to use the device is to reset again from
userspace. Convert the semaphore functions to the equivalent guard() to
avoid it.
Fixes: 6c141c034c1b ("vduse: Add suspend")
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
---
drivers/vdpa/vdpa_user/vduse_dev.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/drivers/vdpa/vdpa_user/vduse_dev.c b/drivers/vdpa/vdpa_user/vduse_dev.c
index 0500da043761..86bd3116eda7 100644
--- a/drivers/vdpa/vdpa_user/vduse_dev.c
+++ b/drivers/vdpa/vdpa_user/vduse_dev.c
@@ -1281,21 +1281,16 @@ static int vduse_dev_queue_irq_work(struct vduse_dev *dev,
{
int ret = -EINVAL;
- down_read(&dev->rwsem);
- if (dev->suspended)
+ guard(rwsem_read)(&dev->rwsem);
+ if (dev->suspended || !(dev->status & VIRTIO_CONFIG_S_DRIVER_OK))
return ret;
- if (!(dev->status & VIRTIO_CONFIG_S_DRIVER_OK))
- goto unlock;
-
ret = 0;
if (irq_effective_cpu == IRQ_UNBOUND)
queue_work(vduse_irq_wq, irq_work);
else
queue_work_on(irq_effective_cpu,
vduse_irq_bound_wq, irq_work);
-unlock:
- up_read(&dev->rwsem);
return ret;
}
--
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 ` Eugenio Pérez [this message]
2026-06-11 13:38 ` [PATCH 2/2] vduse: not take the device semaphore while holding vq spinlock Eugenio Pérez
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-2-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox