]> git.karo-electronics.de Git - karo-tx-linux.git/commit
kvm tools: Introduce generic I/O thread pool
authorSasha Levin <levinsasha928@gmail.com>
Thu, 28 Apr 2011 13:40:42 +0000 (16:40 +0300)
committerPekka Enberg <penberg@kernel.org>
Thu, 28 Apr 2011 17:52:39 +0000 (20:52 +0300)
commit704c93e66523476aad99133e91d7cccbadfe6a43
treee47e31b71eeba6e5af4f08ad7f45afd14feb9ac2
parent6813209b5cc7ebe5ae501bd3a9e3dddeb6ad4f54
kvm tools: Introduce generic I/O thread pool

This patch adds a generic pool to create a common interface for working with
threads within the kvm tool. Main idea here is using this threadpool for all
I/O threads instead of having every I/O module write it's own thread code. The
process of working with the thread pool is supposed to be very simple.

During initialization, each module which is interested in working with the
threadpool will call threadpool__add_jobtype with the callback function and a
void* parameter. For example, virtio modules will register every virt_queue as
a new job type.  During operation, When theres work to do for a specific job,
the module will signal it to the queue and would expect the callback to be
called with proper parameters. It is assured that the callback will be called
once for every signal action and each callback will be called only once at a
time (i.e. callback functions themselves don't need to handle threading).

[ penberg@kernel.org: Use Lindent ]
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
tools/kvm/Makefile
tools/kvm/include/kvm/threadpool.h [new file with mode: 0644]
tools/kvm/kvm-run.c
tools/kvm/threadpool.c [new file with mode: 0644]