From patchwork Fri Oct 2 17:53:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 11814369 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ADDD092C for ; Fri, 2 Oct 2020 17:53:47 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 71D572085B for ; Fri, 2 Oct 2020 17:53:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="FeyUVdPt" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 71D572085B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id C11666B0062; Fri, 2 Oct 2020 13:53:45 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id B97C56B0068; Fri, 2 Oct 2020 13:53:45 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9EB5F6B006C; Fri, 2 Oct 2020 13:53:45 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0250.hostedemail.com [216.40.44.250]) by kanga.kvack.org (Postfix) with ESMTP id 73B8B6B0062 for ; Fri, 2 Oct 2020 13:53:45 -0400 (EDT) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 0EDD0181AE874 for ; Fri, 2 Oct 2020 17:53:45 +0000 (UTC) X-FDA: 77327733210.18.top84_2508e6b271a6 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin18.hostedemail.com (Postfix) with ESMTP id E5BB1100ED0DB for ; Fri, 2 Oct 2020 17:53:44 +0000 (UTC) X-Spam-Summary: 1,0,0,6e3148b38a202b31,d41d8cd98f00b204,daniel.vetter@ffwll.ch,,RULES_HIT:41:152:355:379:541:800:960:968:973:988:989:1260:1277:1311:1313:1314:1345:1359:1431:1437:1515:1516:1518:1535:1541:1593:1594:1711:1730:1747:1777:1792:2393:2553:2559:2562:3138:3139:3140:3141:3142:3353:3653:3865:3866:3867:3868:3870:3871:3874:5007:6261:6653:6742:10004:10400:10450:10455:11026:11232:11658:11914:12043:12296:12297:12517:12519:12555:12663:12895:13069:13071:13161:13229:13311:13357:13846:13894:14096:14097:14180:14181:14394:14659:14721:19904:19999:21060:21080:21220:21251:21433:21444:21451:21627:30012:30054:30064:30070:30090,0,RBL:209.85.221.66:@ffwll.ch:.lbl8.mailshell.net-66.201.201.201 62.8.0.100;04yggefwipokwozo51diyukob4s5fycqxsq8rscowkdzhc9u7h9ejx4ysuwb8ua.oapy93o3iqxaryozcnirmjh8sc9yo11yy7xkct753odimg1gfk8s4oya18m3sit.h-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime :209,LUA X-HE-Tag: top84_2508e6b271a6 X-Filterd-Recvd-Size: 5097 Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by imf41.hostedemail.com (Postfix) with ESMTP for ; Fri, 2 Oct 2020 17:53:44 +0000 (UTC) Received: by mail-wr1-f66.google.com with SMTP id e16so2736983wrm.2 for ; Fri, 02 Oct 2020 10:53:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mCTncko5YOfdd1hOhILVAexx/vlJaiXxqeCzAQ94in0=; b=FeyUVdPtM4srxB1+dn7I4h3H7Wfi8/fg99I+ABCtisEx3wHtPquZTvZ16RuGWwmZzE vz2bLh2sThVwHVg4NCZu/QZBQT8Z+HfU/9rp+qgb6Lzuk41uNLg5YV0/kZAopqb77csM ge7J8s4JsvsrgpI2ThI5QqsYkQlmjW4Kii0Bw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mCTncko5YOfdd1hOhILVAexx/vlJaiXxqeCzAQ94in0=; b=DRf4I/rY7O/ak4HqQEJ6FztRiJf4YSf7cxDN6f+VhQfGHZrBuGMxaxFT+dfBYLQh8A D8V0V+uQzKE+Ve6ypWyQd8EEbTkIbFQWhqwFmGbqy/raOdxig8sLxMXSkQYKAJ/WnID1 fR63ssr1HfwoDT7IU/CV3L+4xXsWSv7Gg3bZQPOiTRh4tSpk8210/N/cXqGtfAoScFPd sYcOkKoD+UHyBvChgHC0C5ETl8bfdr6ywgIH/cgiiha9c32+fNjVgz+QmRvuAfyDNOoX Pytoen/ZJPcHK8P52jcIHY4khRlg8sGrRFt2fq1AiUI9fTQe8/Fo/jF07O0sagN2mTqF z0Bw== X-Gm-Message-State: AOAM531xyAMH+Rj2FhnQCL90eh6MMxVoi83NahKJ2DgOf63XDovNtW8W qZQIj7vk0j45y3CjZIKGEefaEQ== X-Google-Smtp-Source: ABdhPJxqlu8ijgg5+4avDVYjjircN8ixFnEQp9RW1tMzahfcEDBuGAuy7tAthp9rZCHLP+C5s3jDnQ== X-Received: by 2002:a5d:4603:: with SMTP id t3mr4212688wrq.424.1601661223009; Fri, 02 Oct 2020 10:53:43 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id m10sm2585429wmc.9.2020.10.02.10.53.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Oct 2020 10:53:42 -0700 (PDT) From: Daniel Vetter To: DRI Development Cc: LKML , Daniel Vetter , Daniel Vetter , Andrew Morton , John Hubbard , =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , Jan Kara , Dan Williams , linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH 2/2] mm/frame-vec: use FOLL_LONGTERM Date: Fri, 2 Oct 2020 19:53:03 +0200 Message-Id: <20201002175303.390363-2-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201002175303.390363-1-daniel.vetter@ffwll.ch> References: <20201002175303.390363-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: For $reasons I've stumbled over this code and I'm not sure the change to the new gup functions in 55a650c35fea ("mm/gup: frame_vector: convert get_user_pages() --> pin_user_pages()") was entirely correct. This here is used for long term buffers (not just quick I/O) like RDMA, and John notes this in his patch. But I thought the rule for these is that they need to add FOLL_LONGTERM, which John's patch didn't do. There is already a dax specific check (added in b7f0554a56f2 ("mm: fail get_vaddr_frames() for filesystem-dax mappings")), so this seems like the prudent thing to do. Signed-off-by: Daniel Vetter Cc: Andrew Morton Cc: John Hubbard Cc: Jérôme Glisse Cc: Jan Kara Cc: Dan Williams Cc: linux-mm@kvack.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-samsung-soc@vger.kernel.org Cc: linux-media@vger.kernel.org --- Hi all, I stumbled over this and figured typing this patch can't hurt. Really just to maybe learn a few things about how gup/pup is supposed to be used (we have a bit of that in drivers/gpu), this here isn't really ralated to anything I'm doing. I'm also wondering whether the explicit dax check should be removed, since FOLL_LONGTERM should take care of that already. -Daniel --- mm/frame_vector.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/frame_vector.c b/mm/frame_vector.c index 5d34c9047e9c..3507e09cb3ff 100644 --- a/mm/frame_vector.c +++ b/mm/frame_vector.c @@ -35,7 +35,7 @@ int get_vaddr_frames(unsigned long start, unsigned int nr_frames, { struct mm_struct *mm = current->mm; struct vm_area_struct *vma; - unsigned int gup_flags = FOLL_WRITE | FOLL_FORCE; + unsigned int gup_flags = FOLL_WRITE | FOLL_FORCE | FOLL_LONGTERM; int ret = 0; int err; int locked;