[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1646817926.9029093-7-xuanzhuo@linux.alibaba.com>
Date: Wed, 9 Mar 2022 17:25:26 +0800
From: Xuan Zhuo <xuanzhuo@...ux.alibaba.com>
To: Jason Wang <jasowang@...hat.com>
Cc: Jeff Dike <jdike@...toit.com>, Richard Weinberger <richard@....at>,
Anton Ivanov <anton.ivanov@...bridgegreys.com>,
"Michael S. Tsirkin" <mst@...hat.com>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Hans de Goede <hdegoede@...hat.com>,
Mark Gross <markgross@...nel.org>,
Vadim Pasternak <vadimp@...dia.com>,
Bjorn Andersson <bjorn.andersson@...aro.org>,
Mathieu Poirier <mathieu.poirier@...aro.org>,
Cornelia Huck <cohuck@...hat.com>,
Halil Pasic <pasic@...ux.ibm.com>,
Heiko Carstens <hca@...ux.ibm.com>,
Vasily Gorbik <gor@...ux.ibm.com>,
Christian Borntraeger <borntraeger@...ux.ibm.com>,
Alexander Gordeev <agordeev@...ux.ibm.com>,
Sven Schnelle <svens@...ux.ibm.com>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Jesper Dangaard Brouer <hawk@...nel.org>,
John Fastabend <john.fastabend@...il.com>,
Johannes Berg <johannes.berg@...el.com>,
Vincent Whitchurch <vincent.whitchurch@...s.com>,
linux-um@...ts.infradead.org, platform-driver-x86@...r.kernel.org,
linux-remoteproc@...r.kernel.org, linux-s390@...r.kernel.org,
kvm@...r.kernel.org, bpf@...r.kernel.org,
virtualization@...ts.linux-foundation.org, netdev@...r.kernel.org
Subject: Re: [PATCH v7 13/26] virtio: queue_reset: struct virtio_config_ops add callbacks for queue_reset
On Wed, 9 Mar 2022 16:47:11 +0800, Jason Wang <jasowang@...hat.com> wrote:
>
> 在 2022/3/8 下午8:35, Xuan Zhuo 写道:
> > Performing reset on a queue is divided into four steps:
> >
> > 1. reset_vq() - notify the device to reset the queue
> > 2. virtqueue_detach_unused_buf() - recycle the buffer submitted
> > 3. virtqueue_reset_vring() - reset the vring (may re-alloc)
> > 4. enable_reset_vq() - mmap vring to device, and enable the queue
> >
> > So add two callbacks reset_vq, enable_reset_vq to struct
> > virtio_config_ops.
> >
> > Signed-off-by: Xuan Zhuo <xuanzhuo@...ux.alibaba.com>
> > ---
> > include/linux/virtio_config.h | 11 +++++++++++
> > 1 file changed, 11 insertions(+)
> >
> > diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h
> > index 4d107ad31149..d51906b1389f 100644
> > --- a/include/linux/virtio_config.h
> > +++ b/include/linux/virtio_config.h
> > @@ -74,6 +74,15 @@ struct virtio_shm_region {
> > * @set_vq_affinity: set the affinity for a virtqueue (optional).
> > * @get_vq_affinity: get the affinity for a virtqueue (optional).
> > * @get_shm_region: get a shared memory region based on the index.
> > + * @reset_vq: reset a queue individually (optional).
> > + * vq: the virtqueue
> > + * Returns 0 on success or error status
> > + * Caller should guarantee that the vring is not accessed by any functions
> > + * of virtqueue.
>
>
> We probably need to be more accurate here:
>
> 1) reset_vq will guarantee that the callbacks are disabled or synchronized
> 2) except for the callback, the caller should guarantee ...
OK.
Thanks.
>
> Thanks
>
>
> > + * @enable_reset_vq: enable a reset queue
> > + * vq: the virtqueue
> > + * Returns 0 on success or error status
> > + * If reset_vq is set, then enable_reset_vq must also be set.
> > */
> > typedef void vq_callback_t(struct virtqueue *);
> > struct virtio_config_ops {
> > @@ -100,6 +109,8 @@ struct virtio_config_ops {
> > int index);
> > bool (*get_shm_region)(struct virtio_device *vdev,
> > struct virtio_shm_region *region, u8 id);
> > + int (*reset_vq)(struct virtqueue *vq);
> > + int (*enable_reset_vq)(struct virtqueue *vq);
> > };
> >
> > /* If driver didn't advertise the feature, it will never appear. */
>
Powered by blists - more mailing lists