From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.4 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5EAFAC17441 for ; Tue, 12 Nov 2019 23:42:54 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1013F21925 for ; Tue, 12 Nov 2019 23:42:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="it8jHl8A" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1013F21925 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id B54ED6B0005; Tue, 12 Nov 2019 18:42:53 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B06086B0006; Tue, 12 Nov 2019 18:42:53 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9CD6D6B0007; Tue, 12 Nov 2019 18:42:53 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0029.hostedemail.com [216.40.44.29]) by kanga.kvack.org (Postfix) with ESMTP id 85C706B0005 for ; Tue, 12 Nov 2019 18:42:53 -0500 (EST) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with SMTP id 4204A180AD81F for ; Tue, 12 Nov 2019 23:42:53 +0000 (UTC) X-FDA: 76149253026.03.bag65_192312d5e4424 X-HE-Tag: bag65_192312d5e4424 X-Filterd-Recvd-Size: 6427 Received: from mail-qt1-f195.google.com (mail-qt1-f195.google.com [209.85.160.195]) by imf15.hostedemail.com (Postfix) with ESMTP for ; Tue, 12 Nov 2019 23:42:52 +0000 (UTC) Received: by mail-qt1-f195.google.com with SMTP id t20so460631qtn.9 for ; Tue, 12 Nov 2019 15:42:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=vZiC7XI6w4qmcJhiszw5fcLLfKl81FBqJhCu/q1OZew=; b=it8jHl8Aeod0zYq+Skrwrg8GwHh9Iu8Lk4aklL2UU1A7NrkgqGz5TacHTvuZENKCSO zX5vQsxL6WoNuMWNKkEQjxDubFJia3lLQ6vtybpi5bU815x8TqvUIIt9Kr2Uo5cBSRzI 2VZYj93gQX0itc+geQUWbcwpbx7dsR+jspiqHjxUKDMEHdunGEQMz6R4qhshIz6xtcbf Zhwk9IxmoxlDCj68H/K3Yi1WAV8gDwI3vnoSzzJ5OjxNZ+oTEONNaXk9owbEXpdua0Ac Ytg9ljas4ej2TjoNx1nr1x9pd15vss2zsUb9mCqXq0UcPC7FIXHufZoDuL/IWSFTzLDE UAww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=vZiC7XI6w4qmcJhiszw5fcLLfKl81FBqJhCu/q1OZew=; b=UXZU2qVXVQDxX412a5vxwUqd82SB78LczMy2hvjQx0fyULuXounxHFJLVYUOz+38XH rsVU7tBHozYV5Tf95jIsA53g74AF/D1AUVBT5wgbWj1Mo6RxgsBq4V9mU2cwxwhACrGE 1eGvKcqD7P0b8G490eoDqe+68buenCUNtdDzeMpraem+xgnQJNQPUb0UNJO3ZnMXQ9Zv nUlvZwZK7u850UFVXGEE+Pr5hCG2WX/I+f3HzrLjlGyE6t7a637dp9mB4KStYarWaRLt UiNTEysg40JdPMdQyghJHQV+th5FkMrIDL2QKW8QEf+pOPifokJepM1QEREZc5ha++Ie GYUg== X-Gm-Message-State: APjAAAWxjXx1U7cmH016+owjUmuCLhNr5ZvTaK+A3mR25aRCR7XYJkJU +vkQo5yV8NDijSJU88Nak4f3iQ== X-Google-Smtp-Source: APXvYqz3aftIVfOw8Wxd6a6UdmY0tmO8rvvaAb/aUmwkho+fgsveWFsBhLgURBNyxpICpzEXHNU+vQ== X-Received: by 2002:aed:26e2:: with SMTP id q89mr18576100qtd.391.1573602171951; Tue, 12 Nov 2019 15:42:51 -0800 (PST) Received: from ziepe.ca (hlfxns017vw-142-162-113-180.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.162.113.180]) by smtp.gmail.com with ESMTPSA id u11sm212203qtg.11.2019.11.12.15.42.51 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Nov 2019 15:42:51 -0800 (PST) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1iUfoA-0005Um-OB; Tue, 12 Nov 2019 19:42:50 -0400 Date: Tue, 12 Nov 2019 19:42:50 -0400 From: Jason Gunthorpe To: Dan Williams Cc: John Hubbard , Andrew Morton , Al Viro , Alex Williamson , Benjamin Herrenschmidt , =?utf-8?B?QmrDtnJuIFTDtnBlbA==?= , Christoph Hellwig , Daniel Vetter , Dave Chinner , David Airlie , "David S . Miller" , Ira Weiny , Jan Kara , Jens Axboe , Jonathan Corbet , =?utf-8?B?SsOpcsO0bWU=?= Glisse , Magnus Karlsson , Mauro Carvalho Chehab , Michael Ellerman , Michal Hocko , Mike Kravetz , Paul Mackerras , Shuah Khan , Vlastimil Babka , bpf@vger.kernel.org, Maling list - DRI developers , KVM list , linux-block@vger.kernel.org, Linux Doc Mailing List , linux-fsdevel , linux-kselftest@vger.kernel.org, "Linux-media@vger.kernel.org" , linux-rdma , linuxppc-dev , Netdev , Linux MM , LKML Subject: Re: [PATCH v3 08/23] vfio, mm: fix get_user_pages_remote() and FOLL_LONGTERM Message-ID: <20191112234250.GA19615@ziepe.ca> References: <20191112000700.3455038-1-jhubbard@nvidia.com> <20191112000700.3455038-9-jhubbard@nvidia.com> <20191112204338.GE5584@ziepe.ca> <0db36e86-b779-01af-77e7-469af2a2e19c@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) 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: On Tue, Nov 12, 2019 at 02:45:51PM -0800, Dan Williams wrote: > On Tue, Nov 12, 2019 at 2:43 PM John Hubbard wrote: > > > > On 11/12/19 12:43 PM, Jason Gunthorpe wrote: > > ... > > >> - } > > >> + ret = get_user_pages_remote(NULL, mm, vaddr, 1, flags | FOLL_LONGTERM, > > >> + page, vmas, NULL); > > >> + /* > > >> + * The lifetime of a vaddr_get_pfn() page pin is > > >> + * userspace-controlled. In the fs-dax case this could > > >> + * lead to indefinite stalls in filesystem operations. > > >> + * Disallow attempts to pin fs-dax pages via this > > >> + * interface. > > >> + */ > > >> + if (ret > 0 && vma_is_fsdax(vmas[0])) { > > >> + ret = -EOPNOTSUPP; > > >> + put_page(page[0]); > > >> } > > > > > > AFAIK this chunk is redundant now as it is some hack to emulate > > > FOLL_LONGTERM? So vmas can be deleted too. > > > > Let me first make sure I understand what Dan has in mind for the vma > > checking, in the other thread... > > It's not redundant relative to upstream which does not do anything the > FOLL_LONGTERM in the gup-slow path... but I have not looked at patches > 1-7 to see if something there made it redundant. Oh, the hunk John had below for get_user_pages_remote() also needs to call __gup_longterm_locked() when FOLL_LONGTERM is specified, then that calls check_dax_vmas() which duplicates the vma_is_fsdax() check above. Certainly no caller of FOLL_LONGTERM should have to do dax specific VMA checking. Jason