From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44185) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZOnmO-0001B3-U8 for qemu-devel@nongnu.org; Mon, 10 Aug 2015 10:10:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZOnmI-0003X9-Kw for qemu-devel@nongnu.org; Mon, 10 Aug 2015 10:10:20 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56094) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZOnmI-0003Wx-Fl for qemu-devel@nongnu.org; Mon, 10 Aug 2015 10:10:14 -0400 References: <1439215368-41167-1-git-send-email-jfrei@linux.vnet.ibm.com> From: Paolo Bonzini Message-ID: <55C8B0C0.4080804@redhat.com> Date: Mon, 10 Aug 2015 16:10:08 +0200 MIME-Version: 1.0 In-Reply-To: <1439215368-41167-1-git-send-email-jfrei@linux.vnet.ibm.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [Patch] s390x/kvm: make setting of in-kernel irq routes more efficient List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jens Freimann , Christian Borntraeger , Alexander Graf , Cornelia Huck Cc: qemu-devel@nongnu.org On 10/08/2015 16:02, Jens Freimann wrote: > When we add new adapter routes we call kvm_irqchip_add_route() for every > virtqueue and in the same step also do the KVM_SET_GSI_ROUTING ioctl. > > This is unnecessary costly as the interface allows us to set multiple > routes in one go. Let's first add all routes to the table stored in the > global kvm_state and then do the ioctl to commit the routes to the > in-kernel irqchip. > > This saves us several ioctls to the kernel where for each call a list > is reallocated and populated. Acked-by: Paolo Bonzini but we should do the same for kvm_irqchip_add_msi_route as well. I'll prepare a patch. Paolo > Signed-off-by: Jens Freimann > Reviewed-by: David Hildenbrand > --- > hw/intc/s390_flic_kvm.c | 2 ++ > kvm-all.c | 1 - > 2 files changed, 2 insertions(+), 1 deletion(-) > > diff --git a/hw/intc/s390_flic_kvm.c b/hw/intc/s390_flic_kvm.c > index b471e7a..48714f9 100644 > --- a/hw/intc/s390_flic_kvm.c > +++ b/hw/intc/s390_flic_kvm.c > @@ -228,6 +228,8 @@ static int kvm_s390_add_adapter_routes(S390FLICState *fs, > routes->gsi[i] = ret; > routes->adapter.ind_offset++; > } > + kvm_irqchip_commit_routes(kvm_state); > + > /* Restore passed-in structure to original state. */ > routes->adapter.ind_offset = ind_offset; > return 0; > diff --git a/kvm-all.c b/kvm-all.c > index 06e06f2..c6f5128 100644 > --- a/kvm-all.c > +++ b/kvm-all.c > @@ -1293,7 +1293,6 @@ int kvm_irqchip_add_adapter_route(KVMState *s, AdapterInfo *adapter) > kroute.u.adapter.adapter_id = adapter->adapter_id; > > kvm_add_routing_entry(s, &kroute); > - kvm_irqchip_commit_routes(s); > > return virq; > } > -- 2.3.8