diff options
author | Alexander Bulekov <alxndr@bu.edu> | 2023-04-27 17:10:07 -0400 |
---|---|---|
committer | Thomas Huth <thuth@redhat.com> | 2023-04-28 11:31:07 +0200 |
commit | 9c86c97f12c060bf7484dd931f38634e166a81f0 (patch) | |
tree | b3e82f9abe80c39166b4880f0405b0785ba731a5 /include/qemu | |
parent | a2e1753b8054344f32cf94f31c6399a58794a380 (diff) | |
download | qemu-9c86c97f12c060bf7484dd931f38634e166a81f0.zip qemu-9c86c97f12c060bf7484dd931f38634e166a81f0.tar.gz qemu-9c86c97f12c060bf7484dd931f38634e166a81f0.tar.bz2 |
async: Add an optional reentrancy guard to the BH API
Devices can pass their MemoryReentrancyGuard (from their DeviceState),
when creating new BHes. Then, the async API will toggle the guard
before/after calling the BH call-back. This prevents bh->mmio reentrancy
issues.
Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
Message-Id: <20230427211013.2994127-3-alxndr@bu.edu>
[thuth: Fix "line over 90 characters" checkpatch.pl error]
Signed-off-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'include/qemu')
-rw-r--r-- | include/qemu/main-loop.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/include/qemu/main-loop.h b/include/qemu/main-loop.h index b3e54e0..68e70e6 100644 --- a/include/qemu/main-loop.h +++ b/include/qemu/main-loop.h @@ -387,9 +387,12 @@ void qemu_cond_timedwait_iothread(QemuCond *cond, int ms); /* internal interfaces */ +#define qemu_bh_new_guarded(cb, opaque, guard) \ + qemu_bh_new_full((cb), (opaque), (stringify(cb)), guard) #define qemu_bh_new(cb, opaque) \ - qemu_bh_new_full((cb), (opaque), (stringify(cb))) -QEMUBH *qemu_bh_new_full(QEMUBHFunc *cb, void *opaque, const char *name); + qemu_bh_new_full((cb), (opaque), (stringify(cb)), NULL) +QEMUBH *qemu_bh_new_full(QEMUBHFunc *cb, void *opaque, const char *name, + MemReentrancyGuard *reentrancy_guard); void qemu_bh_schedule_idle(QEMUBH *bh); enum { |