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=-7.4 required=3.0 tests=DATE_IN_PAST_06_12, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,USER_AGENT_MUTT autolearn=unavailable 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 8C30DC43381 for ; Mon, 25 Mar 2019 16:47:37 +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 164B320863 for ; Mon, 25 Mar 2019 16:47:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 164B320863 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 44SgD71v55zDqDr for ; Tue, 26 Mar 2019 03:47:35 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=intel.com (client-ip=134.134.136.31; helo=mga06.intel.com; envelope-from=ira.weiny@intel.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=intel.com Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 44Sg9R02zLzDqKS for ; Tue, 26 Mar 2019 03:45:14 +1100 (AEDT) X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Mar 2019 09:45:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,269,1549958400"; d="scan'208";a="125726528" Received: from iweiny-desk2.sc.intel.com ([10.3.52.157]) by orsmga007.jf.intel.com with ESMTP; 25 Mar 2019 09:45:11 -0700 Date: Mon, 25 Mar 2019 01:43:59 -0700 From: Ira Weiny To: Dan Williams Subject: Re: [RESEND 5/7] IB/hfi1: Use the new FOLL_LONGTERM flag to get_user_pages_fast() Message-ID: <20190325084359.GD16366@iweiny-DESK2.sc.intel.com> References: <20190317183438.2057-1-ira.weiny@intel.com> <20190317183438.2057-6-ira.weiny@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.1 (2018-12-01) 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 , Linux-sh , Peter Zijlstra , James Hogan , Heiko Carstens , linux-mips@vger.kernel.org, linux-mm , Rich Felker , Paul Mackerras , sparclinux@vger.kernel.org, linux-s390 , Yoshinori Sato , linux-rdma@vger.kernel.org, Jason Gunthorpe , Ingo Molnar , John Hubbard , Borislav Petkov , Thomas Gleixner , "netdev@vger.kernel.org" , Linux Kernel Mailing List , Ralf Baechle , Martin Schwidefsky , Andrew Morton , linuxppc-dev , "David S. Miller" , "Kirill A. Shutemov" Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Fri, Mar 22, 2019 at 03:14:26PM -0700, Dan Williams wrote: > On Sun, Mar 17, 2019 at 7:36 PM wrote: > > > > From: Ira Weiny > > > > Use the new FOLL_LONGTERM to get_user_pages_fast() to protect against > > FS DAX pages being mapped. > > > > Signed-off-by: Ira Weiny > > --- > > drivers/infiniband/hw/hfi1/user_pages.c | 6 ++++-- > > 1 file changed, 4 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/infiniband/hw/hfi1/user_pages.c b/drivers/infiniband/hw/hfi1/user_pages.c > > index 78ccacaf97d0..6a7f9cd5a94e 100644 > > --- a/drivers/infiniband/hw/hfi1/user_pages.c > > +++ b/drivers/infiniband/hw/hfi1/user_pages.c > > @@ -104,9 +104,11 @@ int hfi1_acquire_user_pages(struct mm_struct *mm, unsigned long vaddr, size_t np > > bool writable, struct page **pages) > > { > > int ret; > > + unsigned int gup_flags = writable ? FOLL_WRITE : 0; > > Maybe: > > unsigned int gup_flags = FOLL_LONGTERM | (writable ? FOLL_WRITE : 0); > > ? Sure looks good. Ira > > > > > - ret = get_user_pages_fast(vaddr, npages, writable ? FOLL_WRITE : 0, > > - pages); > > + gup_flags |= FOLL_LONGTERM; > > + > > + ret = get_user_pages_fast(vaddr, npages, gup_flags, pages); > > if (ret < 0) > > return ret; > > > > -- > > 2.20.1 > > >