> From: Michael S. Tsirkin <m...@redhat.com>
> Sent: Sunday, July 18, 2021 2:11 AM
> 
> On Sat, Jul 17, 2021 at 10:42:57AM +0300, Parav Pandit wrote:
> > VQs may be accessed to mark the device broken while they are
> > created/destroyed. Hence protect the access to the vqs list.
> >
> > Fixes: e2dcdfe95c0b ("virtio: virtio_break_device() to mark all
> > virtqueues broken.")
> > Signed-off-by: Parav Pandit <pa...@nvidia.com>
> > ---
> >  drivers/virtio/virtio.c      | 1 +
> >  drivers/virtio/virtio_ring.c | 8 ++++++++
> >  include/linux/virtio.h       | 1 +
> >  3 files changed, 10 insertions(+)
> >
> > diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c index
> > 4b15c00c0a0a..a0d81e35ec4b 100644
> > --- a/drivers/virtio/virtio.c
> > +++ b/drivers/virtio/virtio.c
> > @@ -355,6 +355,7 @@ int register_virtio_device(struct virtio_device *dev)
> >     virtio_add_status(dev, VIRTIO_CONFIG_S_ACKNOWLEDGE);
> >
> >     INIT_LIST_HEAD(&dev->vqs);
> > +   rwlock_init(&dev->vqs_list_lock);
> >
> >     /*
> >      * device_add() causes the bus infrastructure to look for a matching
> 
> Let's just use a simple spinlock. I don't think we are worried about scaling 
> the
> breaking of devices to multiple CPUs.
>
It wasn't the scaling, just wanted to have the clarity on list access. But I 
realized that rwlock is bigger size too.
So yeah, will simplify to spinlock in v2.

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

Reply via email to