Hi, This patch implements the second threading model. The first model can be referred here: http://www.mail-archive.com/qemu-devel@nongnu.org/msg43846.html
The features of the second threading model: * The VCPU thread runs the Qemu code until the first blocking call is encountered. * The work to be done in the blocking call is assigned to an asynchronous thread and the VCPU thread continues running the Qemu code. * If any blocking call is encountered by the asynchronous thread, it simply waits for the blocking call to finish and continues to run the succeeding part after that. * There is no constant context switching between the VCPU thread and the asynchronous thread. * The code flow is simple to understand when compared to the first threading model. I have run the following test to measure the performance: To test the v9fs_write call which is converted to the second threading model, I run X dd threads in parallel on the virtfs exported directory. The following is the command I use for running 2 dd threads in parallel: time dd if=/dev/zero of=null1 bs=4k count=1000 oflag=sync & time dd if=/dev/zero of=null1 bs=4k count=1000 oflag=sync Here is how the performance comparison between the original code, first threading model and second threading model looks like: 1 2 3 5 10 no threading: real time(s) 18.1 46.4 99.2 360.8 1518.6 system time(s) 18.0 38.3 66.8 211.7 551.6 throughput(kbps) 226 353 373 235 268 1st model: real time 18.8 48.6 77.7 164.5 451.3 system time 0.6 0.2 0.18 0.68 2.4 throughput 218 336 474 624 914 2nd model: real time 23.1 37.8 57.1 166.5 430 system time 0.9 1.8 0.24 0.7 3.0 throughput 177 432 430 611 940 This patchset needs to be applied on top of the threadlets infrastructure series available here: http://www.mail-archive.com/qemu-devel@nongnu.org/msg43842.html The following series implements... --- Sripathi Kodi (9): Add read-write lock to QEMU Introduce lock fid_list_lock to protect the fid list. Global rename lock Convert stat into 2nd threading model Convert wstat into 2nd threading model Convert open into 2nd threading model Convert walk into 2nd threading model Convert read into 2nd threading model Convert write into 2nd threading model. hw/virtio-9p.c | 950 +++++++++++++++++++++++--------------------------------- hw/virtio-9p.h | 27 ++ qemu-thread.c | 40 ++ qemu-thread.h | 10 + 4 files changed, 463 insertions(+), 564 deletions(-) -- arun