Received: from eggs.gnu.org ([2001:4830:134:3::10]:41796) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZOnfT-0006oL-2b for qemu-devel@nongnu.org; Mon, 10 Aug 2015 10:03:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZOnfM-0007mG-LL for qemu-devel@nongnu.org; Mon, 10 Aug 2015 10:03:11 -0400 Received: from e06smtp14.uk.ibm.com ([195.75.94.110]:58045) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZOnfM-0007jd-Bo for qemu-devel@nongnu.org; Mon, 10 Aug 2015 10:03:04 -0400 Received: from /spool/local by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 10 Aug 2015 15:03:01 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id C8DBD1B0804B for ; Mon, 10 Aug 2015 15:04:23 +0100 (BST) Received: from d06av07.portsmouth.uk.ibm.com (d06av07.portsmouth.uk.ibm.com [9.149.37.248]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t7AE2wJN31916180 for ; Mon, 10 Aug 2015 14:02:58 GMT Received: from d06av07.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av07.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t7AE2wdr009653 for ; Mon, 10 Aug 2015 08:02:58 -0600 From: Jens Freimann Date: Mon, 10 Aug 2015 16:02:48 +0200 Message-Id: <1439215368-41167-1-git-send-email-jfrei@linux.vnet.ibm.com> Subject: [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: Christian Borntraeger , Alexander Graf , Cornelia Huck Cc: Paolo Bonzini , Jens Freimann , qemu-devel@nongnu.org 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. 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