lkml.org 
[lkml]   [2022]   [May]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH V5 7/9] virtio: allow to unbreak virtqueue
On Wed, May 18, 2022 at 6:04 PM Cornelia Huck <cohuck@redhat.com> wrote:
>
> On Wed, May 18 2022, Jason Wang <jasowang@redhat.com> wrote:
>
> > This patch allows the new introduced __virtio_break_device() to
> > unbreak the virtqueue.
> >
> > Cc: Thomas Gleixner <tglx@linutronix.de>
> > Cc: Peter Zijlstra <peterz@infradead.org>
> > Cc: "Paul E. McKenney" <paulmck@kernel.org>
> > Cc: Marc Zyngier <maz@kernel.org>
> > Cc: Halil Pasic <pasic@linux.ibm.com>
> > Cc: Cornelia Huck <cohuck@redhat.com>
> > Cc: Vineeth Vijayan <vneethv@linux.ibm.com>
> > Cc: Peter Oberparleiter <oberpar@linux.ibm.com>
> > Cc: linux-s390@vger.kernel.org
> > Signed-off-by: Jason Wang <jasowang@redhat.com>
> > ---
> > drivers/virtio/virtio_ring.c | 21 +++++++++++++++++++++
> > include/linux/virtio.h | 1 +
> > 2 files changed, 22 insertions(+)
> >
> > diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
> > index cfb028ca238e..5b7df7c455f0 100644
> > --- a/drivers/virtio/virtio_ring.c
> > +++ b/drivers/virtio/virtio_ring.c
> > @@ -2397,6 +2397,27 @@ void virtio_break_device(struct virtio_device *dev)
> > }
> > EXPORT_SYMBOL_GPL(virtio_break_device);
> >
> > +/*
> > + * This should allow the device to be used by the driver. You may
> > + * need to grab appropriate locks to flush. This should only be used
>
> Hm, to flush what?

How about "to flush the write to vq->broken"?

>
> > + * in some specific case e.g (probing and restoring). Driver should
> > + * not call this directly.
>
> Maybe "This function should only be called by the core, not directly by
> the driver."?

Ok.

Thanks

>
> > + */
> > +void __virtio_unbreak_device(struct virtio_device *dev)
> > +{
> > + struct virtqueue *_vq;
> > +
> > + spin_lock(&dev->vqs_list_lock);
> > + list_for_each_entry(_vq, &dev->vqs, list) {
> > + struct vring_virtqueue *vq = to_vvq(_vq);
> > +
> > + /* Pairs with READ_ONCE() in virtqueue_is_broken(). */
> > + WRITE_ONCE(vq->broken, false);
> > + }
> > + spin_unlock(&dev->vqs_list_lock);
> > +}
> > +EXPORT_SYMBOL_GPL(__virtio_unbreak_device);
> > +
> > dma_addr_t virtqueue_get_desc_addr(struct virtqueue *_vq)
> > {
> > struct vring_virtqueue *vq = to_vvq(_vq);
>

\
 
 \ /
  Last update: 2022-05-19 10:09    [W:0.120 / U:0.384 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site