|
@@ -5,7 +5,7 @@ the COPYING file in the top-level directory.
|
|
|
|
|
|
|
|
|
This document explains the IOThread feature and how to write code that runs
|
|
|
-outside the QEMU global mutex.
|
|
|
+outside the BQL.
|
|
|
|
|
|
The main loop and IOThreads
|
|
|
---------------------------
|
|
@@ -29,13 +29,13 @@ scalability bottleneck on hosts with many CPUs. Work can be spread across
|
|
|
several IOThreads instead of just one main loop. When set up correctly this
|
|
|
can improve I/O latency and reduce jitter seen by the guest.
|
|
|
|
|
|
-The main loop is also deeply associated with the QEMU global mutex, which is a
|
|
|
-scalability bottleneck in itself. vCPU threads and the main loop use the QEMU
|
|
|
-global mutex to serialize execution of QEMU code. This mutex is necessary
|
|
|
-because a lot of QEMU's code historically was not thread-safe.
|
|
|
+The main loop is also deeply associated with the BQL, which is a
|
|
|
+scalability bottleneck in itself. vCPU threads and the main loop use the BQL
|
|
|
+to serialize execution of QEMU code. This mutex is necessary because a lot of
|
|
|
+QEMU's code historically was not thread-safe.
|
|
|
|
|
|
The fact that all I/O processing is done in a single main loop and that the
|
|
|
-QEMU global mutex is contended by all vCPU threads and the main loop explain
|
|
|
+BQL is contended by all vCPU threads and the main loop explain
|
|
|
why it is desirable to place work into IOThreads.
|
|
|
|
|
|
The experimental virtio-blk data-plane implementation has been benchmarked and
|
|
@@ -66,7 +66,7 @@ There are several old APIs that use the main loop AioContext:
|
|
|
|
|
|
Since they implicitly work on the main loop they cannot be used in code that
|
|
|
runs in an IOThread. They might cause a crash or deadlock if called from an
|
|
|
-IOThread since the QEMU global mutex is not held.
|
|
|
+IOThread since the BQL is not held.
|
|
|
|
|
|
Instead, use the AioContext functions directly (see include/block/aio.h):
|
|
|
* aio_set_fd_handler() - monitor a file descriptor
|