Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4200004imm; Mon, 18 Jun 2018 10:45:55 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJNbL4TOyVa6IiMW1xRqnWgs/5WY9/m/ujlxupLO0BZkVFPKnRHTZLb3R13nIHGQJc5H1uX X-Received: by 2002:a17:902:f83:: with SMTP id 3-v6mr14937307plz.282.1529343955876; Mon, 18 Jun 2018 10:45:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529343955; cv=none; d=google.com; s=arc-20160816; b=SiEn62DHN25AWrx4qOuT7g8nIuxhxQ0Hj92ieQkzfWS1ox2F+vpr23oCdgDBVgxGtE eU0ooXI0JBTYLJyTl1tydDhDgfXt58056HPTbvbwDokN7YWUN/SV9WZinbsw5xWQualo K29EIJkm8iccd9wmzTIoacVJQbPgVpQAxeFuVEr1OU39qqnR1sTwhvQcKjiqw+MbIDYR 6SOQRzsq9X2FvHy5HKoy4hBcPBIaauPqyTcpNuGPxfsKA1Q7jjC+aIeHA3lzhr6WKAS2 vCXbu3mIWhs5fdcdLLd4p1209WnLAQwn4gXMUGZalp0e84PBMUVRZBNR4Xe6BmKpqBGu K0TQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=yARIz2yPyOuG/vlu79vx3NrcPaKLkOmDUbOUqJ0qWtY=; b=u/MLP22vZXPH/bJYhrq0piA9KwBr93I4ZhAp85M9+arHy1asDaBa03SnZl+gWTtZyM m9uvch32yQViNpb3f1WsSbHn0zs3JQM1U+8Z02k7IiJhyDZYkf3p6Ojls4fJ2Vfcuu1i aF2FnnoHW5bSLNWH8w4da/+m/v9l3TGDcAH8SacBSDCcMnlLAEyaFs6QUlylJXNEv13X U6+lEH4z7qYEaO6hK81QrkOlqCm53Eamsq1CWNOISg+1s4j73X4jO5tf7L+E1zHMJ5no yk2Wa09npsWiptRIyppEd+nftQSGRLx7bnwWVqBFE0u3NgXHFL5ACtnrANk2B2ZepDb8 munA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bc12-v6si14800737plb.373.2018.06.18.10.45.41; Mon, 18 Jun 2018 10:45:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935576AbeFRRow (ORCPT + 99 others); Mon, 18 Jun 2018 13:44:52 -0400 Received: from hqemgate14.nvidia.com ([216.228.121.143]:19801 "EHLO hqemgate14.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934957AbeFRRou (ORCPT ); Mon, 18 Jun 2018 13:44:50 -0400 Received: from hqpgpgate102.nvidia.com (Not Verified[216.228.121.13]) by hqemgate14.nvidia.com (using TLS: TLSv1, AES128-SHA) id ; Mon, 18 Jun 2018 10:44:56 -0700 Received: from HQMAIL107.nvidia.com ([172.20.161.6]) by hqpgpgate102.nvidia.com (PGP Universal service); Mon, 18 Jun 2018 10:44:54 -0700 X-PGP-Universal: processed; by hqpgpgate102.nvidia.com on Mon, 18 Jun 2018 10:44:54 -0700 Received: from [10.2.175.123] (10.2.175.123) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Mon, 18 Jun 2018 17:44:49 +0000 Subject: Re: [PATCH 2/2] mm: set PG_dma_pinned on get_user_pages*() To: Christoph Hellwig , CC: Matthew Wilcox , Michal Hocko , Christopher Lameter , Jason Gunthorpe , Dan Williams , Jan Kara , , LKML , linux-rdma References: <20180617012510.20139-1-jhubbard@nvidia.com> <20180617012510.20139-3-jhubbard@nvidia.com> <20180618075650.GA7300@infradead.org> X-Nvconfidentiality: public From: John Hubbard Message-ID: <7295d9c3-ecc3-ae60-1818-72b0565741ff@nvidia.com> Date: Mon, 18 Jun 2018 10:44:28 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20180618075650.GA7300@infradead.org> X-Originating-IP: [10.2.175.123] X-ClientProxiedBy: HQMAIL102.nvidia.com (172.18.146.10) To HQMAIL107.nvidia.com (172.20.187.13) Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Christoph, Thanks for looking at this... On 06/18/2018 12:56 AM, Christoph Hellwig wrote: > On Sat, Jun 16, 2018 at 06:25:10PM -0700, john.hubbard@gmail.com wrote: >> From: John Hubbard >> >> This fixes a few problems that come up when using devices (NICs, GPUs, >> for example) that want to have direct access to a chunk of system (CPU) >> memory, so that they can DMA to/from that memory. Problems [1] come up >> if that memory is backed by persistence storage; for example, an ext4 >> file system. I've been working on several customer bugs that are hitting >> this, and this patchset fixes those bugs. > > What happens if we do get_user_page from two different threads or even > processes on the same page? As far as I can tell from your patch > the first one finishing the page will clear the bit and then we are > back to no protection. The patch does not do that. The flag is only ever cleared when the page is freed. That can't happen until each of the two threads above is done and calls put_page(). So while there may be other design issues here, the above case is not one of them. :) thanks, -- John Hubbard NVIDIA