Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp5170395ybh; Wed, 7 Aug 2019 01:51:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqyS/nfSXLy3QPbveM2D6hLN4GPiM7TblTOl18+Mqt/cJozitHSZ/36jAVSWzJEtyVHanCDm X-Received: by 2002:a17:902:8c98:: with SMTP id t24mr7308964plo.320.1565167913766; Wed, 07 Aug 2019 01:51:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565167913; cv=none; d=google.com; s=arc-20160816; b=AIFH0/nesjL+biRNuGkPsqgtW62EmvVQP8lCtYxGv48a9TZ/L33hWlDo1DlWgqduD9 8X1R7lyNf5lr86wWFRMPegzbFc5AmEvQm/K4+rLMwB+o8OD+g1JROMaKdklLKhFeF507 iHH/jZTKUR4Yc8Hnd+8MvnDowoKY2fxESv3Hy9af7cBCAvRxPXvkhHtwD4FSLWDeh7Z2 /uOLA07FxahN+QeaQspl8O4oIZwGgPOBI3kkl0JU9p6/iDkymyjUCdsocXCNxRrqfM/S 8CW8mAaYX7apVL9XSqscRdyE1E6NbxcL7y6Tkli5PmS32/Fldp+oR+8NhB/E/3g4lbuu BTZA== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=2OxrDQPAfwauhFuKeV7UkqdJcLMup2CsBtU+uh7V4DQ=; b=kqionN9sRJO4UPdN5FhfpZ0av0zTR3Goc7xjJZ2Rtl+0KWTzwV2EXQEYAVeyULQ1ts pCKhGQ8+lcKNehPPptHrylC0eLa/LZQeZ1EeCsgpxQu2z9O3C05Og+rCtOJOzswXSOTD m47jG8Tvj+sAgg0HNSr4zX+eTNDpcig9rT2D+MbX6gToRmncibjmbQeaTMMU1bEpGmQH HeIHpn3oem4rZjRcxsD+lvdxzbVRrC+4/ZBTFPmQsSSwTyTaghsYvruzPgL9W+pPsJmk HsXlb0EtTH4t/zym19f+JET/yDpmx7f/4EJpsVd+fYMKhfh83mLPPstaOZIKIw79J5jK NZbg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a1si15849697pjs.58.2019.08.07.01.51.39; Wed, 07 Aug 2019 01:51:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728953AbfHGIvZ (ORCPT + 99 others); Wed, 7 Aug 2019 04:51:25 -0400 Received: from lb2-smtp-cloud9.xs4all.net ([194.109.24.26]:52855 "EHLO lb2-smtp-cloud9.xs4all.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726747AbfHGIvY (ORCPT ); Wed, 7 Aug 2019 04:51:24 -0400 Received: from [IPv6:2001:983:e9a7:1:9c05:4bbc:890e:7747] ([IPv6:2001:983:e9a7:1:9c05:4bbc:890e:7747]) by smtp-cloud9.xs4all.net with ESMTPA id vHfBhjvBuAffAvHfDh7OBy; Wed, 07 Aug 2019 10:51:20 +0200 Subject: Re: [PATCH v3 10/41] media/ivtv: convert put_page() to put_user_page*() To: john.hubbard@gmail.com, Andrew Morton Cc: Christoph Hellwig , Dan Williams , Dave Chinner , Dave Hansen , Ira Weiny , Jan Kara , Jason Gunthorpe , =?UTF-8?B?SsOpcsO0bWUgR2xpc3Nl?= , LKML , amd-gfx@lists.freedesktop.org, ceph-devel@vger.kernel.org, devel@driverdev.osuosl.org, devel@lists.orangefs.org, dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-block@vger.kernel.org, linux-crypto@vger.kernel.org, linux-fbdev@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-media@vger.kernel.org, linux-mm@kvack.org, linux-nfs@vger.kernel.org, linux-rdma@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-xfs@vger.kernel.org, netdev@vger.kernel.org, rds-devel@oss.oracle.com, sparclinux@vger.kernel.org, x86@kernel.org, xen-devel@lists.xenproject.org, John Hubbard , Andy Walls , Mauro Carvalho Chehab References: <20190807013340.9706-1-jhubbard@nvidia.com> <20190807013340.9706-11-jhubbard@nvidia.com> From: Hans Verkuil Message-ID: <6fd38719-b5d3-f981-732f-da904e029546@xs4all.nl> Date: Wed, 7 Aug 2019 10:51:17 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20190807013340.9706-11-jhubbard@nvidia.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-CMAE-Envelope: MS4wfMJxwy/aLQOuQbf06fYFW7+YfWl4BADGtFuQE6wXUrTjdGOxgky6uB//ESvSCh+yVYUjsu+P3ALVGvunyB2+4QNbiR9U1sMYhv33IEL6pdyKQiMVj8T1 W1Qkt4/A8zg1aaKiXQLOb9cAEBeGuXUGjP0ApW7QHZ9+dJcj1rZJOG9kuRWyqdkLdl0Xfd+YU4Sk6qze6hklKEmlvnGPBahaqqNlqtFrPY2VYZgE8xlevbPK VYzwfyBnV0qB7sk2HJHbwtjw82ezllVmshbYtU2bjc7wM9hsKDG6EcPPmsd9lrPWAB9FBL1Y3g8hvBHaWnOx4q3kfDEr6Y3kC/4CbXRQ20FpJPAzV81+yAGi +cKudbAsX3yt4NQHLMq6NA6K0kBILjc1co+39hFkrrZIcUvJwi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Lh/6DxVIE2D4OhS9udVr+503DGAmvegA+vJlyXKbNabKFcW5bmXYY95PEPyy1wNsxvcmw6 BPLri27Pq99nmIRm69PM0/43YEDR6U4lfeDpNuOtu7XhL7tzHXBogR/ytIhLuavtudk3kQ1Nk50AAQdwvvIdGe/4 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On 8/7/19 3:33 AM, john.hubbard@gmail.com wrote: > From: John Hubbard > > For pages that were retained via get_user_pages*(), release those pages > via the new put_user_page*() routines, instead of via put_page() or > release_pages(). > > This is part a tree-wide conversion, as described in commit fc1d8e7cca2d > ("mm: introduce put_user_page*(), placeholder versions"). > > Cc: Andy Walls > Cc: Mauro Carvalho Chehab > Cc: linux-media@vger.kernel.org > Signed-off-by: John Hubbard Acked-by: Hans Verkuil Regards, Hans > --- > drivers/media/pci/ivtv/ivtv-udma.c | 14 ++++---------- > drivers/media/pci/ivtv/ivtv-yuv.c | 11 +++-------- > 2 files changed, 7 insertions(+), 18 deletions(-) > > diff --git a/drivers/media/pci/ivtv/ivtv-udma.c b/drivers/media/pci/ivtv/ivtv-udma.c > index 5f8883031c9c..7c7f33c2412b 100644 > --- a/drivers/media/pci/ivtv/ivtv-udma.c > +++ b/drivers/media/pci/ivtv/ivtv-udma.c > @@ -92,7 +92,7 @@ int ivtv_udma_setup(struct ivtv *itv, unsigned long ivtv_dest_addr, > { > struct ivtv_dma_page_info user_dma; > struct ivtv_user_dma *dma = &itv->udma; > - int i, err; > + int err; > > IVTV_DEBUG_DMA("ivtv_udma_setup, dst: 0x%08x\n", (unsigned int)ivtv_dest_addr); > > @@ -119,8 +119,7 @@ int ivtv_udma_setup(struct ivtv *itv, unsigned long ivtv_dest_addr, > IVTV_DEBUG_WARN("failed to map user pages, returned %d instead of %d\n", > err, user_dma.page_count); > if (err >= 0) { > - for (i = 0; i < err; i++) > - put_page(dma->map[i]); > + put_user_pages(dma->map, err); > return -EINVAL; > } > return err; > @@ -130,9 +129,7 @@ int ivtv_udma_setup(struct ivtv *itv, unsigned long ivtv_dest_addr, > > /* Fill SG List with new values */ > if (ivtv_udma_fill_sg_list(dma, &user_dma, 0) < 0) { > - for (i = 0; i < dma->page_count; i++) { > - put_page(dma->map[i]); > - } > + put_user_pages(dma->map, dma->page_count); > dma->page_count = 0; > return -ENOMEM; > } > @@ -153,7 +150,6 @@ int ivtv_udma_setup(struct ivtv *itv, unsigned long ivtv_dest_addr, > void ivtv_udma_unmap(struct ivtv *itv) > { > struct ivtv_user_dma *dma = &itv->udma; > - int i; > > IVTV_DEBUG_INFO("ivtv_unmap_user_dma\n"); > > @@ -170,9 +166,7 @@ void ivtv_udma_unmap(struct ivtv *itv) > ivtv_udma_sync_for_cpu(itv); > > /* Release User Pages */ > - for (i = 0; i < dma->page_count; i++) { > - put_page(dma->map[i]); > - } > + put_user_pages(dma->map, dma->page_count); > dma->page_count = 0; > } > > diff --git a/drivers/media/pci/ivtv/ivtv-yuv.c b/drivers/media/pci/ivtv/ivtv-yuv.c > index cd2fe2d444c0..2c61a11d391d 100644 > --- a/drivers/media/pci/ivtv/ivtv-yuv.c > +++ b/drivers/media/pci/ivtv/ivtv-yuv.c > @@ -30,7 +30,6 @@ static int ivtv_yuv_prep_user_dma(struct ivtv *itv, struct ivtv_user_dma *dma, > struct yuv_playback_info *yi = &itv->yuv_info; > u8 frame = yi->draw_frame; > struct yuv_frame_info *f = &yi->new_frame_info[frame]; > - int i; > int y_pages, uv_pages; > unsigned long y_buffer_offset, uv_buffer_offset; > int y_decode_height, uv_decode_height, y_size; > @@ -81,8 +80,7 @@ static int ivtv_yuv_prep_user_dma(struct ivtv *itv, struct ivtv_user_dma *dma, > uv_pages, uv_dma.page_count); > > if (uv_pages >= 0) { > - for (i = 0; i < uv_pages; i++) > - put_page(dma->map[y_pages + i]); > + put_user_pages(&dma->map[y_pages], uv_pages); > rc = -EFAULT; > } else { > rc = uv_pages; > @@ -93,8 +91,7 @@ static int ivtv_yuv_prep_user_dma(struct ivtv *itv, struct ivtv_user_dma *dma, > y_pages, y_dma.page_count); > } > if (y_pages >= 0) { > - for (i = 0; i < y_pages; i++) > - put_page(dma->map[i]); > + put_user_pages(dma->map, y_pages); > /* > * Inherit the -EFAULT from rc's > * initialization, but allow it to be > @@ -112,9 +109,7 @@ static int ivtv_yuv_prep_user_dma(struct ivtv *itv, struct ivtv_user_dma *dma, > /* Fill & map SG List */ > if (ivtv_udma_fill_sg_list (dma, &uv_dma, ivtv_udma_fill_sg_list (dma, &y_dma, 0)) < 0) { > IVTV_DEBUG_WARN("could not allocate bounce buffers for highmem userspace buffers\n"); > - for (i = 0; i < dma->page_count; i++) { > - put_page(dma->map[i]); > - } > + put_user_pages(dma->map, dma->page_count); > dma->page_count = 0; > return -ENOMEM; > } >