This patch provides a cpu_set variable to vcpu_info structure. It stores the current cpu mask for a thread.
We also provide a wrapper for storing a provided affinity, and a function to set default affinities: The default affinities are current process' Signed-off-by: Glauber Costa <[EMAIL PROTECTED]> --- qemu/qemu-kvm.c | 17 +++++++++++++++++ 1 files changed, 17 insertions(+), 0 deletions(-) diff --git a/qemu/qemu-kvm.c b/qemu/qemu-kvm.c index 1aeb97b..a36fbf6 100644 --- a/qemu/qemu-kvm.c +++ b/qemu/qemu-kvm.c @@ -49,8 +49,25 @@ struct vcpu_info { int stop; int stopped; int thread_id; + cpu_set_t cpu_set; } vcpu_info[256]; +void kvm_store_cpu_affinity(int cpu, cpu_set_t *map) +{ + memcpy(&vcpu_info[cpu].cpu_set, map, sizeof(*map)); +} + +void kvm_register_default_affinities(void) +{ + int i; + cpu_set_t dfl; + sched_getaffinity(0, sizeof(dfl), &dfl); + + for (i = 0; i < 256; i++) { + memcpy(&vcpu_info[i].cpu_set, &dfl, sizeof(dfl)); + } +} + static inline unsigned long kvm_get_thread_id(void) { return syscall(SYS_gettid); -- 1.5.0.6 ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel