Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3437856pxk; Mon, 21 Sep 2020 13:46:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy76ZKf3UATBVDQ+0zzmcvI7ra0vEfMrXGCXReQtXXPr/p0N3vcT83I2QxPWCjg9FdekRR8 X-Received: by 2002:a17:906:aecb:: with SMTP id me11mr1382011ejb.217.1600721218873; Mon, 21 Sep 2020 13:46:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600721218; cv=none; d=google.com; s=arc-20160816; b=xJNJRnJqFT1yMqjv8e6X7B1H1cQsInmuOxEC816dgmu1x/k4jbkvTUbIjd3XVFd76w m0SK32CJvFR7ucQoytubBc/DuyP60S0gFvAPQ9WQRa5hd/f1FgT2wTWlC5obN8GyM6+m LfeTwnwgeeYpTnpoLEAr5jcwj7W2ijRCGgD/p6asesw2Oned5nc0Acq93AldI4kzGUeE K8Y0kuyWrMoM/RyzX/3UxgzMT1VPfQsx9V9ltCOEptv3XAA2UVfdxSDVrc+GTk04U/ZC pT9yH2chiAsLKwv74w85PVwktOKH3xgkLw484Dyz2jpLKmr4fj6L/eJyzqXDQ02zgrl5 +U5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:organization :from:references:cc:to:subject:dkim-signature; bh=7ujMtTvfd+IOkCnn7iI/GoTDPJ8pxvj1u7VSyDhDIiE=; b=SH5jbUdx53YGuRKeB+At6WO0qRvh+WTeh2VYGPqYQjnfjffodj2COrZvJdyOON/5DH i1SBYG+gBpDbEn8PslvAkPj7EVakL/NqTS8pC0ZQ9UM0lR8Vui5a+H6vISm1Tc4U3amC xRd2BPfkJllZ/AoDo4isEEznYZt+VaZ7+q9NItYK6RiUOV2+EXGk7hUKF5BzVsV3Pjko OQWn2WXeMeMX/eagUX/YDsWn5tInF+mK03xdrZ+GBwAK9qmegLYxJZluNi7BJ+74zvLL oLhZLINiIHutUKuwBAlOZak5AjR946l5WJMszPPfPx3KlF5vJba5+CZPMILgIkYWtZsg yXrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=TgUfJcvq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q18si8910462eja.581.2020.09.21.13.46.35; Mon, 21 Sep 2020 13:46:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=TgUfJcvq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727285AbgIUUot (ORCPT + 99 others); Mon, 21 Sep 2020 16:44:49 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:37470 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726451AbgIUUot (ORCPT ); Mon, 21 Sep 2020 16:44:49 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 08LKdCRp085819; Mon, 21 Sep 2020 20:44:24 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=7ujMtTvfd+IOkCnn7iI/GoTDPJ8pxvj1u7VSyDhDIiE=; b=TgUfJcvqhnH4X5TErTOA7ctRXSXQGoVSuGYWQLux1TS6gP/EFUFQnZPW1RbI+0E3cL3B in/KONvWNSkpL0McwdWOCYcEE71inohanA9TuEaBwbVsC+zymxPchZWkmSx8xBtSpz45 n4nSBlQUHVmHXIe079bdqGiphbvhJyNT4NA7Zc1AGj/hU0sZ8Gjz7k8rSC1nxwxqxoDc M/3OmSs0Xen7YIDCD5IseKHAjxpvC1Wd93RKD+UTZE2zo/tF5x3Gs3ujB2MuqgPbpVVb G2l9kt0/DZBWdfye+7ecmzj4ylCxjUBE6JtHlfJDOmpinNW39aF0e9JhEBK/pXjcS2Z0 kg== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2120.oracle.com with ESMTP id 33n9xks3vf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 21 Sep 2020 20:44:24 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 08LKdmAx065052; Mon, 21 Sep 2020 20:44:24 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserp3020.oracle.com with ESMTP id 33nuw1usdt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 21 Sep 2020 20:44:24 +0000 Received: from abhmp0009.oracle.com (abhmp0009.oracle.com [141.146.116.15]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 08LKiFvM023808; Mon, 21 Sep 2020 20:44:20 GMT Received: from [10.74.86.189] (/10.74.86.189) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 21 Sep 2020 13:44:14 -0700 Subject: Re: [PATCH 6/6] x86/xen: open code alloc_vm_area in arch_gnttab_valloc To: Christoph Hellwig , Andrew Morton Cc: Peter Zijlstra , Juergen Gross , Stefano Stabellini , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Minchan Kim , Nitin Gupta , x86@kernel.org, xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-mm@kvack.org References: <20200918163724.2511-1-hch@lst.de> <20200918163724.2511-7-hch@lst.de> From: boris.ostrovsky@oracle.com Organization: Oracle Corporation Message-ID: <0833b9a8-5096-d105-a850-1336150eada1@oracle.com> Date: Mon, 21 Sep 2020 16:44:10 -0400 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.2.1 MIME-Version: 1.0 In-Reply-To: <20200918163724.2511-7-hch@lst.de> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Language: en-US X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9751 signatures=668679 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 phishscore=0 malwarescore=0 mlxscore=0 suspectscore=2 adultscore=0 mlxlogscore=999 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2009210152 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9751 signatures=668679 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 malwarescore=0 suspectscore=2 priorityscore=1501 adultscore=0 spamscore=0 clxscore=1011 mlxlogscore=999 bulkscore=0 mlxscore=0 phishscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2009210152 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 9/18/20 12:37 PM, Christoph Hellwig wrote: > > +static int gnttab_apply(pte_t *pte, unsigned long addr, void *data) > +{ > + pte_t ***p = data; > + > + **p = pte; > + (*p)++; > + return 0; > +} > + > static int arch_gnttab_valloc(struct gnttab_vm_area *area, unsigned nr_frames) > { > area->ptes = kmalloc_array(nr_frames, sizeof(*area->ptes), GFP_KERNEL); > if (area->ptes == NULL) > return -ENOMEM; > - > - area->area = alloc_vm_area(PAGE_SIZE * nr_frames, area->ptes); > - if (area->area == NULL) { > - kfree(area->ptes); > - return -ENOMEM; > - } > - > + area->area = get_vm_area(PAGE_SIZE * nr_frames, VM_IOREMAP); > + if (!area->area) > + goto out_free_ptes; > + if (apply_to_page_range(&init_mm, (unsigned long)area->area->addr, > + PAGE_SIZE * nr_frames, gnttab_apply, &area->ptes)) This will end up incrementing area->ptes pointer. So perhaps something like pte_t **ptes = area->ptes; if (apply_to_page_range(&init_mm, (unsigned long)area->area->addr,                         PAGE_SIZE * nr_frames, gnttab_apply, &ptes)) {        ... } -boris