To make use of all the host CPU cores I'm thinking of adding thread support to Qemu. The idea so far is to create one thread for each virtual CPU, and then run a modified main_loop in each of these threads. The first step would be to rewrite all the global variables like first_cpu etc to make it more thread friendly, and make that run in the current non-threaded version.
Any hints or tips that I should keep in mind when attempting this? Has thread support been worked on before but not completed?