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.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, 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 0386BC43331 for ; Wed, 13 Nov 2019 01:02:20 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A84CB21925 for ; Wed, 13 Nov 2019 01:02:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=intel-com.20150623.gappssmtp.com header.i=@intel-com.20150623.gappssmtp.com header.b="aNNgsrA5" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A84CB21925 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 47CRCr1PspzF5xc for ; Wed, 13 Nov 2019 12:02:16 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=intel.com (client-ip=2607:f8b0:4864:20::342; helo=mail-ot1-x342.google.com; envelope-from=dan.j.williams@intel.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=intel-com.20150623.gappssmtp.com header.i=@intel-com.20150623.gappssmtp.com header.b="aNNgsrA5"; dkim-atps=neutral Received: from mail-ot1-x342.google.com (mail-ot1-x342.google.com [IPv6:2607:f8b0:4864:20::342]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 47CR8J4bXSzF456 for ; Wed, 13 Nov 2019 11:59:10 +1100 (AEDT) Received: by mail-ot1-x342.google.com with SMTP id n23so105558otr.13 for ; Tue, 12 Nov 2019 16:59: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=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=hDqm2nzjN2f7hFP3Vr7LK8QuN4F0g3IzOQrnPtvTgbDnYR5y1ScXRZQibe7H5ZnVN/ uQk4os+6u6YWoeN6PJ3CNNUFK2las/VqD3bNHv9X9iIYk4uFaveU8cWqZ2EVmTa0rkHQ 9upU0yAi2gM9dzS6J82nO66xPw51lfHaBDdX+l6ILZ+vPsAmnb2206j5ZNSgzoq2zEX7 rEqQixwBeNJn9aKD5rZEpQ710J+KOBd6+s5pe9P/uTQpmF6lgwxooQAIzINd0J7+ZOZP 6G9Ed5R7H5q90A2ClBy65/iEEW7i4QxhNQ4oCQf4sTFmq+7lGb+qUrKRj9/b5ru7dBLP +uKQ== X-Gm-Message-State: APjAAAWPfoEuvqHHxxjmB2cOCrotZ8SkRIjlwf2rS9JZFw/DTK8VAnHF 2Npr5+6h5+xkxKWx/3F/QiBTmX5Fv9zBghXW36GSauHyYlY= 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 Content-Type: text/plain; charset="UTF-8" X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michal Hocko , Jan Kara , KVM list , Linux Doc Mailing List , David Airlie , Dave Chinner , Maling list - DRI developers , LKML , Linux MM , Paul Mackerras , linux-kselftest@vger.kernel.org, Ira Weiny , Jonathan Corbet , linux-rdma , Christoph Hellwig , Vlastimil Babka , =?UTF-8?B?QmrDtnJuIFTDtnBlbA==?= , "Linux-media@vger.kernel.org" , Shuah Khan , John Hubbard , linux-block@vger.kernel.org, =?UTF-8?B?SsOpcsO0bWUgR2xpc3Nl?= , Al Viro , Mauro Carvalho Chehab , bpf@vger.kernel.org, Magnus Karlsson , Jens Axboe , Netdev , Alex Williamson , Daniel Vetter , linux-fsdevel , Andrew Morton , linuxppc-dev , "David S . Miller" , Mike Kravetz Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" 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.