Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1564862ybt; Thu, 18 Jun 2020 11:37:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwNYZqkIqYvj04YgpPFawwTfMAHQFsApzr+PE548lZF1AYaL4ebF4qmrdeCrtCQEjZsM7Pc X-Received: by 2002:a17:906:6888:: with SMTP id n8mr12786ejr.159.1592505429303; Thu, 18 Jun 2020 11:37:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592505429; cv=none; d=google.com; s=arc-20160816; b=pwQdLRPxCAjo21dnBskMnH2g9mUeVDpx68DxKGJtRciqxyfDdyj6a3Uokkn68uE/bz krZ9hPFEpGRKE+8gtmoYPlKuEz7n04EhgeAZ2jvyvhhVBmq/H7QKzUZQaRo8S24WxIH1 kKChICEG2sYC7RHaklHSuG1qcq2kC9ZrmgD4a8xkJVAhGzf8QlWGqk8vnxRbxqKpYrUr 69jbRGfFqABXvCz1MpMZkZ5/wt4riwSdtWv4NgskgYqNpBTDgLKxRIGouNjWfFnGL2aq xm5ONPZhKXRzXlPxqn6z44Wg+cJOilqdY+ec8jwjpYeWjTejAtqXmnbNFmdm9Fa+R1xS X/1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=aB+Gq56Fsma8uc6u/IviNqrrm61faD+FzNEzXnmdRKo=; b=z1AZIVlpVwvloC5OCODkOUdZ41aECETCNIDIdOYVYTC+KpMy/6i1flWIv6i6tIiexF ZhGPoL9epz9/8z5dZ58Jv0xPgHygkXkesORz23cHa1ksqt7/C7hBv63ajht4BLU4phwa +65q831KK3uSyRfliLxlXGCMD28BI3joNCfJO85X2+s0FuleqBMa60ZoFx10PH1jGTZ7 Hkyy4ikc+aCb6m8ucYkZ0WAUbV7dpVdo9FFo4dGhlSdimBLTN0zX4lvNRRAgE0GQP/Z2 Mpg+zuF4zyogyDtmq013p2Ij/P2UPGfEDE2BgcEftNhppW0KaAcZKtkc0BWvRb53vFtk PMTw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f6si2364083ejf.208.2020.06.18.11.36.46; Thu, 18 Jun 2020 11:37:09 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729009AbgFRPvt (ORCPT + 99 others); Thu, 18 Jun 2020 11:51:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728244AbgFRPvq (ORCPT ); Thu, 18 Jun 2020 11:51:46 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC243C06174E for ; Thu, 18 Jun 2020 08:51:45 -0700 (PDT) Received: from gallifrey.ext.pengutronix.de ([2001:67c:670:201:5054:ff:fe8d:eefb] helo=localhost) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jlwpE-0005mk-KY; Thu, 18 Jun 2020 17:51:36 +0200 Message-ID: Subject: Re: [PATCH v2] drm/etnaviv: convert get_user_pages() --> pin_user_pages() From: Lucas Stach To: John Hubbard Cc: David Airlie , etnaviv@lists.freedesktop.org, dri-devel@lists.freedesktop.org, LKML , Christian Gmeiner , Daniel Vetter , Russell King Date: Thu, 18 Jun 2020 17:51:34 +0200 In-Reply-To: <20200525234946.512848-1-jhubbard@nvidia.com> References: <20200525234946.512848-1-jhubbard@nvidia.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.2 (3.36.2-1.fc32) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 2001:67c:670:201:5054:ff:fe8d:eefb X-SA-Exim-Mail-From: l.stach@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am Montag, den 25.05.2020, 16:49 -0700 schrieb John Hubbard: > This code was using get_user_pages*(), in a "Case 2" scenario > (DMA/RDMA), using the categorization from [1]. That means that it's > time to convert the get_user_pages*() + put_page() calls to > pin_user_pages*() + unpin_user_pages() calls. > > There is some helpful background in [2]: basically, this is a small > part of fixing a long-standing disconnect between pinning pages, and > file systems' use of those pages. > > [1] Documentation/core-api/pin_user_pages.rst > > [2] "Explicit pinning of user-space pages": > https://lwn.net/Articles/807108/ > > Signed-off-by: John Hubbard Thanks, I've applied this to etnaviv/next. Regards, Lucas > --- > > Hi, > > Changes since v1: > > * Rebased onto Linux 5.7-rc7 > > * Added: Lucas Stach > > thanks > John Hubbard > NVIDIA > > > drivers/gpu/drm/etnaviv/etnaviv_gem.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem.c b/drivers/gpu/drm/etnaviv/etnaviv_gem.c > index dc9ef302f517..0f4578dc169d 100644 > --- a/drivers/gpu/drm/etnaviv/etnaviv_gem.c > +++ b/drivers/gpu/drm/etnaviv/etnaviv_gem.c > @@ -675,10 +675,10 @@ static int etnaviv_gem_userptr_get_pages(struct etnaviv_gem_object *etnaviv_obj) > uint64_t ptr = userptr->ptr + pinned * PAGE_SIZE; > struct page **pages = pvec + pinned; > > - ret = get_user_pages_fast(ptr, num_pages, > + ret = pin_user_pages_fast(ptr, num_pages, > !userptr->ro ? FOLL_WRITE : 0, pages); > if (ret < 0) { > - release_pages(pvec, pinned); > + unpin_user_pages(pvec, pinned); > kvfree(pvec); > return ret; > } > @@ -702,7 +702,7 @@ static void etnaviv_gem_userptr_release(struct etnaviv_gem_object *etnaviv_obj) > if (etnaviv_obj->pages) { > int npages = etnaviv_obj->base.size >> PAGE_SHIFT; > > - release_pages(etnaviv_obj->pages, npages); > + unpin_user_pages(etnaviv_obj->pages, npages); > kvfree(etnaviv_obj->pages); > } > }