Skip to content

RFC Second threading model.

Arun R Bharadwaj qemu-devel 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest9 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/9Add read-write lock to QEMUqemu-thread.c qemu-thread.h+50 -00 replies
2/9Introduce lock fid_list_lock to protect the fid list.hw/virtio-9p.c hw/virtio-9p.h+31 -30 replies
3/9Global rename lockhw/virtio-9p.c+3 -00 replies
4/9Convert stat into 2nd threading modelhw/virtio-9p.c hw/virtio-9p.h+37 -250 replies
5/9Convert wstat into 2nd threading modelhw/virtio-9p.c hw/virtio-9p.h+94 -1480 replies
6/9Convert open into 2nd threading modelhw/virtio-9p.c hw/virtio-9p.h+51 -680 replies
7/9Convert walk into 2nd threading modelhw/virtio-9p.c hw/virtio-9p.h+68 -980 replies
8/9Convert read into 2nd threading modelhw/virtio-9p.c hw/virtio-9p.h+91 -1660 replies
9/9Convert write into 2nd threading model.hw/virtio-9p.c hw/virtio-9p.h+39 -570 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [Qemu-devel] [RFC PATCH 0/9] Second threading model.

Hi,

This patch implements the second threading model. The first model can be referred here:
http://www.mail-archive.com/[email protected]/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/[email protected]/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(-)
Signature · 1 line
arun