[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 4/4] dma-helpers: don't lock AioContext in dma_blk_cb()
|
From: |
Eric Blake |
|
Subject: |
Re: [PATCH 4/4] dma-helpers: don't lock AioContext in dma_blk_cb() |
|
Date: |
Mon, 27 Nov 2023 12:46:09 -0600 |
|
User-agent: |
NeoMutt/20231103 |
On Thu, Nov 23, 2023 at 02:49:31PM -0500, Stefan Hajnoczi wrote:
> Commit abfcd2760b3e ("dma-helpers: prevent dma_blk_cb() vs
> dma_aio_cancel() race") acquired the AioContext lock inside dma_blk_cb()
> to avoid a race with scsi_device_purge_requests() running in the main
> loop thread.
>
> The SCSI code no longer calls dma_aio_cancel() from the main loop thread
> while I/O is running in the IOThread AioContext. Therefore it is no
> longer necessary to take this lock to protect DMAAIOCB fields. The
> ->cb() function also does not require the lock because blk_aio_*() and
> friends do not need the AioContext lock.
>
> Both hw/ide/core.c and hw/ide/macio.c also call dma_blk_io() but don't
> rely on it taking the AioContext lock, so this change is safe.
>
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
> system/dma-helpers.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc.
Virtualization: qemu.org | libguestfs.org
- [PATCH 0/4] scsi: eliminate AioContext lock, Stefan Hajnoczi, 2023/11/23
- [PATCH 1/4] scsi: only access SCSIDevice->requests from one thread, Stefan Hajnoczi, 2023/11/23
- [PATCH 2/4] virtio-scsi: don't lock AioContext around virtio_queue_aio_attach_host_notifier(), Stefan Hajnoczi, 2023/11/23
- [PATCH 3/4] scsi: don't lock AioContext in I/O code path, Stefan Hajnoczi, 2023/11/23
- [PATCH 4/4] dma-helpers: don't lock AioContext in dma_blk_cb(), Stefan Hajnoczi, 2023/11/23
- Re: [PATCH 4/4] dma-helpers: don't lock AioContext in dma_blk_cb(),
Eric Blake <=
- Re: [PATCH 0/4] scsi: eliminate AioContext lock, Stefan Hajnoczi, 2023/11/23