From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44161) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WQvj9-0000mG-JF for qemu-devel@nongnu.org; Fri, 21 Mar 2014 05:27:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WQviw-0000OF-OX for qemu-devel@nongnu.org; Fri, 21 Mar 2014 05:26:59 -0400 Received: from e06smtp11.uk.ibm.com ([195.75.94.107]:35523) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WQviw-0000NM-FC for qemu-devel@nongnu.org; Fri, 21 Mar 2014 05:26:46 -0400 Received: from /spool/local by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 21 Mar 2014 09:26:44 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id 329C42190046 for ; Fri, 21 Mar 2014 09:26:37 +0000 (GMT) Received: from d06av11.portsmouth.uk.ibm.com (d06av11.portsmouth.uk.ibm.com [9.149.37.252]) by b06cxnps4074.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id s2L9QU7L60489908 for ; Fri, 21 Mar 2014 09:26:30 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 s2L9Qa2E013484 for ; Fri, 21 Mar 2014 03:26:36 -0600 Message-ID: <532C05CB.5010604@de.ibm.com> Date: Fri, 21 Mar 2014 10:26:35 +0100 From: Christian Borntraeger MIME-Version: 1.0 References: <1395079899-29239-1-git-send-email-cornelia.huck@de.ibm.com> <1395079899-29239-4-git-send-email-cornelia.huck@de.ibm.com> In-Reply-To: <1395079899-29239-4-git-send-email-cornelia.huck@de.ibm.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 3/5] KVM: s390: adapter interrupt sources List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Cornelia Huck , kvm@vger.kernel.org, linux-s390@vger.kernel.org, qemu-devel@nongnu.org Cc: gleb@kernel.org, pbonzini@redhat.com, agraf@suse.de On 17/03/14 19:11, Cornelia Huck wrote: > Add a new interface to register/deregister sources of adapter interrupts > identified by an unique id via the flic. Adapters may also be maskable > and carry a list of pinned pages. > > These adapters will be used by irq routing later. > > Signed-off-by: Cornelia Huck [...] > +static int kvm_s390_adapter_map(struct kvm *kvm, unsigned int id, __u64 addr) > +{ > + struct s390_io_adapter *adapter = get_io_adapter(kvm, id); > + struct s390_map_info *map; > + int ret; > + > + if (!adapter || !addr) > + return -EINVAL; > + > + map = kzalloc(sizeof(*map), GFP_KERNEL); > + if (!map) { > + ret = -ENOMEM; > + goto out; > + } > + INIT_LIST_HEAD(&map->list); > + map->addr = addr; > + ret = get_user_pages_fast(addr, 1, 1, &map->page); > + if (ret < 0) > + goto out; > + BUG_ON(ret != 1); > + down_write(&adapter->maps_lock); > + list_add_tail(&map->list, &adapter->maps); > + up_write(&adapter->maps_lock); > + ret = 0; Can you limit the amount of pinned pages to something sane, e.g. 1MB? As far as I can see, QEMU will fall back to non-irqfd if the mapping fails. Otherwise looks good. Acked-by: Christian Borntraeger