]> git.proxmox.com Git - mirror_qemu.git/commit
dma-helpers: don't lock AioContext in dma_blk_cb()
authorStefan Hajnoczi <stefanha@redhat.com>
Mon, 4 Dec 2023 16:42:59 +0000 (11:42 -0500)
committerKevin Wolf <kwolf@redhat.com>
Thu, 21 Dec 2023 21:49:27 +0000 (22:49 +0100)
commite661a2470342d6fa873369c81988a19b1bb7b3f4
treec77ddbbd38171b60c3b6fadebd9a5c6942b99f2f
parent14042268045596a89f3fae3606389536d4784113
dma-helpers: don't lock AioContext in dma_blk_cb()

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>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Message-ID: <20231204164259.1515217-5-stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
system/dma-helpers.c