[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] virtio-scsi: fix race in virtio_scsi_dataplane_start()
From: |
Stefan Hajnoczi |
Subject: |
Re: [PATCH] virtio-scsi: fix race in virtio_scsi_dataplane_start() |
Date: |
Mon, 8 Aug 2022 12:01:12 -0400 |
On Fri, Aug 05, 2022 at 11:41:27AM +0200, Paolo Bonzini wrote:
> On 8/5/22 09:04, Michael S. Tsirkin wrote:
> > >
> > > Buglink:https://bugzilla.redhat.com/show_bug.cgi?id=2099541
> > > Reported-by: Qing Wang<qinwang@redhat.com>
> > > Signed-off-by: Stefan Hajnoczi<stefanha@redhat.com>
> > A scsi thing that tree seems more appropriate.
> >
> > Reviewed-by: Michael S. Tsirkin<mst@redhat.com>
> >
> >
> >
>
> Since the same thing has to be done in virtio-blk, any of the
> block/misc/virtio tree will do.
I don't think virtio-blk changes are required because it's already safe.
On the store side:
s->starting = false;
vblk->dataplane_started = true;
trace_virtio_blk_data_plane_start(s);
...
/* Get this show started by hooking up our callbacks */
aio_context_acquire(s->ctx);
^^^ implicit memory barrier ^^^
for (i = 0; i < nvqs; i++) {
VirtQueue *vq = virtio_get_queue(s->vdev, i);
virtio_queue_aio_attach_host_notifier(vq, s->ctx);
}
aio_context_release(s->ctx);
On the load side:
void aio_notify_accept(AioContext *ctx)
{
qatomic_set(&ctx->notified, false);
/*
* Write ctx->notified before reading e.g. bh->flags. Pairs with smp_wmb
* in aio_notify.
*/
smp_mb();
^^^^^^^^^
}
vblk->dataplane_started will be visible to the IOThread.
Stefan
signature.asc
Description: PGP signature
- [PATCH] virtio-scsi: fix race in virtio_scsi_dataplane_start(), Stefan Hajnoczi, 2022/08/03
- Re: [PATCH] virtio-scsi: fix race in virtio_scsi_dataplane_start(), Stefano Garzarella, 2022/08/04
- Re: [PATCH 7.1] virtio-scsi: fix race in virtio_scsi_dataplane_start(), Stefan Hajnoczi, 2022/08/04
- Re: [PATCH] virtio-scsi: fix race in virtio_scsi_dataplane_start(), Michael S. Tsirkin, 2022/08/05
- Re: [PATCH] virtio-scsi: fix race in virtio_scsi_dataplane_start(), Emanuele Giuseppe Esposito, 2022/08/05
- Re: [PATCH] virtio-scsi: fix race in virtio_scsi_dataplane_start(), Paolo Bonzini, 2022/08/05