[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACLfguV4PYpxJEtodWqnYwQ1WJrpjTx1XMqJOsDYsvNrfUKr1A@mail.gmail.com>
Date: Sat, 1 Jul 2023 17:14:57 +0800
From: Cindy Lu <lulu@...hat.com>
To: Jason Wang <jasowang@...hat.com>
Cc: mst@...hat.com, maxime.coquelin@...hat.com, xieyongji@...edance.com,
kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
virtualization@...ts.linux-foundation.org, netdev@...r.kernel.org
Subject: Re: [RFC 4/4] vduse: update the vq_info in ioctl
On Wed, Jun 28, 2023 at 4:13 PM Jason Wang <jasowang@...hat.com> wrote:
>
> On Wed, Jun 28, 2023 at 3:00 PM Cindy Lu <lulu@...hat.com> wrote:
> >
> > From: Your Name <you@...mple.com>
> >
> > in VDUSE_VQ_GET_INFO, driver will sync the last_avail_idx
> > with reconnect info, I have olny test the split mode, so
>
> Typo, should be "only".
>
sure will change this
> > only use this here, will add more information later
> >
> > Signed-off-by: Cindy Lu <lulu@...hat.com>
> > ---
> > drivers/vdpa/vdpa_user/vduse_dev.c | 16 ++++++++++++++++
> > 1 file changed, 16 insertions(+)
> >
> > diff --git a/drivers/vdpa/vdpa_user/vduse_dev.c b/drivers/vdpa/vdpa_user/vduse_dev.c
> > index 3df1256eccb4..b8e453eac0ce 100644
> > --- a/drivers/vdpa/vdpa_user/vduse_dev.c
> > +++ b/drivers/vdpa/vdpa_user/vduse_dev.c
> > @@ -141,6 +141,11 @@ static u32 allowed_device_id[] = {
> > VIRTIO_ID_NET,
> > };
> >
> > +struct vhost_reconnect_vring {
> > + uint16_t last_avail_idx;
> > + bool avail_wrap_counter;
> > +};
>
> Should this belong to uAPI?
>
will change this
> > +
> > static inline struct vduse_dev *vdpa_to_vduse(struct vdpa_device *vdpa)
> > {
> > struct vduse_vdpa *vdev = container_of(vdpa, struct vduse_vdpa, vdpa);
> > @@ -1176,6 +1181,17 @@ static long vduse_dev_ioctl(struct file *file, unsigned int cmd,
> > vq->state.split.avail_index;
> >
> > vq_info.ready = vq->ready;
> > + struct vdpa_reconnect_info *area;
> > +
> > + area = &dev->reconnect_info[index];
> > + struct vhost_reconnect_vring *log_reconnect;
> > +
> > + log_reconnect = (struct vhost_reconnect_vring *)area->vaddr;
>
> What if userspace doesn't do mmap()?
>
> Thanks
>
sure will add the check for this
Thanks
Cindy
> > + if (log_reconnect->last_avail_idx !=
> > + vq_info.split.avail_index) {
> > + vq_info.split.avail_index =
> > + log_reconnect->last_avail_idx;
> > + }
> >
> > ret = -EFAULT;
> > if (copy_to_user(argp, &vq_info, sizeof(vq_info)))
> > --
> > 2.34.3
> >
>
Powered by blists - more mailing lists