kvm: run cpu state synchronization on target vcpu thread
As already done for kvm_cpu_synchronize_state(), let's trigger kvm_arch_put_registers() via run_on_cpu() for kvm_cpu_synchronize_post_reset() and kvm_cpu_synchronize_post_init(). This way, we make sure that the register synchronizing ioctls are called from the proper vcpu thread; this avoids calls to synchronize_rcu() in the kernel. Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
2656eb7c59
commit
c8e2085d8e
20
kvm-all.c
20
kvm-all.c
@ -1669,16 +1669,30 @@ void kvm_cpu_synchronize_state(CPUState *cpu)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void do_kvm_cpu_synchronize_post_reset(void *arg)
|
||||||
|
{
|
||||||
|
CPUState *cpu = arg;
|
||||||
|
|
||||||
|
kvm_arch_put_registers(cpu, KVM_PUT_RESET_STATE);
|
||||||
|
cpu->kvm_vcpu_dirty = false;
|
||||||
|
}
|
||||||
|
|
||||||
void kvm_cpu_synchronize_post_reset(CPUState *cpu)
|
void kvm_cpu_synchronize_post_reset(CPUState *cpu)
|
||||||
{
|
{
|
||||||
kvm_arch_put_registers(cpu, KVM_PUT_RESET_STATE);
|
run_on_cpu(cpu, do_kvm_cpu_synchronize_post_reset, cpu);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void do_kvm_cpu_synchronize_post_init(void *arg)
|
||||||
|
{
|
||||||
|
CPUState *cpu = arg;
|
||||||
|
|
||||||
|
kvm_arch_put_registers(cpu, KVM_PUT_FULL_STATE);
|
||||||
cpu->kvm_vcpu_dirty = false;
|
cpu->kvm_vcpu_dirty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void kvm_cpu_synchronize_post_init(CPUState *cpu)
|
void kvm_cpu_synchronize_post_init(CPUState *cpu)
|
||||||
{
|
{
|
||||||
kvm_arch_put_registers(cpu, KVM_PUT_FULL_STATE);
|
run_on_cpu(cpu, do_kvm_cpu_synchronize_post_init, cpu);
|
||||||
cpu->kvm_vcpu_dirty = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int kvm_cpu_exec(CPUState *cpu)
|
int kvm_cpu_exec(CPUState *cpu)
|
||||||
|
Loading…
Reference in New Issue
Block a user