Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp2449370pxx; Sat, 31 Oct 2020 22:26:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzpoeHGI5pzfWdKkXVfjh23Xs7nX1D9k1vE6vAAYktfCdLX+Dk33VzYQYOgSei/dMVd+iQh X-Received: by 2002:a17:906:c094:: with SMTP id f20mr10073293ejz.550.1604208373535; Sat, 31 Oct 2020 22:26:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1604208373; cv=none; d=google.com; s=arc-20160816; b=qPK8lq64al1OHlHzRulZxECEhJ1N0ukkJc1fainEW8qo3c1EHGW2Qk/jMntwgY4mOu OQqKVzSM++NH7Drm2tFNAXZ5fh0vHT+mhtHM6zhA9Egn/witNz8/yy29AVsdrAiB8OhT weXTXzlGhICVID6kl/RnkqiYNWtNLW5I8YhEhKRkZQe/D74rA86X34Chrxqz/W84zc95 ou0ND7JbXl7R3ptrQesAu8XhfhRWPeVIAYgfGq9DqaaBSopydSsCdI8SSFNRaJ0eXm90 TQm97D4ezm+PjyMdPpZeOKd43nZpCczrcx5QIHJu3wfxiFNYKrBRXJxUPD6G89ewNCZr iOdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:dkim-signature:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=BviMObXYl4DBSbzSpkoK8hvibl+1Fsc4El3qoj9SER4=; b=gvLZvNsxV298A8HxR4vLHRKPgQo/vbTKp2GLmMwJtSUU/KjXOpRuYamKUAywMyMm5N Xd8Hn6S9H78jiho31Dml6vskLAIw28SyqEcVFCuJDDtr6qgDlQtHIdTwZ2PlAsqgq9ou EVr8TndxRGCpXCGJ1vg3OBgmJOiVVR3uIqf94sDmaAcLl0KbrAS9CX64/6FJx0k8BbI9 j/9vO4ZNlwtyYjt66pDtxS4quh5O+64pZR96wc5f1ksO2JxQvfg5e91Lsqi3LPTwqcDa SORTXRxhruZI7xSB/i0UIDpGZ2Ll7OFFUPdRqKszZht8Eod/dHXFLaN4fYuV72kgMeSg UtaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=GDRHpOkp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id da5si9493474edb.595.2020.10.31.22.25.14; Sat, 31 Oct 2020 22:26:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=GDRHpOkp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726886AbgKAFWU (ORCPT + 99 others); Sun, 1 Nov 2020 01:22:20 -0400 Received: from hqnvemgate25.nvidia.com ([216.228.121.64]:8613 "EHLO hqnvemgate25.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726117AbgKAFWS (ORCPT ); Sun, 1 Nov 2020 01:22:18 -0400 Received: from hqmail.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate25.nvidia.com (using TLS: TLSv1.2, AES256-SHA) id ; Sat, 31 Oct 2020 22:22:19 -0800 Received: from [10.2.59.55] (10.124.1.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Sun, 1 Nov 2020 05:22:12 +0000 Subject: Re: [PATCH v5 05/15] mm/frame-vector: Use FOLL_LONGTERM To: Daniel Vetter CC: DRI Development , LKML , KVM list , Linux MM , Linux ARM , linux-samsung-soc , "open list:DMA BUFFER SHARING FRAMEWORK" , Daniel Vetter , Jason Gunthorpe , Pawel Osciak , Marek Szyprowski , "Kyungmin Park" , Tomasz Figa , "Mauro Carvalho Chehab" , Andrew Morton , =?UTF-8?B?SsOpcsO0bWUgR2xpc3Nl?= , Jan Kara , Dan Williams References: <20201030100815.2269-1-daniel.vetter@ffwll.ch> <20201030100815.2269-6-daniel.vetter@ffwll.ch> <446b2d5b-a1a1-a408-f884-f17a04b72c18@nvidia.com> From: John Hubbard Message-ID: <1f7cf690-35e2-c56f-6d3f-94400633edd2@nvidia.com> Date: Sat, 31 Oct 2020 22:22:11 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.124.1.5] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To HQMAIL107.nvidia.com (172.20.187.13) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1604208139; bh=BviMObXYl4DBSbzSpkoK8hvibl+1Fsc4El3qoj9SER4=; h=Subject:To:CC:References:From:Message-ID:Date:User-Agent: MIME-Version:In-Reply-To:Content-Type:Content-Language: Content-Transfer-Encoding:X-Originating-IP:X-ClientProxiedBy; b=GDRHpOkpxs1Ufq2SOGdgYR/E9XR+fbuJ8LSdEQnzZVakY5/3RHLrlV0EUPacqB1hx sgcaxSS6kL92YgOCYxV61/vKgMeyJzWv3pbsiGOiPG2yzztyrS+M509X+WJsspP0iX eGYfmD7CUw9Sc7vfW/dXMJFEk0m7LtD6SNXFGO5vEh2idfKwEVzJ6ZAWx2tcCRv74B z9sCh7r8+3axv5dd8sfK1ThmV84FPNw8fCBM1IYOZ3eSLI6P+VCNYX5tGFWyGGRpnN ra2SHoMsB7AY6QbBfc+xZFCAcf9OI3Wzgrvev7r6iT4kkq15E1JGpS1HdFytcI+8SG 6LGq3w3+17JOQ== Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/31/20 7:45 AM, Daniel Vetter wrote: > On Sat, Oct 31, 2020 at 3:55 AM John Hubbard wrote: >> On 10/30/20 3:08 AM, Daniel Vetter wrote: ... >> By removing this check from this location, and changing from >> pin_user_pages_locked() to pin_user_pages_fast(), I *think* we end up >> losing the check entirely. Is that intended? If so it could use a comment >> somewhere to explain why. > > Yeah this wasn't intentional. I think I needed to drop the _locked > version to prep for FOLL_LONGTERM, and figured _fast is always better. > But I didn't realize that _fast doesn't have the vma checks, gup.c got > me a bit confused. Actually, I thought that the change to _fast was a very nice touch, btw. > > I'll remedy this in all the patches where this applies (because a > VM_IO | VM_PFNMAP can point at struct page backed memory, and that > exact use-case is what we want to stop with the unsafe_follow_pfn work > since it wreaks things like cma or security). > > Aside: I do wonder whether the lack for that check isn't a problem. > VM_IO | VM_PFNMAP generally means driver managed, which means the > driver isn't going to consult the page pin count or anything like that > (at least not necessarily) when revoking or moving that memory, since > we're assuming it's totally under driver control. So if pup_fast can > get into such a mapping, we might have a problem. > -Daniel > Yes. I don't know why that check is missing from the _fast path. Probably just an oversight, seeing as how it's in the slow path. Maybe the appropriate response here is to add a separate patch that adds the check. I wonder if I'm overlooking something, but it certainly seems correct to do that. thanks, -- John Hubbard NVIDIA