From patchwork Mon Nov 7 16:17:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 16548 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2152204wru; Mon, 7 Nov 2022 08:22:54 -0800 (PST) X-Google-Smtp-Source: AMsMyM6rNOUfgOosdhqafkOLHhwi9XokC1BOm0jOY7qMD1paCZZ2dxH6Q3Nplx3n2b3JCwiegvsa X-Received: by 2002:a05:6a00:1582:b0:56d:4bc6:68c7 with SMTP id u2-20020a056a00158200b0056d4bc668c7mr44657861pfk.31.1667838174523; Mon, 07 Nov 2022 08:22:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667838174; cv=none; d=google.com; s=arc-20160816; b=n5Ke/ys0LXzkUZWs1ECNJ+3RGMyeGOAlA2LhYw7tHy5xK/iQ9JDhSPm9d5dZHeICFN cXitxhd0HbjhPyQLdsk7nikybmRJpNCwgW4S8Ik63sEMiKm9ea1+Y6Lp4j8ZJDwAyY12 1V5snFY9E/ZwQ/qfxDMph333qT8AMdr3gAj1j9g7FK3VaLYokvoEHNpWQ/oL/ygRjF45 +I2A5NsIbVi72VASYOw2SOBlNSHyo7V1k/9l7QYgAAGHsLmQISUfhqzwOYO20wnxHYSr kTZLoWbhNhShmX33UXT6rTdpmkLL3rY/++ktJrT+98J1CNguWQEuloNNH98BjUkBeJFQ GXdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=KLZRZjgmtcgxGnOVW1plINu4o5lxWeTUer368nax8co=; b=auLYC4Ty880U5vgIZY0KHNJTycSF/62NJj9bguQrSL1auyqDG+PKck6P9N7klVzLxt iYyKCNoNrStFEVGdtJjBoCVSMbBKw5ghtK5RlQfquHcYXg6wIH6U4DqDV/Lur2NxVbnS BSAFW8lUhZoH/kr7tvvIZsC9sj4RFXYVHEArczXse262ZjX4R8jxT42KFiTM1iUkdg2v UBYr/wNLRfUd25n3vXY+ijBOaFweD0I9Ib8ClT1lxOOl/Rd5m3oko3VkETGIHrG1ncFQ pzg1RGwvub+DTNW7OZ3yDrT4ThtqnsOyt2yetyUhk2G/STPDBhU5Z6PyDI4D34PTsbOX +2kg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=TULJC4t6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v22-20020a056a00149600b00561fb77aed3si10653910pfu.368.2022.11.07.08.22.41; Mon, 07 Nov 2022 08:22:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=TULJC4t6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231808AbiKGQVv (ORCPT + 99 others); Mon, 7 Nov 2022 11:21:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232578AbiKGQU5 (ORCPT ); Mon, 7 Nov 2022 11:20:57 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A9C81DA5A for ; Mon, 7 Nov 2022 08:19:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1667837971; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KLZRZjgmtcgxGnOVW1plINu4o5lxWeTUer368nax8co=; b=TULJC4t6k67ixZwPNtDiJcV5mE62Km4QRxP1SyNJp+U9BtHMP8szQD2GQIoGfk4h7TmMTF KUG2IDyuzNxhCDZwGXMQHSZsn+MAefHzm8mVQsg0ZNyp0wYHH0XXolHZGPuS0Le+0vwUi2 68877KvKmp8Zhgz216at2sR4hTQ2GpU= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-653-w-Z1rkmbPauCSeJRfGLJ5g-1; Mon, 07 Nov 2022 11:19:27 -0500 X-MC-Unique: w-Z1rkmbPauCSeJRfGLJ5g-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E10DC3C0F7E8; Mon, 7 Nov 2022 16:19:25 +0000 (UTC) Received: from t480s.redhat.com (unknown [10.39.195.106]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4DDE94B3FCF; Mon, 7 Nov 2022 16:19:20 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, etnaviv@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-rdma@vger.kernel.org, linux-media@vger.kernel.org, linux-kselftest@vger.kernel.org, David Hildenbrand , Linus Torvalds , Andrew Morton , Jason Gunthorpe , John Hubbard , Peter Xu , Greg Kroah-Hartman , Andrea Arcangeli , Hugh Dickins , Nadav Amit , Vlastimil Babka , Matthew Wilcox , Mike Kravetz , Muchun Song , Lucas Stach , David Airlie , Oded Gabbay , Arnd Bergmann , Andy Walls , Mauro Carvalho Chehab Subject: [PATCH RFC 15/19] media: pci/ivtv: remove FOLL_FORCE usage Date: Mon, 7 Nov 2022 17:17:36 +0100 Message-Id: <20221107161740.144456-16-david@redhat.com> In-Reply-To: <20221107161740.144456-1-david@redhat.com> References: <20221107161740.144456-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748855081737476553?= X-GMAIL-MSGID: =?utf-8?q?1748855081737476553?= FOLL_FORCE is really only for debugger access. R/O pinning a page is supposed to fail if the VMA misses proper access permissions (no VM_READ). Let's just remove FOLL_FORCE usage here; there would have to be a pretty good reason to allow arbitrary drivers to R/O pin pages in a PROT_NONE VMA. Most probably, FOLL_FORCE usage is just some legacy leftover. Cc: Andy Walls Cc: Mauro Carvalho Chehab Signed-off-by: David Hildenbrand --- drivers/media/pci/ivtv/ivtv-udma.c | 2 +- drivers/media/pci/ivtv/ivtv-yuv.c | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/media/pci/ivtv/ivtv-udma.c b/drivers/media/pci/ivtv/ivtv-udma.c index 210be8290f24..99b9f55ca829 100644 --- a/drivers/media/pci/ivtv/ivtv-udma.c +++ b/drivers/media/pci/ivtv/ivtv-udma.c @@ -115,7 +115,7 @@ int ivtv_udma_setup(struct ivtv *itv, unsigned long ivtv_dest_addr, /* Pin user pages for DMA Xfer */ err = pin_user_pages_unlocked(user_dma.uaddr, user_dma.page_count, - dma->map, FOLL_FORCE); + dma->map, 0); if (user_dma.page_count != err) { IVTV_DEBUG_WARN("failed to map user pages, returned %d instead of %d\n", diff --git a/drivers/media/pci/ivtv/ivtv-yuv.c b/drivers/media/pci/ivtv/ivtv-yuv.c index 4ba10c34a16a..582146f8d70d 100644 --- a/drivers/media/pci/ivtv/ivtv-yuv.c +++ b/drivers/media/pci/ivtv/ivtv-yuv.c @@ -63,12 +63,11 @@ static int ivtv_yuv_prep_user_dma(struct ivtv *itv, struct ivtv_user_dma *dma, /* Pin user pages for DMA Xfer */ y_pages = pin_user_pages_unlocked(y_dma.uaddr, - y_dma.page_count, &dma->map[0], FOLL_FORCE); + y_dma.page_count, &dma->map[0], 0); uv_pages = 0; /* silence gcc. value is set and consumed only if: */ if (y_pages == y_dma.page_count) { uv_pages = pin_user_pages_unlocked(uv_dma.uaddr, - uv_dma.page_count, &dma->map[y_pages], - FOLL_FORCE); + uv_dma.page_count, &dma->map[y_pages], 0); } if (y_pages != y_dma.page_count || uv_pages != uv_dma.page_count) {