[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACGkMEuqbEGXE-6xe_kkPMT_JicieQ=HjNKx9j_o3XG9TCuAKg@mail.gmail.com>
Date: Fri, 30 Jan 2026 10:17:31 +0800
From: Jason Wang <jasowang@...hat.com>
To: Eugenio Perez Martin <eperezma@...hat.com>
Cc: "Michael S . Tsirkin" <mst@...hat.com>, Xuan Zhuo <xuanzhuo@...ux.alibaba.com>,
Cindy Lu <lulu@...hat.com>, Laurent Vivier <lvivier@...hat.com>,
Stefano Garzarella <sgarzare@...hat.com>, linux-kernel@...r.kernel.org,
Maxime Coquelin <mcoqueli@...hat.com>, Yongji Xie <xieyongji@...edance.com>,
virtualization@...ts.linux.dev
Subject: Re: [PATCH 5/6] vduse: add F_QUEUE_READY feature
On Thu, Jan 29, 2026 at 2:26 PM Eugenio Perez Martin
<eperezma@...hat.com> wrote:
>
> On Thu, Jan 29, 2026 at 3:12 AM Jason Wang <jasowang@...hat.com> wrote:
> >
> > On Wed, Jan 28, 2026 at 8:45 PM Eugenio Pérez <eperezma@...hat.com> wrote:
> > >
> > > Add the VDUSE_F_QUEUE_READY feature flag. This allows the kernel module
> > > to explicitly signal userspace when a specific virtqueue has been
> > > enabled.
> > >
> > > In scenarios like Live Migration of VirtIO net devices, the dataplane
> > > starts after the control virtqueue allowing QEMU to apply configuration
> > > in the destination device.
> > >
> > > Signed-off-by: Eugenio Pérez <eperezma@...hat.com>
> > > ---
> > > drivers/vdpa/vdpa_user/vduse_dev.c | 28 +++++++++++++++++++++++++++-
> > > include/uapi/linux/vduse.h | 19 +++++++++++++++++++
> > > 2 files changed, 46 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/vdpa/vdpa_user/vduse_dev.c b/drivers/vdpa/vdpa_user/vduse_dev.c
> > > index e7da69c2ad71..1d93b540db4d 100644
> > > --- a/drivers/vdpa/vdpa_user/vduse_dev.c
> > > +++ b/drivers/vdpa/vdpa_user/vduse_dev.c
> > > @@ -9,6 +9,7 @@
> > > */
> > >
> > > #include "linux/virtio_net.h"
> > > +#include <linux/bits.h>
> > > #include <linux/cleanup.h>
> > > #include <linux/init.h>
> > > #include <linux/module.h>
> > > @@ -53,7 +54,7 @@
> > > #define IRQ_UNBOUND -1
> > >
> > > /* Supported VDUSE features */
> > > -static const uint64_t vduse_features;
> > > +static const uint64_t vduse_features = BIT_U64(VDUSE_F_QUEUE_READY);
> > >
> > > /*
> > > * VDUSE instance have not asked the vduse API version, so assume 0.
> > > @@ -120,6 +121,7 @@ struct vduse_dev {
> > > char *name;
> > > struct mutex lock;
> > > spinlock_t msg_lock;
> > > + u64 vduse_features;
> > > u64 msg_unique;
> > > u32 msg_timeout;
> > > wait_queue_head_t waitq;
> > > @@ -619,7 +621,30 @@ static void vduse_vdpa_set_vq_ready(struct vdpa_device *vdpa,
> > > {
> > > struct vduse_dev *dev = vdpa_to_vduse(vdpa);
> > > struct vduse_virtqueue *vq = dev->vqs[idx];
> > > + struct vduse_dev_msg msg = { 0 };
> > > + int r;
> > > +
> > > + if (!(dev->vduse_features & BIT_U64(VDUSE_F_QUEUE_READY)))
> > > + goto out;
> > > +
> > > + msg.req.type = VDUSE_SET_VQ_READY;
> > > + msg.req.vq_ready.num = idx;
> > > + msg.req.vq_ready.ready = !!ready;
> > > +
> > > + r = vduse_dev_msg_sync(dev, &msg);
> > >
> > > + if (r < 0) {
> > > + dev_dbg(&vdpa->dev, "device refuses to set vq %u ready %u",
> > > + idx, ready);
> > > +
> > > + /* We can't do better than break the device in this case */
> > > + spin_lock(&dev->msg_lock);
> > > + vduse_dev_broken(dev);
> >
> > This has been done by vduse_dev_msg_sync().
> >
>
> This is done by msg_sync() when userland does not reply in a
> timeframe, but not when userland replies with VDUSE_REQ_RESULT_FAILED.
> Should I add a comment?
If this is not specific to Q_READY, I think we need to move it to
msg_sync() as well.
Thanks
>
Powered by blists - more mailing lists