2 ms·
Rather that adding more fine grained locking, would there have been another way? In particular I wonder of the problem domain of QEmu could have benefited from
by geertj 3y ago
Rather that adding more fine grained locking, would there have been another way? In particular I wonder of the problem domain of QEmu could have benefited from a thread per core architecture. Do guest OSs try to pin high tps devices to singular cores these days, and if so could than provide a natural way to shard the IO workload?
- stefanha 3y agoI didn't go into the various ways in which AioContext lock was replaced in the article. You're right, sometimes new fine-grained locks weren't necessary. When there is really only one thread accessing some data then locking isn't needed. That's what was done for the SCSI emulation layer where request processing only happens in 1 thread. Here is a new function that was introduced to schedule work on the thread that runs SCSI emulation (a rare operation that is not performance critical and allows the rest of the code to avoid locks): https://gitlab.com/qemu-project/qemu/-/blob/master/hw/scsi/scsi-bus.c?ref_type=heads#L147 https://gitlab.com/qemu-project/qemu/-/blob/master/hw/scsi/s... QEMU's IOThreads allow the user to configure the threads and get something similar to thread per core architecture. But if 1 thread becomes a bottleneck, then some form of thread synchronization is needed again even with thread per core architecture. Some problems can be parallelized and they work well with thread per core.