[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJaqyWc46O6TNZzVSizDXnWk4KkM40O9+M2CNVOdkLzUdXmFqQ@mail.gmail.com>
Date: Thu, 11 Aug 2022 11:58:18 +0200
From: Eugenio Perez Martin <eperezma@...hat.com>
To: "Michael S. Tsirkin" <mst@...hat.com>
Cc: kvm list <kvm@...r.kernel.org>,
linux-kernel <linux-kernel@...r.kernel.org>,
Jason Wang <jasowang@...hat.com>,
virtualization <virtualization@...ts.linux-foundation.org>,
netdev <netdev@...r.kernel.org>,
Dinan Gunawardena <dinang@...inx.com>,
Martin Porter <martinpo@...inx.com>,
Wu Zongyong <wuzongyong@...ux.alibaba.com>,
"Uminski, Piotr" <Piotr.Uminski@...el.com>,
"Dawar, Gautam" <gautam.dawar@....com>, ecree.xilinx@...il.com,
Martin Petrus Hubertus Habets <martinh@...inx.com>,
Stefano Garzarella <sgarzare@...hat.com>,
Pablo Cascon Katchadourian <pabloc@...inx.com>,
habetsm.xilinx@...il.com, Laurent Vivier <lvivier@...hat.com>,
Zhu Lingshan <lingshan.zhu@...el.com>,
"Kamde, Tanuj" <tanuj.kamde@....com>,
Longpeng <longpeng2@...wei.com>, Cindy Lu <lulu@...hat.com>,
Harpreet Singh Anand <hanand@...inx.com>,
Parav Pandit <parav@...dia.com>,
Si-Wei Liu <si-wei.liu@...cle.com>,
Eli Cohen <elic@...dia.com>,
Xie Yongji <xieyongji@...edance.com>,
Zhang Min <zhang.min9@....com.cn>,
Dan Carpenter <dan.carpenter@...cle.com>,
Christophe JAILLET <christophe.jaillet@...adoo.fr>
Subject: Re: [PATCH v7 3/4] vhost-vdpa: uAPI to suspend the device
On Thu, Aug 11, 2022 at 10:29 AM Michael S. Tsirkin <mst@...hat.com> wrote:
>
> On Wed, Aug 10, 2022 at 07:15:11PM +0200, Eugenio Pérez wrote:
> > The ioctl adds support for suspending the device from userspace.
> >
> > This is a must before getting virtqueue indexes (base) for live migration,
> > since the device could modify them after userland gets them. There are
> > individual ways to perform that action for some devices
> > (VHOST_NET_SET_BACKEND, VHOST_VSOCK_SET_RUNNING, ...) but there was no
> > way to perform it for any vhost device (and, in particular, vhost-vdpa).
> >
> > After a successful return of the ioctl call the device must not process
> > more virtqueue descriptors. The device can answer to read or writes of
> > config fields as if it were not suspended. In particular, writing to
> > "queue_enable" with a value of 1 will not make the device start
> > processing buffers of the virtqueue.
> >
> > Signed-off-by: Eugenio Pérez <eperezma@...hat.com>
> > Message-Id: <20220623160738.632852-4-eperezma@...hat.com>
> > Signed-off-by: Michael S. Tsirkin <mst@...hat.com>
>
> You are not supposed to include upstream maintainer's signoff
> like this.
>
I'm very sorry, I modified the commits in your vhost branch and I left
the signoff (and message-id) lines by mistake.
> > ---
> > v7: Delete argument to ioctl, unused
> > ---
> > drivers/vhost/vdpa.c | 19 +++++++++++++++++++
> > include/uapi/linux/vhost.h | 9 +++++++++
> > 2 files changed, 28 insertions(+)
> >
> > diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c
> > index 3d636e192061..7fa671ac4bdf 100644
> > --- a/drivers/vhost/vdpa.c
> > +++ b/drivers/vhost/vdpa.c
> > @@ -478,6 +478,22 @@ static long vhost_vdpa_get_vqs_count(struct vhost_vdpa *v, u32 __user *argp)
> > return 0;
> > }
> >
> > +/* After a successful return of ioctl the device must not process more
> > + * virtqueue descriptors. The device can answer to read or writes of config
> > + * fields as if it were not suspended. In particular, writing to "queue_enable"
> > + * with a value of 1 will not make the device start processing buffers.
> > + */
> > +static long vhost_vdpa_suspend(struct vhost_vdpa *v)
> > +{
> > + struct vdpa_device *vdpa = v->vdpa;
> > + const struct vdpa_config_ops *ops = vdpa->config;
> > +
> > + if (!ops->suspend)
> > + return -EOPNOTSUPP;
> > +
> > + return ops->suspend(vdpa);
> > +}
> > +
> > static long vhost_vdpa_vring_ioctl(struct vhost_vdpa *v, unsigned int cmd,
> > void __user *argp)
> > {
> > @@ -654,6 +670,9 @@ static long vhost_vdpa_unlocked_ioctl(struct file *filep,
> > case VHOST_VDPA_GET_VQS_COUNT:
> > r = vhost_vdpa_get_vqs_count(v, argp);
> > break;
> > + case VHOST_VDPA_SUSPEND:
> > + r = vhost_vdpa_suspend(v);
> > + break;
> > default:
> > r = vhost_dev_ioctl(&v->vdev, cmd, argp);
> > if (r == -ENOIOCTLCMD)
> > diff --git a/include/uapi/linux/vhost.h b/include/uapi/linux/vhost.h
> > index cab645d4a645..f9f115a7c75b 100644
> > --- a/include/uapi/linux/vhost.h
> > +++ b/include/uapi/linux/vhost.h
> > @@ -171,4 +171,13 @@
> > #define VHOST_VDPA_SET_GROUP_ASID _IOW(VHOST_VIRTIO, 0x7C, \
> > struct vhost_vring_state)
> >
> > +/* Suspend a device so it does not process virtqueue requests anymore
> > + *
> > + * After the return of ioctl the device must preserve all the necessary state
> > + * (the virtqueue vring base plus the possible device specific states) that is
> > + * required for restoring in the future. The device must not change its
> > + * configuration after that point.
> > + */
> > +#define VHOST_VDPA_SUSPEND _IO(VHOST_VIRTIO, 0x7D)
> > +
> > #endif
> > --
> > 2.31.1
>
Powered by blists - more mailing lists