Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1964449ybk; Thu, 21 May 2020 21:16:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzKzbYr6DpL10H+HCHULrVKcVFBYLcr9lArZMc9h2dJ4a2NXNR8BgIfylh6ujvH0UVARVrH X-Received: by 2002:a17:906:f8f:: with SMTP id q15mr6632995ejj.389.1590121013716; Thu, 21 May 2020 21:16:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590121013; cv=none; d=google.com; s=arc-20160816; b=jVsFU0JQ+lMLFvFYVzZrtefTxMauKVGa5LSHl9RC/SrTzEYITCMVN9pMB+J/rVHtm2 H0ju5WedsP69CSFxyQtkokxZi+NOJUEwHE8za0rN9PMAZ9PFAzC8oW3QVECJlyTocTm5 Lrdw2ZQ8X/XQ3Agvzcf13P3qFjMebqRUD5qfePL7xyfIDVXi+0Dp6HAQ7D8P4XDreP25 1qPlactd9JLLWtAjUVKzCCsA59xctMdJ+QfJvcaHtnHJNhoV4USKgGRpAaJ6V8Jv/d+d R4tkUTGp3UZlSUtklxVKt5ELbX6GaHFilJ8tIK2AsIJ3tb94TvOqsli3GkJqAAKvuz1r YNhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:dkim-signature:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=ouw78Ze34s++yvNZQkTG1iTTFB5/htkcycvRireHQNE=; b=mON9gzYDpqsiJ+zN6jMYBEFab0YgD46W72zxTKnExr3JNcfKNYsvbTiYfKzz7+BzQe UhmFZ57vrtR8p6Xh6uVCHVcqomtnKER1isi9rYDGC+airuJznXyKDejEnW3n6tsPVQRj O0b/FavCMY6jVGIHfIqPEnuc9AUGKj/dSNo2XvkVstquT7LeuFmhE4ivthvVe0xZ6STm V0UpSG61Qh2eKltYaltgdMli4UaJwV/suD7ZUBGKFa82/FRWLNe45SeuTWuZJD/pUbv3 GFmSwGucV1lXS0BNaPSTm6QwSHFYT/cX9n4wcchcuswsokVTYGy7JTi0pgL00jeLPMFb sn6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=AgGFJjlN; 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=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b19si4476744ejv.48.2020.05.21.21.16.30; Thu, 21 May 2020 21:16:53 -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=@nvidia.com header.s=n1 header.b=AgGFJjlN; 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=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728041AbgEVEPM (ORCPT + 99 others); Fri, 22 May 2020 00:15:12 -0400 Received: from hqnvemgate26.nvidia.com ([216.228.121.65]:3764 "EHLO hqnvemgate26.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727773AbgEVEPK (ORCPT ); Fri, 22 May 2020 00:15:10 -0400 Received: from hqpgpgate102.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate26.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Thu, 21 May 2020 21:14:57 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate102.nvidia.com (PGP Universal service); Thu, 21 May 2020 21:15:09 -0700 X-PGP-Universal: processed; by hqpgpgate102.nvidia.com on Thu, 21 May 2020 21:15:09 -0700 Received: from HQMAIL109.nvidia.com (172.20.187.15) by HQMAIL105.nvidia.com (172.20.187.12) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Fri, 22 May 2020 04:15:09 +0000 Received: from rnnvemgw01.nvidia.com (10.128.109.123) by HQMAIL109.nvidia.com (172.20.187.15) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Fri, 22 May 2020 04:15:09 +0000 Received: from sandstorm.nvidia.com (Not Verified[10.2.48.182]) by rnnvemgw01.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Thu, 21 May 2020 21:15:08 -0700 From: John Hubbard To: LKML CC: John Hubbard , Bartlomiej Zolnierkiewicz , Arnd Bergmann , Daniel Vetter , "Gustavo A . R . Silva" , Jani Nikula , , Subject: [PATCH 2/2] video: fbdev: convert get_user_pages() --> pin_user_pages() Date: Thu, 21 May 2020 21:15:06 -0700 Message-ID: <20200522041506.39638-3-jhubbard@nvidia.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200522041506.39638-1-jhubbard@nvidia.com> References: <20200522041506.39638-1-jhubbard@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public Content-Transfer-Encoding: quoted-printable Content-Type: text/plain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1590120897; bh=ouw78Ze34s++yvNZQkTG1iTTFB5/htkcycvRireHQNE=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:X-NVConfidentiality: Content-Transfer-Encoding:Content-Type; b=AgGFJjlNoGWVVjm8kijEcZNDXRlAEGwnJ4pgoR9yHJTI8Eu5TfiCKnOyH4M4UiFl2 rwAdWweoH98+1/VP6biU6pwSKe/QvY4tkRUMyyudd0YHhJRVB/e08Sx82h5jjuqfI8 +CTMa40jjdBVGbMAVJfcwD1r0Leb47iMx6RUkw/3wa9lf6D8NAt/YxvCHv4G1MQV55 AeuIPAk/Hc7ZOz6rS207GQ3hqv6NwYhL3VaPMFBDnTEYAjAcdBVTO2+pyA0TNlIP8Z YYn5USowgtaIC7x47L/2U602+QixoydX6hpANgsLVznr7YZBUZGvhPNG3cd1Ym3fXr jVTGx8EnBI9QA== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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/ Cc: Bartlomiej Zolnierkiewicz Cc: Arnd Bergmann Cc: Daniel Vetter Cc: Gustavo A. R. Silva Cc: Jani Nikula Cc: dri-devel@lists.freedesktop.org Cc: linux-fbdev@vger.kernel.org Signed-off-by: John Hubbard --- drivers/video/fbdev/pvr2fb.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/video/fbdev/pvr2fb.c b/drivers/video/fbdev/pvr2fb.c index ceb6ef590597..2d9f69b93392 100644 --- a/drivers/video/fbdev/pvr2fb.c +++ b/drivers/video/fbdev/pvr2fb.c @@ -652,7 +652,7 @@ static ssize_t pvr2fb_write(struct fb_info *info, const= char *buf, if (!pages) return -ENOMEM; =20 - ret =3D get_user_pages_fast((unsigned long)buf, nr_pages, FOLL_WRITE, pag= es); + ret =3D pin_user_pages_fast((unsigned long)buf, nr_pages, FOLL_WRITE, pag= es); if (ret < nr_pages) { if (ret < 0) { /* @@ -712,9 +712,7 @@ static ssize_t pvr2fb_write(struct fb_info *info, const= char *buf, ret =3D count; =20 out_unmap: - for (i =3D 0; i < nr_pages; i++) - put_page(pages[i]); - + unpin_user_pages(pages, nr_pages); kfree(pages); =20 return ret; --=20 2.26.2