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<qinw...@redhat.com>
> > > Signed-off-by: Stefan Hajnoczi<stefa...@redhat.com>
> > A scsi thing that tree seems more appropriate.
> > 
> > Reviewed-by: Michael S. Tsirkin<m...@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

Attachment: signature.asc
Description: PGP signature

Reply via email to