diff options
author | Alexander Bulekov <alxndr@bu.edu> | 2023-04-27 17:10:09 -0400 |
---|---|---|
committer | Thomas Huth <thuth@redhat.com> | 2023-04-28 11:31:54 +0200 |
commit | f63192b0544af5d3e4d5edfd85ab520fcf671377 (patch) | |
tree | 64eab41f7be16e93518b18c885d7e082edec4f69 /hw/block | |
parent | ef56ffbdd6b0605dc1e305611287b948c970e236 (diff) | |
download | qemu-f63192b0544af5d3e4d5edfd85ab520fcf671377.zip qemu-f63192b0544af5d3e4d5edfd85ab520fcf671377.tar.gz qemu-f63192b0544af5d3e4d5edfd85ab520fcf671377.tar.bz2 |
hw: replace most qemu_bh_new calls with qemu_bh_new_guarded
This protects devices from bh->mmio reentrancy issues.
Thanks: Thomas Huth <thuth@redhat.com> for diagnosing OS X test failure.
Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Paul Durrant <paul@xen.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20230427211013.2994127-5-alxndr@bu.edu>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'hw/block')
-rw-r--r-- | hw/block/dataplane/virtio-blk.c | 3 | ||||
-rw-r--r-- | hw/block/dataplane/xen-block.c | 5 |
2 files changed, 5 insertions, 3 deletions
diff --git a/hw/block/dataplane/virtio-blk.c b/hw/block/dataplane/virtio-blk.c index b28d817..a620299 100644 --- a/hw/block/dataplane/virtio-blk.c +++ b/hw/block/dataplane/virtio-blk.c @@ -127,7 +127,8 @@ bool virtio_blk_data_plane_create(VirtIODevice *vdev, VirtIOBlkConf *conf, } else { s->ctx = qemu_get_aio_context(); } - s->bh = aio_bh_new(s->ctx, notify_guest_bh, s); + s->bh = aio_bh_new_guarded(s->ctx, notify_guest_bh, s, + &DEVICE(vdev)->mem_reentrancy_guard); s->batch_notify_vqs = bitmap_new(conf->num_queues); *dataplane = s; diff --git a/hw/block/dataplane/xen-block.c b/hw/block/dataplane/xen-block.c index 734da42..d8bc39d 100644 --- a/hw/block/dataplane/xen-block.c +++ b/hw/block/dataplane/xen-block.c @@ -633,8 +633,9 @@ XenBlockDataPlane *xen_block_dataplane_create(XenDevice *xendev, } else { dataplane->ctx = qemu_get_aio_context(); } - dataplane->bh = aio_bh_new(dataplane->ctx, xen_block_dataplane_bh, - dataplane); + dataplane->bh = aio_bh_new_guarded(dataplane->ctx, xen_block_dataplane_bh, + dataplane, + &DEVICE(xendev)->mem_reentrancy_guard); return dataplane; } |