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 A19FEC17441 for ; Tue, 12 Nov 2019 23:42:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6FB5E206A3 for ; Tue, 12 Nov 2019 23:42:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="it8jHl8A" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727073AbfKLXmx (ORCPT ); Tue, 12 Nov 2019 18:42:53 -0500 Received: from mail-qt1-f196.google.com ([209.85.160.196]:33418 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726954AbfKLXmx (ORCPT ); Tue, 12 Nov 2019 18:42:53 -0500 Received: by mail-qt1-f196.google.com with SMTP id y39so522698qty.0 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=Bi580Hq9pEvVDS4IVFS2bandTDPrDcWDVZxSKfDeGEvsj5I65FYfqX170s6fTKZ/aA fCOcoV02SRaQc+gsQgl/8PRfdVrvTWAU9u6QuFtFZnxNqivDYfDx6BojmWRF3dww+HYh LBbNgwXf3ksYSFlN3uDAe5+NeqPdytWLIwQKNPXtYkW4N6hB+WIU7sTg+PUe9JBKzoEB Bjc+yDY4jPy9JqFtTtZ/vXWO313BVeFC48Ab3gZzF2tbUKuMU7oG9IbSe29SZO+Kk+zA CJ91FDKQoTLPct61MS4OmOpyNIZdZXq83G5cx4P1Iul6wZee1F6s+eUdhTyWg7LvV8SK BkKQ== X-Gm-Message-State: APjAAAUEYiKhhtj2qSFGt/Pl5zVIeXayuBQuuxcwBPKA/Ig7IVZgBujs Hixo9rrPYj9vqgHAnznDzgXi2w== 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) Sender: bpf-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org 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