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, URIBL_BLOCKED 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 59C8DC43331 for ; Tue, 12 Nov 2019 23:15:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2EFEF2196E for ; Tue, 12 Nov 2019 23:15:19 +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="xlO/3o/F" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727186AbfKLXPO (ORCPT ); Tue, 12 Nov 2019 18:15:14 -0500 Received: from mail-oi1-f196.google.com ([209.85.167.196]:43586 "EHLO mail-oi1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726986AbfKLXPK (ORCPT ); Tue, 12 Nov 2019 18:15:10 -0500 Received: by mail-oi1-f196.google.com with SMTP id l20so3720oie.10 for ; Tue, 12 Nov 2019 15:15:10 -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=Ahg4ogj/xxSIi3Tz2dndpoesa0PkRLQ36VHrjNwVguE=; b=xlO/3o/FAhmPzmX5yHbU6ZNuHn4V9nHbloPGHpZqsb+DPkTsTeMinCTT3P2xrA0A3t XjX5crvs+XLSDSgcai6PZWx41nUjrksNl4jkRdGfTQpb6e1yLtFehh/VkrzYDg6mpqa6 nIua0PamDKkJ2o4Dp1t2Oe3HiXMlIx7Jxg8UopWGV46jcBHLtzfhKxYanb2GfMvC3xgc V252jaKpAjhpDskcu/pPNVnV9ekVH+4FC/dXONxMnvQ71JXMw8m5ltg2SL6haNirS3nS 2zfdpmAUDtoGxjGX0JdEV3chYwlXK5G60EaIDM8oX92yL7sroQqX5o/Sf8CBMjZV3ums ZwPA== 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=Ahg4ogj/xxSIi3Tz2dndpoesa0PkRLQ36VHrjNwVguE=; b=FK+ooCi0YC2pE9SVkCfkA0lm2/HFsUeW0g+VcOiYJHbBssZRzjY3JPrLfGs5bp5ClF L+uep/25sRoZSUdo5F1t1M1xNYZXdpD1gc3hWh2rp4hHt6A1d7wF0sS4clCNtV4eYP1z y4ttaPPuGQgMwFg+/R4ufWbWVdrBAiBhac/LKbwRd4EEDbA5xDPymW8+F75C4xe6alcR +nzgkIQW6MxhJvGOSwXCITcQLjS9uxbVbBSIwssWIkq9VtZz3u5tCoonuUMDtkj2/myf LRh5x6K1JMLMU3qivEtpJPHN25XzvcQj4TJnVW9nA/SzQ1u+LZ1FKEaZqEZLpKrh+AoV YfQQ== X-Gm-Message-State: APjAAAXCueKHgKzK9gt9fKrYg6cizly8E1yEjVXht2/Lkah1sYg7jyBR NHB+PmAZzq7bLsGX9IZ2+gJH14PK1o7WgEQuA6/JpA== X-Google-Smtp-Source: APXvYqw0y1/AL1ibfnKpdRZPCFvNtcNTDnagWkblsIboSxBlSGgp0qhR7HkhIvJGPGFUg8U4pz3vKkN+eKromPrOJOY= X-Received: by 2002:aca:ad52:: with SMTP id w79mr178668oie.149.1573600509804; Tue, 12 Nov 2019 15:15:09 -0800 (PST) MIME-Version: 1.0 References: <20191112000700.3455038-1-jhubbard@nvidia.com> <20191112000700.3455038-9-jhubbard@nvidia.com> <471e513c-833f-2f8b-60db-5d9c56a8f766@nvidia.com> <729a16cb-3947-c7cb-c57f-6c917d240665@nvidia.com> In-Reply-To: <729a16cb-3947-c7cb-c57f-6c917d240665@nvidia.com> From: Dan Williams Date: Tue, 12 Nov 2019 15:14:58 -0800 Message-ID: Subject: Re: [PATCH v3 08/23] vfio, mm: fix get_user_pages_remote() and FOLL_LONGTERM To: John Hubbard 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 , 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 , "Aneesh Kumar K.V" Content-Type: text/plain; charset="UTF-8" Sender: bpf-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org On Tue, Nov 12, 2019 at 3:08 PM John Hubbard wrote: > > 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)? That looks ok. Something to maybe push down into the core in a future cleanup, but not something that needs to be done now. > ... > >>> 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. Right, future work.