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=-3.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 DF712C41604 for ; Wed, 7 Oct 2020 17:33:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 751E02168B for ; Wed, 7 Oct 2020 17:33:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="I7/owwaB" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728626AbgJGRd0 (ORCPT ); Wed, 7 Oct 2020 13:33:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728594AbgJGRd0 (ORCPT ); Wed, 7 Oct 2020 13:33:26 -0400 Received: from mail-qv1-xf43.google.com (mail-qv1-xf43.google.com [IPv6:2607:f8b0:4864:20::f43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C789C0613D3 for ; Wed, 7 Oct 2020 10:33:26 -0700 (PDT) Received: by mail-qv1-xf43.google.com with SMTP id ev17so1625952qvb.3 for ; Wed, 07 Oct 2020 10:33:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=TdSre1+FiF17b2WS+AUXMuyymNAaLTf4uLT17E+pnFU=; b=I7/owwaByfC+T615S4yoAl1o98d1ue1FvXLjxM8yebhh+9JecaDPgFNy3dbnkmB8TN Vzx15ySYhGig+ha8DgJwv0JB9nc9mTmHX7s01XzVMtrzGqF7F5ysx9nVT6a95aQv8luf ubR2OEMsVZaWQ7RmDyyDSLyoP0q7IOFEADlrOkM8v9xk0+G5fAvCgdRAbNUwL2HYX/wg NdxL0Agtty3FgSPu+bQMrdJNei+OMp8ipKgGOhWKyjOjRZlk7D/1NKUJUn0ab2X75jIZ GLdNE/c4Zf4maicgzgeRTMpXMrGmFUZrqUFukx9r5Pv+87LO5DNFvo/M0m7x2mbqppxs Yd4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=TdSre1+FiF17b2WS+AUXMuyymNAaLTf4uLT17E+pnFU=; b=fnyoGlEj6Hgcnju9JnUiADnSUVV5bsLE+QD0KXTkHptZQwBhOtBk8hUZKze+T1nI7z OOp/h6UEyhPToXNa1Dlgcs1XI32pNzl1U5zFp1gj0foMzQnYd7jCd9k3GaIjaIy81FZF +huRxy/7Jkwea3NuuW+3GuDMbVfgROrtywDjJg1tSzannyiMu90HDiLbwO4CtPT3edZB PLBcC/z/KtIhzx0RH8TOo01O973fH4/TIBpPEjmnPbrne+Yiic6zQxKKJHV0wVzmI7NU v1sqtQJwcVtz+PHjjlX3VCqZVpkmbfnvgx9GNCSmfIBshhWPwS+Rp4PnTRnhKZ8xAkHf olkA== X-Gm-Message-State: AOAM530iwygN6s/FY0t/FkccDchl1XMhdagQcYgs2wtBoEiOqCUW9Lt/ ZXgaKH4lUF1x/77CifbZghDubgXL48FEpt5Q X-Google-Smtp-Source: ABdhPJw0qC4HxiG6+lNGoLhXdKRQ6phNXWeAziKb0zM4HKIClbwU3fAgBb5ZP6iA8tkK3T/vsUzqKA== X-Received: by 2002:ad4:456c:: with SMTP id o12mr4490006qvu.48.1602092005183; Wed, 07 Oct 2020 10:33:25 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-156-34-48-30.dhcp-dynamic.fibreop.ns.bellaliant.net. [156.34.48.30]) by smtp.gmail.com with ESMTPSA id 184sm1954180qkl.104.2020.10.07.10.33.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Oct 2020 10:33:24 -0700 (PDT) Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1kQDJb-0010xU-S5; Wed, 07 Oct 2020 14:33:23 -0300 Date: Wed, 7 Oct 2020 14:33:23 -0300 From: Jason Gunthorpe To: Daniel Vetter Cc: DRI Development , LKML , kvm@vger.kernel.org, Linux MM , Linux ARM , linux-samsung-soc , "open list:DMA BUFFER SHARING FRAMEWORK" , linux-s390@vger.kernel.org, Daniel Vetter , Pawel Osciak , Marek Szyprowski , Kyungmin Park , Tomasz Figa , Mauro Carvalho Chehab , Andrew Morton , John Hubbard , =?utf-8?B?SsOpcsO0bWU=?= Glisse , Jan Kara , Dan Williams Subject: Re: [PATCH 05/13] mm/frame-vector: Use FOLL_LONGTERM Message-ID: <20201007173323.GV5177@ziepe.ca> References: <20201007164426.1812530-1-daniel.vetter@ffwll.ch> <20201007164426.1812530-6-daniel.vetter@ffwll.ch> <20201007165316.GT5177@ziepe.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 07, 2020 at 07:12:24PM +0200, Daniel Vetter wrote: > On Wed, Oct 7, 2020 at 6:53 PM Jason Gunthorpe wrote: > > > > On Wed, Oct 07, 2020 at 06:44:18PM +0200, Daniel Vetter wrote: > > > > > > - /* > > > - * While get_vaddr_frames() could be used for transient (kernel > > > - * controlled lifetime) pinning of memory pages all current > > > - * users establish long term (userspace controlled lifetime) > > > - * page pinning. Treat get_vaddr_frames() like > > > - * get_user_pages_longterm() and disallow it for filesystem-dax > > > - * mappings. > > > - */ > > > - if (vma_is_fsdax(vma)) { > > > - ret = -EOPNOTSUPP; > > > - goto out; > > > - } > > > - > > > - if (!(vma->vm_flags & (VM_IO | VM_PFNMAP))) { > > > - vec->got_ref = true; > > > - vec->is_pfns = false; > > > - ret = pin_user_pages_locked(start, nr_frames, > > > - gup_flags, (struct page **)(vec->ptrs), &locked); > > > - goto out; > > > - } > > > > The vm_flags still need to be checked before going into the while > > loop. If the break is taken then nothing would check vm_flags > > Hm right that's a bin inconsistent. follow_pfn also checks for this, > so I think we can just ditch this entirely both here and in the do {} > while () check, simplifying the latter to just while (vma). Well, just > make it a real loop with less confusing control flow probably. It does read very poorly with the redundant check, espeically since I keep forgetting follow_pfn does it too :\ Jason 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=-4.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, 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 B592DC41604 for ; Wed, 7 Oct 2020 17:35:00 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 29B592168B for ; Wed, 7 Oct 2020 17:35:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ZQlSCjPA"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="I7/owwaB" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 29B592168B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=sWtMkvtsDBziwRJKj8HIwLAxOLsFnFg1SIMkv9CkB+A=; b=ZQlSCjPAc4HLYyJz7vE923O7b iMi9srhzg273woFRD6kNPVKJLJ5fmlKfwU4CUjlvmxeq8okirjZh2zP4d1hMjKO1llIzJ6gTFquE7 JF2gXT6eyFeQTf6rAyI61bQDQPdy5JjziM1cPXOwfoO0JMaPSNtVpW2cqhu0DfEGDgxMCHFO6syA5 yMprd7fe39OgLhWH0qizY12gWF9qd/jLpIEptdyei5ekhsS3vK8PowIPnZ3hcrp4qWTchSQ8ToDM3 gcCuCvSeIOX1B3yuKIXcQEAdH1E6UkXFRsvwfukp70gLqfopKp5cPL9YfaO/p3NAhM/+dqzu5cPcs gA6L7wUBg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kQDJh-0000Qp-49; Wed, 07 Oct 2020 17:33:29 +0000 Received: from mail-qv1-xf44.google.com ([2607:f8b0:4864:20::f44]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kQDJf-0000Pv-2C for linux-arm-kernel@lists.infradead.org; Wed, 07 Oct 2020 17:33:27 +0000 Received: by mail-qv1-xf44.google.com with SMTP id b19so1614262qvm.6 for ; Wed, 07 Oct 2020 10:33:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=TdSre1+FiF17b2WS+AUXMuyymNAaLTf4uLT17E+pnFU=; b=I7/owwaByfC+T615S4yoAl1o98d1ue1FvXLjxM8yebhh+9JecaDPgFNy3dbnkmB8TN Vzx15ySYhGig+ha8DgJwv0JB9nc9mTmHX7s01XzVMtrzGqF7F5ysx9nVT6a95aQv8luf ubR2OEMsVZaWQ7RmDyyDSLyoP0q7IOFEADlrOkM8v9xk0+G5fAvCgdRAbNUwL2HYX/wg NdxL0Agtty3FgSPu+bQMrdJNei+OMp8ipKgGOhWKyjOjRZlk7D/1NKUJUn0ab2X75jIZ GLdNE/c4Zf4maicgzgeRTMpXMrGmFUZrqUFukx9r5Pv+87LO5DNFvo/M0m7x2mbqppxs Yd4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=TdSre1+FiF17b2WS+AUXMuyymNAaLTf4uLT17E+pnFU=; b=JCQ2Lxtyhrqrm1X/lirqa/rn701QNXJVA6jxKCSwSPCnpQWH2nC6Ftzc1md/+y42K0 cVZSeVmov2cWg3g1iwHsSc73mk6gDJDopt1sLy8cpU/9/fwmIc++19PY+RvBkwYl9t1J XQouIyGdq8Ib9XKDtF9irMHwpytgg5BuN+UnRiEn54tF60JzBgMU2976iGlFaqBA7h7N rgbYQYYCEEeBmz1GA8v4iYt0pYRQaIe/4qrNiW2Bhqm06J21OPT6sC5i6xHBODnZA14e ym9x4R+RhbvNG3RzzxaakcBZ0W2MqnXTmvf9/RIwOhzUmiRJufRp3zAzQxqli1WwW6N7 1yjQ== X-Gm-Message-State: AOAM532W15YHK9dyfqupu2A2pLIEKjWUejaVhMNhvLmp56/qa1Vh0eN+ yV1M8NDPJi/7giaUww2aBzd4/A== X-Google-Smtp-Source: ABdhPJw0qC4HxiG6+lNGoLhXdKRQ6phNXWeAziKb0zM4HKIClbwU3fAgBb5ZP6iA8tkK3T/vsUzqKA== X-Received: by 2002:ad4:456c:: with SMTP id o12mr4490006qvu.48.1602092005183; Wed, 07 Oct 2020 10:33:25 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-156-34-48-30.dhcp-dynamic.fibreop.ns.bellaliant.net. [156.34.48.30]) by smtp.gmail.com with ESMTPSA id 184sm1954180qkl.104.2020.10.07.10.33.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Oct 2020 10:33:24 -0700 (PDT) Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1kQDJb-0010xU-S5; Wed, 07 Oct 2020 14:33:23 -0300 Date: Wed, 7 Oct 2020 14:33:23 -0300 From: Jason Gunthorpe To: Daniel Vetter Subject: Re: [PATCH 05/13] mm/frame-vector: Use FOLL_LONGTERM Message-ID: <20201007173323.GV5177@ziepe.ca> References: <20201007164426.1812530-1-daniel.vetter@ffwll.ch> <20201007164426.1812530-6-daniel.vetter@ffwll.ch> <20201007165316.GT5177@ziepe.ca> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201007_133327_117681_3C36B2F9 X-CRM114-Status: GOOD ( 18.12 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?B?SsOpcsO0bWU=?= Glisse , linux-s390@vger.kernel.org, linux-samsung-soc , Jan Kara , Pawel Osciak , kvm@vger.kernel.org, John Hubbard , Mauro Carvalho Chehab , LKML , DRI Development , Tomasz Figa , Linux MM , Kyungmin Park , Daniel Vetter , Andrew Morton , Marek Szyprowski , Dan Williams , Linux ARM , "open list:DMA BUFFER SHARING FRAMEWORK" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Oct 07, 2020 at 07:12:24PM +0200, Daniel Vetter wrote: > On Wed, Oct 7, 2020 at 6:53 PM Jason Gunthorpe wrote: > > > > On Wed, Oct 07, 2020 at 06:44:18PM +0200, Daniel Vetter wrote: > > > > > > - /* > > > - * While get_vaddr_frames() could be used for transient (kernel > > > - * controlled lifetime) pinning of memory pages all current > > > - * users establish long term (userspace controlled lifetime) > > > - * page pinning. Treat get_vaddr_frames() like > > > - * get_user_pages_longterm() and disallow it for filesystem-dax > > > - * mappings. > > > - */ > > > - if (vma_is_fsdax(vma)) { > > > - ret = -EOPNOTSUPP; > > > - goto out; > > > - } > > > - > > > - if (!(vma->vm_flags & (VM_IO | VM_PFNMAP))) { > > > - vec->got_ref = true; > > > - vec->is_pfns = false; > > > - ret = pin_user_pages_locked(start, nr_frames, > > > - gup_flags, (struct page **)(vec->ptrs), &locked); > > > - goto out; > > > - } > > > > The vm_flags still need to be checked before going into the while > > loop. If the break is taken then nothing would check vm_flags > > Hm right that's a bin inconsistent. follow_pfn also checks for this, > so I think we can just ditch this entirely both here and in the do {} > while () check, simplifying the latter to just while (vma). Well, just > make it a real loop with less confusing control flow probably. It does read very poorly with the redundant check, espeically since I keep forgetting follow_pfn does it too :\ Jason _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel 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=-3.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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 31FB4C04EBE for ; Thu, 8 Oct 2020 07:21:21 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 BEF3120739 for ; Thu, 8 Oct 2020 07:21:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="I7/owwaB" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BEF3120739 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5AADE6EA49; Thu, 8 Oct 2020 07:21:01 +0000 (UTC) Received: from mail-qv1-xf42.google.com (mail-qv1-xf42.google.com [IPv6:2607:f8b0:4864:20::f42]) by gabe.freedesktop.org (Postfix) with ESMTPS id 008A36E029 for ; Wed, 7 Oct 2020 17:33:25 +0000 (UTC) Received: by mail-qv1-xf42.google.com with SMTP id 13so1599871qvc.9 for ; Wed, 07 Oct 2020 10:33:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=TdSre1+FiF17b2WS+AUXMuyymNAaLTf4uLT17E+pnFU=; b=I7/owwaByfC+T615S4yoAl1o98d1ue1FvXLjxM8yebhh+9JecaDPgFNy3dbnkmB8TN Vzx15ySYhGig+ha8DgJwv0JB9nc9mTmHX7s01XzVMtrzGqF7F5ysx9nVT6a95aQv8luf ubR2OEMsVZaWQ7RmDyyDSLyoP0q7IOFEADlrOkM8v9xk0+G5fAvCgdRAbNUwL2HYX/wg NdxL0Agtty3FgSPu+bQMrdJNei+OMp8ipKgGOhWKyjOjRZlk7D/1NKUJUn0ab2X75jIZ GLdNE/c4Zf4maicgzgeRTMpXMrGmFUZrqUFukx9r5Pv+87LO5DNFvo/M0m7x2mbqppxs Yd4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=TdSre1+FiF17b2WS+AUXMuyymNAaLTf4uLT17E+pnFU=; b=dNaHg92kqUXKjlk64qVusGa6amJ2XZU3XSc79vkdIUDufUk1fSs9oOGRnirP1DjzH9 I6WsgQ7BB7JHPkhnmuGa0XGI8X+r6sABuKSxFFZIkf+gtOnXBRKiOEz9AkMHZN5tNsrC 6OeUnQpRsPuNlEdPYxfBOUUp2iRS3CDZiUnwbE/nPDu446Aorpqic9rXSIy5sIzeTZRO pI+6euB+nqSi82BzaiZj1Ihf6fDpGTRKqOv8NdtKPewEeZuEj5e9YyKHG02GsG4FOFu8 C4reTgXaZeYG9Obs5WwLCZnA0BbpGfbvhBVLNT3NRzDSCSElIt3DNx3wDQGah73PILEe F2Jg== X-Gm-Message-State: AOAM530V3LILL94w9SgWUb/TDCjpbjJTn8lpu2dceopFr4zfzO07a1tl koAAYJQ+zL4TCpWJaw88OMGHFw== X-Google-Smtp-Source: ABdhPJw0qC4HxiG6+lNGoLhXdKRQ6phNXWeAziKb0zM4HKIClbwU3fAgBb5ZP6iA8tkK3T/vsUzqKA== X-Received: by 2002:ad4:456c:: with SMTP id o12mr4490006qvu.48.1602092005183; Wed, 07 Oct 2020 10:33:25 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-156-34-48-30.dhcp-dynamic.fibreop.ns.bellaliant.net. [156.34.48.30]) by smtp.gmail.com with ESMTPSA id 184sm1954180qkl.104.2020.10.07.10.33.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Oct 2020 10:33:24 -0700 (PDT) Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1kQDJb-0010xU-S5; Wed, 07 Oct 2020 14:33:23 -0300 Date: Wed, 7 Oct 2020 14:33:23 -0300 From: Jason Gunthorpe To: Daniel Vetter Subject: Re: [PATCH 05/13] mm/frame-vector: Use FOLL_LONGTERM Message-ID: <20201007173323.GV5177@ziepe.ca> References: <20201007164426.1812530-1-daniel.vetter@ffwll.ch> <20201007164426.1812530-6-daniel.vetter@ffwll.ch> <20201007165316.GT5177@ziepe.ca> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailman-Approved-At: Thu, 08 Oct 2020 07:20:54 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?B?SsOpcsO0bWU=?= Glisse , linux-s390@vger.kernel.org, linux-samsung-soc , Jan Kara , Pawel Osciak , kvm@vger.kernel.org, John Hubbard , Mauro Carvalho Chehab , LKML , DRI Development , Tomasz Figa , Linux MM , Kyungmin Park , Daniel Vetter , Andrew Morton , Marek Szyprowski , Dan Williams , Linux ARM , "open list:DMA BUFFER SHARING FRAMEWORK" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Wed, Oct 07, 2020 at 07:12:24PM +0200, Daniel Vetter wrote: > On Wed, Oct 7, 2020 at 6:53 PM Jason Gunthorpe wrote: > > > > On Wed, Oct 07, 2020 at 06:44:18PM +0200, Daniel Vetter wrote: > > > > > > - /* > > > - * While get_vaddr_frames() could be used for transient (kernel > > > - * controlled lifetime) pinning of memory pages all current > > > - * users establish long term (userspace controlled lifetime) > > > - * page pinning. Treat get_vaddr_frames() like > > > - * get_user_pages_longterm() and disallow it for filesystem-dax > > > - * mappings. > > > - */ > > > - if (vma_is_fsdax(vma)) { > > > - ret = -EOPNOTSUPP; > > > - goto out; > > > - } > > > - > > > - if (!(vma->vm_flags & (VM_IO | VM_PFNMAP))) { > > > - vec->got_ref = true; > > > - vec->is_pfns = false; > > > - ret = pin_user_pages_locked(start, nr_frames, > > > - gup_flags, (struct page **)(vec->ptrs), &locked); > > > - goto out; > > > - } > > > > The vm_flags still need to be checked before going into the while > > loop. If the break is taken then nothing would check vm_flags > > Hm right that's a bin inconsistent. follow_pfn also checks for this, > so I think we can just ditch this entirely both here and in the do {} > while () check, simplifying the latter to just while (vma). Well, just > make it a real loop with less confusing control flow probably. It does read very poorly with the redundant check, espeically since I keep forgetting follow_pfn does it too :\ Jason _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel