From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58375) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XN0OJ-0000n2-2T for qemu-devel@nongnu.org; Thu, 28 Aug 2014 10:09:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XN0OA-00015s-1P for qemu-devel@nongnu.org; Thu, 28 Aug 2014 10:09:31 -0400 Received: from mail-wg0-x230.google.com ([2a00:1450:400c:c00::230]:65256) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XN0O9-00015j-GB for qemu-devel@nongnu.org; Thu, 28 Aug 2014 10:09:21 -0400 Received: by mail-wg0-f48.google.com with SMTP id n12so812507wgh.7 for ; Thu, 28 Aug 2014 07:09:20 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Thu, 28 Aug 2014 16:09:00 +0200 Message-Id: <1409234953-20742-2-git-send-email-pbonzini@redhat.com> In-Reply-To: <1409234953-20742-1-git-send-email-pbonzini@redhat.com> References: <1409234953-20742-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PULL 01/14] kvm: run cpu state synchronization on target vcpu thread List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: David Hildenbrand From: David Hildenbrand 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 Signed-off-by: David Hildenbrand Signed-off-by: Paolo Bonzini --- kvm-all.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/kvm-all.c b/kvm-all.c index 1402f4f..b240bf8 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -1669,18 +1669,32 @@ void kvm_cpu_synchronize_state(CPUState *cpu) } } -void kvm_cpu_synchronize_post_reset(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_init(CPUState *cpu) +void kvm_cpu_synchronize_post_reset(CPUState *cpu) +{ + 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; } +void kvm_cpu_synchronize_post_init(CPUState *cpu) +{ + run_on_cpu(cpu, do_kvm_cpu_synchronize_post_init, cpu); +} + int kvm_cpu_exec(CPUState *cpu) { struct kvm_run *run = cpu->kvm_run; -- 1.8.3.1