[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v5 05/21] virtio-scsi: stop using aio_disable_external() duri
From: |
Stefan Hajnoczi |
Subject: |
Re: [PATCH v5 05/21] virtio-scsi: stop using aio_disable_external() during unplug |
Date: |
Tue, 9 May 2023 16:43:32 -0400 |
On Tue, May 09, 2023 at 08:55:14PM +0200, Kevin Wolf wrote:
> Am 04.05.2023 um 21:53 hat Stefan Hajnoczi geschrieben:
> > This patch is part of an effort to remove the aio_disable_external()
> > API because it does not fit in a multi-queue block layer world where
> > many AioContexts may be submitting requests to the same disk.
> >
> > The SCSI emulation code is already in good shape to stop using
> > aio_disable_external(). It was only used by commit 9c5aad84da1c
> > ("virtio-scsi: fixed virtio_scsi_ctx_check failed when detaching scsi
> > disk") to ensure that virtio_scsi_hotunplug() works while the guest
> > driver is submitting I/O.
> >
> > Ensure virtio_scsi_hotunplug() is safe as follows:
> >
> > 1. qdev_simple_device_unplug_cb() -> qdev_unrealize() ->
> > device_set_realized() calls qatomic_set(&dev->realized, false) so
> > that future scsi_device_get() calls return NULL because they exclude
> > SCSIDevices with realized=false.
> >
> > That means virtio-scsi will reject new I/O requests to this
> > SCSIDevice with VIRTIO_SCSI_S_BAD_TARGET even while
> > virtio_scsi_hotunplug() is still executing. We are protected against
> > new requests!
> >
> > 2. scsi_device_unrealize() already contains a call to
>
> I think you mean scsi_qdev_unrealize(). Can be fixed while applying.
Yes, it should be scsi_qdev_unrealize(). I'll review your other comments
and fix this if I need to respin.
Stefan
signature.asc
Description: PGP signature
- [PATCH v5 00/21] block: remove aio_disable_external() API, Stefan Hajnoczi, 2023/05/04
- [PATCH v5 01/21] block: Fix use after free in blockdev_mark_auto_del(), Stefan Hajnoczi, 2023/05/04
- [PATCH v5 02/21] block-backend: split blk_do_set_aio_context(), Stefan Hajnoczi, 2023/05/04
- [PATCH v5 03/21] hw/qdev: introduce qdev_is_realized() helper, Stefan Hajnoczi, 2023/05/04
- [PATCH v5 04/21] virtio-scsi: avoid race between unplug and transport event, Stefan Hajnoczi, 2023/05/04
- [PATCH v5 05/21] virtio-scsi: stop using aio_disable_external() during unplug, Stefan Hajnoczi, 2023/05/04
- [PATCH v5 06/21] util/vhost-user-server: rename refcount to in_flight counter, Stefan Hajnoczi, 2023/05/04
- [PATCH v5 07/21] block/export: wait for vhost-user-blk requests when draining, Stefan Hajnoczi, 2023/05/04
- [PATCH v5 08/21] block/export: stop using is_external in vhost-user-blk server, Stefan Hajnoczi, 2023/05/04
- [PATCH v5 09/21] hw/xen: do not use aio_set_fd_handler(is_external=true) in xen_xenstore, Stefan Hajnoczi, 2023/05/04
- [PATCH v5 10/21] block: add blk_in_drain() API, Stefan Hajnoczi, 2023/05/04
- [PATCH v5 11/21] block: drain from main loop thread in bdrv_co_yield_to_drain(), Stefan Hajnoczi, 2023/05/04
- [PATCH v5 12/21] xen-block: implement BlockDevOps->drained_begin(), Stefan Hajnoczi, 2023/05/04
- [PATCH v5 14/21] block/export: rewrite vduse-blk drain code, Stefan Hajnoczi, 2023/05/04