From: Jason Wang <jasowang@redhat.com>
To: "Eugenio Pérez" <eperezma@redhat.com>
Cc: "Michael S . Tsirkin" <mst@redhat.com>,
Xuan Zhuo <xuanzhuo@linux.alibaba.com>,
Yongji Xie <xieyongji@bytedance.com>, Cindy Lu <lulu@redhat.com>,
Maxime Coquelin <mcoqueli@redhat.com>,
Stefano Garzarella <sgarzare@redhat.com>,
linux-kernel@vger.kernel.org, virtualization@lists.linux.dev,
Laurent Vivier <lvivier@redhat.com>
Subject: Re: [PATCH v2] vduse: Add suspend
Date: Thu, 12 Mar 2026 12:03:40 +0800 [thread overview]
Message-ID: <CACGkMEtAQ1HM_4P0aM2AARy7LVtjFmtzbPGOkYn4jD5KMJ+cBQ@mail.gmail.com> (raw)
In-Reply-To: <20260310191019.1099757-1-eperezma@redhat.com>
On Wed, Mar 11, 2026 at 3:10 AM Eugenio Pérez <eperezma@redhat.com> wrote:
>
> Implement suspend operation for vduse devices, so vhost-vdpa will offer
> that backend feature and userspace can effectively suspend the device.
>
> This is a must before get virtqueue indexes (base) for live migration,
> since the device could modify them after userland gets them.
As discussed in the pervious version, let's explain why and the plan
to support resume.
>
> Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
> ---
> This patch depends on
> https://lore.kernel.org/lkml/20260310190759.1097506-1-eperezma@redhat.com
>
> v2:
> * Take the rwsem only before the actual kick, not in vduse_vdpa_kick_vq.
> This assures that we're not in a critical section.
> ---
> drivers/vdpa/vdpa_user/vduse_dev.c | 86 +++++++++++++++++++++++++++++-
> include/uapi/linux/vduse.h | 4 ++
> 2 files changed, 88 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/vdpa/vdpa_user/vduse_dev.c b/drivers/vdpa/vdpa_user/vduse_dev.c
> index 4f642b95a7cb..f56b1e3eb82d 100644
> --- a/drivers/vdpa/vdpa_user/vduse_dev.c
> +++ b/drivers/vdpa/vdpa_user/vduse_dev.c
> @@ -54,7 +54,8 @@
> #define IRQ_UNBOUND -1
>
> /* Supported VDUSE features */
> -static const uint64_t vduse_features = BIT_U64(VDUSE_F_QUEUE_READY);
> +static const uint64_t vduse_features = BIT_U64(VDUSE_F_QUEUE_READY) |
> + BIT_U64(VDUSE_F_SUSPEND);
>
> /*
> * VDUSE instance have not asked the vduse API version, so assume 0.
> @@ -85,6 +86,7 @@ struct vduse_virtqueue {
> int irq_effective_cpu;
> struct cpumask irq_affinity;
> struct kobject kobj;
> + struct vduse_dev *dev;
> };
>
> struct vduse_dev;
> @@ -134,6 +136,7 @@ struct vduse_dev {
> int minor;
> bool broken;
> bool connected;
> + bool suspended;
> u64 api_version;
> u64 device_features;
> u64 driver_features;
> @@ -480,6 +483,7 @@ static void vduse_dev_reset(struct vduse_dev *dev)
>
> down_write(&dev->rwsem);
>
> + dev->suspended = false;
> dev->status = 0;
> dev->driver_features = 0;
> dev->generation++;
> @@ -538,6 +542,10 @@ static void vduse_vq_kick(struct vduse_virtqueue *vq)
> if (!vq->ready)
> goto unlock;
>
> + guard(rwsem_read)(&vq->dev->rwsem);
> + if (vq->dev->suspended)
> + return;
Any reason for this? E.g We don't do this for other transports.
Everything else looks good.
Thanks
next prev parent reply other threads:[~2026-03-12 4:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-10 19:10 [PATCH v2] vduse: Add suspend Eugenio Pérez
2026-03-12 4:03 ` Jason Wang [this message]
2026-03-12 6:27 ` Eugenio Perez Martin
2026-03-13 5:57 ` Jason Wang
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=CACGkMEtAQ1HM_4P0aM2AARy7LVtjFmtzbPGOkYn4jD5KMJ+cBQ@mail.gmail.com \
--to=jasowang@redhat.com \
--cc=eperezma@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