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=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,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 AC0DAC17441 for ; Tue, 12 Nov 2019 23:08:20 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6382421925 for ; Tue, 12 Nov 2019 23:08:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=nvidia.com header.i=@nvidia.com header.b="JvY3zmeT" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6382421925 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nvidia.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id F18786B0005; Tue, 12 Nov 2019 18:08:19 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id EC86B6B0006; Tue, 12 Nov 2019 18:08:19 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DB8526B0007; Tue, 12 Nov 2019 18:08:19 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0222.hostedemail.com [216.40.44.222]) by kanga.kvack.org (Postfix) with ESMTP id C49E76B0005 for ; Tue, 12 Nov 2019 18:08:19 -0500 (EST) Received: from smtpin13.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with SMTP id 70414349B for ; Tue, 12 Nov 2019 23:08:19 +0000 (UTC) X-FDA: 76149165918.13.steam19_e649ae05583a X-HE-Tag: steam19_e649ae05583a X-Filterd-Recvd-Size: 6247 Received: from hqemgate15.nvidia.com (hqemgate15.nvidia.com [216.228.121.64]) by imf49.hostedemail.com (Postfix) with ESMTP for ; Tue, 12 Nov 2019 23:08:18 +0000 (UTC) Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate15.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Tue, 12 Nov 2019 15:08:14 -0800 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Tue, 12 Nov 2019 15:08:15 -0800 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Tue, 12 Nov 2019 15:08:15 -0800 Received: from [10.110.48.28] (172.20.13.39) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Tue, 12 Nov 2019 23:08:14 +0000 Subject: Re: [PATCH v3 08/23] vfio, mm: fix get_user_pages_remote() and FOLL_LONGTERM To: Dan Williams CC: 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 , Jason Gunthorpe , 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 , , Maling list - DRI developers , KVM list , , Linux Doc Mailing List , linux-fsdevel , , "Linux-media@vger.kernel.org" , linux-rdma , linuxppc-dev , Netdev , Linux MM , LKML , Aneesh Kumar K.V References: <20191112000700.3455038-1-jhubbard@nvidia.com> <20191112000700.3455038-9-jhubbard@nvidia.com> <471e513c-833f-2f8b-60db-5d9c56a8f766@nvidia.com> From: John Hubbard X-Nvconfidentiality: public Message-ID: <729a16cb-3947-c7cb-c57f-6c917d240665@nvidia.com> Date: Tue, 12 Nov 2019 15:08:14 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: X-Originating-IP: [172.20.13.39] X-ClientProxiedBy: HQMAIL107.nvidia.com (172.20.187.13) To HQMAIL107.nvidia.com (172.20.187.13) Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1573600094; bh=ZOGE9U96RXAj3ATG1sqbSZZ5kwKlu8c/XBmXyMkeZ/I=; h=X-PGP-Universal:Subject:To:CC:References:From:X-Nvconfidentiality: Message-ID:Date:User-Agent:MIME-Version:In-Reply-To: X-Originating-IP:X-ClientProxiedBy:Content-Type:Content-Language: Content-Transfer-Encoding; b=JvY3zmeTvnqgCyD2eBvVojVMLoe0aW2k69Nce6daGQNuZS4OsQi4vkVZmA+1GnELv 9AW/hBWdwsnm9M2X9ccJ1Q1EuL87OWE6ERhYkDbGlO9dGbrg5s9odv3o6SDYGWmMVY GNUfTamy0raCrCHfMqKxT3RFwaKftzmGLH4kXtE5Nu/om60pfZAwk5XUuEq4+pDXr9 TOA3eiznp+/2/rv+84vF++CRsbBzx7ZRqbdYYs2TfJtMqwkIwZn6qPEjYpAQ+i4CU4 MYXtb4n7BN0I9m2qMiQj4POMqt1O9QnTa/T3NAcLAnwom6J6Dq4eXTwoMi4Hyuf3+0 zpRS7T71BD4vw== 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 11/12/19 2:43 PM, Dan Williams wrote: ... > Ah, sorry. This was the first time I had looked at this series and > jumped in without reading the background. > > Your patch as is looks ok, I assume you've removed the FOLL_LONGTERM > warning in get_user_pages_remote in another patch? > Actually, I haven't gone quite that far. Actually this patch is the last change to that function. Therefore, at the end of this patchset, get_user_pages_remote() ends up with this check in it which is a less-restrictive version of the warning: /* * Current FOLL_LONGTERM behavior is incompatible with * FAULT_FLAG_ALLOW_RETRY because of the FS DAX check requirement on * vmas. However, this only comes up if locked is set, and there are * callers that do request FOLL_LONGTERM, but do not set locked. So, * allow what we can. */ if (gup_flags & FOLL_LONGTERM) { if (WARN_ON_ONCE(locked)) return -EINVAL; } Is that OK, or did you want to go further (possibly in a follow-up patchset, as I'm hoping to get this one in soon)? ... >>> I think check_vma_flags() should do the ((FOLL_LONGTERM | FOLL_GET) && >>> vma_is_fsdax()) check and that would also remove the need for >>> __gup_longterm_locked. >>> >> >> Good idea, but there is still the call to check_and_migrate_cma_pages(), >> inside __gup_longterm_locked(). So it's a little more involved and >> we can't trivially delete __gup_longterm_locked() yet, right? > > [ add Aneesh ] > > Yes, you're right. I had overlooked that had snuck in there. That to > me similarly needs to be pushed down into the core with its own FOLL > flag, or it needs to be an explicit fixup that each caller does after > get_user_pages. The fact that migration silently happens as a side > effect of gup is too magical for my taste. > Yes. It's an intrusive side effect that is surprising, and not in a "happy surprise" way. :) . Fixing up the CMA pages by splitting that functionality into separate function calls sounds like an improvement worth exploring. thanks, -- John Hubbard NVIDIA