--- kvm-28/kernel/svm.c 2007-06-10 11:54:27.000000000 +0200 +++ kvm-28-preempt/kernel/svm.c 2007-06-20 13:03:38.000000000 +0200 @@ -612,9 +612,17 @@ static void svm_vcpu_load(struct kvm_vcpu *vcpu) { - int cpu, i; + int i; + int cpu = raw_smp_processor_id(); + cpumask_t this_mask = cpumask_of_cpu(cpu); - cpu = get_cpu(); + /* + * Keep the context preemptible, but do not migrate + * away to another CPU. TODO: make sure this persists. + * Save/restore original mask. + */ + if (unlikely(!cpus_equal(current->cpus_allowed, this_mask))) + set_cpus_allowed(current, cpumask_of_cpu(cpu)); if (unlikely(cpu != vcpu->cpu)) { u64 tsc_this, delta;