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=-0.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 BAA93C17441 for ; Wed, 13 Nov 2019 00:59:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 84A8D21E6F for ; Wed, 13 Nov 2019 00:59:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=intel-com.20150623.gappssmtp.com header.i=@intel-com.20150623.gappssmtp.com header.b="aNNgsrA5" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727256AbfKMA7K (ORCPT ); Tue, 12 Nov 2019 19:59:10 -0500 Received: from mail-ot1-f65.google.com ([209.85.210.65]:34426 "EHLO mail-ot1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727073AbfKMA7J (ORCPT ); Tue, 12 Nov 2019 19:59:09 -0500 Received: by mail-ot1-f65.google.com with SMTP id 5so154028otk.1 for ; Tue, 12 Nov 2019 16:59:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=bbhHvXUlpKSBxAaen2slRAaR7FABAWW5b4ZHt5uDQAs=; b=aNNgsrA5EIFA9nVSCXy/uyenu1ifAR2ZxMR/sDW6HqK6vSTYpxIpmBrjP/vDjDaVnk l4xh/AHHGyooUHFp1c42LTwLTpwdgtUaJfWvN3Y7CFSVzmwzvxLUaHQBl+Ibev8TBoid 2FUFgDLM8vD2vOwzS+IEshtyE4Y+b3ieXpqqo3Mxdly/m4ak6FnwfnCLEy5DGwsI7qq9 7rFre8WIcpfUZvKl+y7wQa6yOvynR61ZdKROoMobKwRLP3lkc2bkhgPK6DIYIEcGXZ4p WUPwy1pR33Kp+/7N+4r5VmPuWnlSLsuN14iR6BROP5kh/8NTzRoeUzJllo7I56/tNtvu ttpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=bbhHvXUlpKSBxAaen2slRAaR7FABAWW5b4ZHt5uDQAs=; b=jhT6h5+lVnDKmfG814fcSe8ymxsKxn2ifxFU2ssNyfV5IDmtcp6jEPmytKIHPDMEyq +DXJky7dNRhDjbUGc1m5lLvs+q5w7ZRS58mSQ63gfvS3Iu/Kg3Ei+5hzZxsUrXeXxPyT /G83M4yDQam/UIQbzehInPngXrmHnbt+lQm8+QrBjo+ZzvVg3RX70uVbzQqfx+UQFQkM /LF/jGSdQkH9H+85UzPcMWf6skqeFdtiu9/bQAvYxmguGF/a0yghIQUt80bvE2yCJBR1 +nrbLD0pTXR/CzYc22Gi+XSxz8voEBQISnrOlAo/OoLHMpZTAn03whs/B7DtAviRjcy8 7/KQ== X-Gm-Message-State: APjAAAXC+7pxPLp7yV+ER316LB9LstvOYltYnohWj5PkfcZyII9iS68P 8h22tyOZIwfqdjrZKbTUW5H/uoDJwWHbAcDOeJE7jA== X-Google-Smtp-Source: APXvYqwE5wMeaGSIvNyY2BTy28AxuQMGsjlQOMQJ/g9Nuz73c9JXx/mbsafhYfzhqVldWgO1VAvXOO9/vT+g3CHkLek= X-Received: by 2002:a05:6830:1b70:: with SMTP id d16mr300372ote.71.1573606748988; Tue, 12 Nov 2019 16:59:08 -0800 (PST) MIME-Version: 1.0 References: <20191112000700.3455038-1-jhubbard@nvidia.com> <20191112000700.3455038-9-jhubbard@nvidia.com> <20191112204338.GE5584@ziepe.ca> <0db36e86-b779-01af-77e7-469af2a2e19c@nvidia.com> <20191112234250.GA19615@ziepe.ca> In-Reply-To: <20191112234250.GA19615@ziepe.ca> From: Dan Williams Date: Tue, 12 Nov 2019 16:58:57 -0800 Message-ID: Subject: Re: [PATCH v3 08/23] vfio, mm: fix get_user_pages_remote() and FOLL_LONGTERM To: Jason Gunthorpe 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?SsOpcsO0bWUgR2xpc3Nl?= , 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 Content-Type: text/plain; charset="UTF-8" Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org On Tue, Nov 12, 2019 at 3:43 PM Jason Gunthorpe wrote: > > 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. Oh true, good eye. It is redundant if it does additionally call __gup_longterm_locked(), and it needs to do that otherwises it undoes the CMA migration magic that Aneesh added. > > Certainly no caller of FOLL_LONGTERM should have to do dax specific > VMA checking. Agree, that was my comment about cleaning up the vma_is_fsdax() check to be internal to the gup core.