From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37455) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XMG6g-00014g-J9 for qemu-devel@nongnu.org; Tue, 26 Aug 2014 08:44:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XMG6X-0000Hz-Hg for qemu-devel@nongnu.org; Tue, 26 Aug 2014 08:44:14 -0400 Received: from e06smtp13.uk.ibm.com ([195.75.94.109]:51892) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XMG6X-0000Hd-94 for qemu-devel@nongnu.org; Tue, 26 Aug 2014 08:44:05 -0400 Received: from /spool/local by e06smtp13.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 26 Aug 2014 13:44:02 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id EAE8417D804E for ; Tue, 26 Aug 2014 13:45:53 +0100 (BST) Received: from d06av11.portsmouth.uk.ibm.com (d06av11.portsmouth.uk.ibm.com [9.149.37.252]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id s7QChxvx33423526 for ; Tue, 26 Aug 2014 12:43:59 GMT Received: from d06av11.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av11.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s7QChwpN002140 for ; Tue, 26 Aug 2014 06:43:58 -0600 Message-ID: <53FC810E.3060605@de.ibm.com> Date: Tue, 26 Aug 2014 14:43:58 +0200 From: Christian Borntraeger MIME-Version: 1.0 References: <1408539325-7484-1-git-send-email-dahi@linux.vnet.ibm.com> In-Reply-To: <1408539325-7484-1-git-send-email-dahi@linux.vnet.ibm.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] kvm: run cpu state synchronization on target vcpu thread List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: David Hildenbrand , qemu-devel@nongnu.org Cc: cornelia.huck@de.ibm.com, pbonzini@redhat.com On 20/08/14 14:55, David Hildenbrand wrote: > 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 Acked-by: Christian Borntraeger Paolo, will you take that via the kvm tree? Otherwise I can queue that via the s390 tree together with the other patches that move our vcpu ioctls to the vcpu thread. I need your ACK in that case. Christian > --- > 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; >