public inbox for virtualization@lists.linux-foundation.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Eugenio Perez Martin <eperezma@redhat.com>
Cc: Jason Wang <jasowang@redhat.com>, Cindy Lu <lulu@redhat.com>,
	Xuan Zhuo <xuanzhuo@linux.alibaba.com>,
	linux-kernel@vger.kernel.org,
	Maxime Coquelin <mcoqueli@redhat.com>,
	Stefano Garzarella <sgarzare@redhat.com>,
	Laurent Vivier <lvivier@redhat.com>,
	Yongji Xie <xieyongji@bytedance.com>,
	virtualization@lists.linux.dev
Subject: Re: [PATCH v3 3/3] vduse: add F_QUEUE_READY feature
Date: Tue, 24 Mar 2026 11:24:33 -0400	[thread overview]
Message-ID: <20260324112340-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <CAJaqyWd40=bxMOwTR4wyHtPS_-Txn2WbwSj9rZEXoY-4DxQgpw@mail.gmail.com>

On Tue, Mar 24, 2026 at 03:01:47PM +0100, Eugenio Perez Martin wrote:
> On Fri, Mar 13, 2026 at 8:08 AM Eugenio Perez Martin
> <eperezma@redhat.com> wrote:
> >
> > On Fri, Mar 13, 2026 at 7:05 AM Jason Wang <jasowang@redhat.com> wrote:
> > >
> > > On Thu, Mar 12, 2026 at 2:24 PM Eugenio Perez Martin
> > > <eperezma@redhat.com> wrote:
> > > >
> > > > On Thu, Mar 12, 2026 at 4:58 AM Jason Wang <jasowang@redhat.com> wrote:
> > > > >
> > > > > On Wed, Mar 11, 2026 at 3:08 AM Eugenio Pérez <eperezma@redhat.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@redhat.com>
> > > > > > ---
> > > > > > v2:
> > > > > > * Fix comment of vduse_dev_request.vq_ready
> > > > > > * Set vq_ready before sending the message to the VDUSE userland
> > > > > >   instance, avoiding the need for SMP sync after receiving the message.
> > > > > > ---
> > > > > >  drivers/vdpa/vdpa_user/vduse_dev.c | 28 +++++++++++++++++++++++++++-
> > > > > >  include/uapi/linux/vduse.h         | 18 ++++++++++++++++++
> > > > > >  2 files changed, 45 insertions(+), 1 deletion(-)
> > > > > >
> > > > > > diff --git a/drivers/vdpa/vdpa_user/vduse_dev.c b/drivers/vdpa/vdpa_user/vduse_dev.c
> > > > > > index 17e0358d3a68..4f642b95a7cb 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;
> > > > > > @@ -601,8 +603,29 @@ 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;
> > > > > >
> > > > > >         vq->ready = ready;
> > > > > > +
> > > > > > +       if (!(dev->vduse_features & BIT_U64(VDUSE_F_QUEUE_READY)))
> > > > > > +               return;
> > > > > > +
> > > > > > +       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 */
> > > > >
> > > > > It's better to explain why we can't depend on vduse_dev_msg_sync() here.
> > > > >
> > > > > For example it did:
> > > > >
> > > > >         if (unlikely(dev->broken))
> > > > >                 return -EIO;
> > > > >
> > > > >         init_waitqueue_head(&msg->waitq);
> > > > >         spin_lock(&dev->msg_lock);
> > > > >         if (unlikely(dev->broken)) {
> > > > >                 spin_unlock(&dev->msg_lock);
> > > > >                 return -EIO;
> > > > >         }
> > > > >
> > > > > and
> > > > >
> > > > >         if (!msg->completed) {
> > > > >                 list_del(&msg->list);
> > > > >                 msg->resp.result = VDUSE_REQ_RESULT_FAILED;
> > > > >                 /* Mark the device as malfunction when there is a timeout */
> > > > >                 if (!ret)
> > > > >                         vduse_dev_broken(dev);
> > > > >         }
> > > > >
> > > >
> > > > I'm not sure I follow you here.
> > > >
> > > > We can't do better than breaking the device because the function
> > > > returns no error state, and the caller does not expect an error code.
> > > > Do you mean we can't depend on vduse_dev_msg_sync to call
> > > > vduse_dev_broken(dev) by itself?
> > >
> > > I think I meant, reset seems to be more heavyweight than suspend.
> > >
> > > So if reset can fail, I don't see reason ot break device only for
> > > suspend failure.
> > >
> >
> > Sorry I still don't get you.
> >
> > This series does not implement suspend at all. It doesn't modify the
> > VDUSE device reset or the virtio reset behavior. It only implements
> > the vq ready message for the device. If the device returns an error
> > from that operation, what is your proposal for when the driver sends
> > new messages like resume?
> >
> 
> Friendly ping.

Jason, more comments? If this is to go in it has to go into linux next.

-- 
MST


  reply	other threads:[~2026-03-24 15:24 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-10 19:07 [PATCH v3 0/3] Add queue ready message to VDUSE Eugenio Pérez
2026-03-10 19:07 ` [PATCH v3 1/3] vduse: store control device pointer Eugenio Pérez
2026-03-10 19:07 ` [PATCH v3 2/3] vduse: add VDUSE_GET_FEATURES ioctl Eugenio Pérez
2026-03-12  3:55   ` Jason Wang
2026-03-12  7:11     ` Eugenio Perez Martin
2026-03-13  5:56       ` Jason Wang
2026-03-13  6:46         ` Eugenio Perez Martin
2026-03-10 19:07 ` [PATCH v3 3/3] vduse: add F_QUEUE_READY feature Eugenio Pérez
2026-03-12  3:58   ` Jason Wang
2026-03-12  6:24     ` Eugenio Perez Martin
2026-03-13  6:04       ` Jason Wang
2026-03-13  7:08         ` Eugenio Perez Martin
2026-03-24 14:01           ` Eugenio Perez Martin
2026-03-24 15:24             ` Michael S. Tsirkin [this message]
2026-03-26  2:44               ` Jason Wang
2026-03-26  6:56                 ` 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=20260324112340-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=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=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