[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v4 18/20] virtio-scsi: implement BlockDevOps->drained_begin()
From: |
Kevin Wolf |
Subject: |
Re: [PATCH v4 18/20] virtio-scsi: implement BlockDevOps->drained_begin() |
Date: |
Thu, 4 May 2023 23:25:17 +0200 |
Am 25.04.2023 um 19:27 hat Stefan Hajnoczi geschrieben:
> The virtio-scsi Host Bus Adapter provides access to devices on a SCSI
> bus. Those SCSI devices typically have a BlockBackend. When the
> BlockBackend enters a drained section, the SCSI device must temporarily
> stop submitting new I/O requests.
>
> Implement this behavior by temporarily stopping virtio-scsi virtqueue
> processing when one of the SCSI devices enters a drained section. The
> new scsi_device_drained_begin() API allows scsi-disk to message the
> virtio-scsi HBA.
>
> scsi_device_drained_begin() uses a drain counter so that multiple SCSI
> devices can have overlapping drained sections. The HBA only sees one
> pair of .drained_begin/end() calls.
>
> After this commit, virtio-scsi no longer depends on hw/virtio's
> ioeventfd aio_set_event_notifier(is_external=true). This commit is a
> step towards removing the aio_disable_external() API.
>
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> @@ -206,9 +208,11 @@ void virtio_scsi_dataplane_stop(VirtIODevice *vdev)
> }
> s->dataplane_stopping = true;
>
> - aio_context_acquire(s->ctx);
> - aio_wait_bh_oneshot(s->ctx, virtio_scsi_dataplane_stop_bh, s);
> - aio_context_release(s->ctx);
> + if (s->bus.drain_count == 0) {
> + aio_context_acquire(s->ctx);
> + aio_wait_bh_oneshot(s->ctx, virtio_scsi_dataplane_stop_bh, s);
> + aio_context_release(s->ctx);
> + }
Same question as for virtio-blk: We lose processing the virtqueue one
last time during drain. Is it okay, and if so, why do we need it outside
of drain?
Kevin
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [PATCH v4 18/20] virtio-scsi: implement BlockDevOps->drained_begin(),
Kevin Wolf <=