Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3262784imm; Sun, 17 Jun 2018 15:23:24 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLPWmJbCqFaeFzZ9gBPIEfNazXlsNEjjRdvFeYfFbkPyI2EnEpEAu6+1EW7khoIrr/G3vol X-Received: by 2002:a63:ae06:: with SMTP id q6-v6mr8994738pgf.255.1529274204252; Sun, 17 Jun 2018 15:23:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529274204; cv=none; d=google.com; s=arc-20160816; b=tc6oZUzIaSdh/QK6HdODTTT3UCxzWkFhFgZw3eu88Z4RnwpHUsJQjvc7LxZUUTOYP1 jF2FuRb3PHrxYXrpZoQ+lPzk9Kqmj8OJSKb+vv2Frf/NMUoXQx54WbL1kGcvDoeQ78TU JXQUfponYivMbNClR5wbn4S5KP9E3J8XG0klg4e38+zlOMlF4+w+fwYpw+IQa09IELRR 6s32hackp9p9XoA3FmKSBBGx2WTrJI7l65ziExW5aBNAZIaKx/CYql1NAQJfRAlZQE/a zKtyu4tjKIfzt07GS8xWgD0RG1glJnndIX4CbpqHRrD4IO/tgZ8PvETaP+4Wh8wSa5EI 7R+w== 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=K+3GqWCVj+Oa39e5sfM+97TyV+0wsx4m4/jqBZGXoDw=; b=f009GPva42igtTQUVihutFUS7hW06mH2RSYc0Q8/H+MKjYNmyoLQ39myfEsCZx4ZQG kjlL5n0C0wU1yYvw+7VdsyDsLc0RAgAKRVQUwRL7NXcIW/s1DZ6DtH/0znXU/++DQfNZ mPy6LdgpHx/3zncUICyS0Jq+x6hCY6oxLE3NRClKLzKjSq/ssedPExKrQhfkUb+NUee6 lNiG46DtkfiEIUdWd/h/dEjj93yOCrLX3OdPSXGhzSwixNvzvb6m43G8PZW98mpp+G/0 3ZkW289VtGaNxFVx5gY3sdOYMzVQ/e8jenw5ShIrSi5foJ+BMc+fY6Ludcg0d8R9DWnQ PStw== 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 d6-v6si10485853pgn.493.2018.06.17.15.23.09; Sun, 17 Jun 2018 15:23:24 -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 S1754053AbeFQWUP (ORCPT + 99 others); Sun, 17 Jun 2018 18:20:15 -0400 Received: from hqemgate14.nvidia.com ([216.228.121.143]:19307 "EHLO hqemgate14.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751659AbeFQWUN (ORCPT ); Sun, 17 Jun 2018 18:20:13 -0400 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate14.nvidia.com (using TLS: TLSv1, AES128-SHA) id ; Sun, 17 Jun 2018 15:20:19 -0700 Received: from HQMAIL107.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Sun, 17 Jun 2018 15:20:13 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Sun, 17 Jun 2018 15:20:13 -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; Sun, 17 Jun 2018 22:20:12 +0000 Subject: Re: [PATCH 2/2] mm: set PG_dma_pinned on get_user_pages*() To: Dan Williams , CC: Matthew Wilcox , Michal Hocko , Christopher Lameter , Jason Gunthorpe , Jan Kara , Linux MM , LKML , linux-rdma , Christoph Hellwig References: <20180617012510.20139-1-jhubbard@nvidia.com> <20180617012510.20139-3-jhubbard@nvidia.com> X-Nvconfidentiality: public From: John Hubbard Message-ID: <817a7466-2abb-bc95-e7de-269420841c9b@nvidia.com> Date: Sun, 17 Jun 2018 15:19:51 -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: X-Originating-IP: [10.2.175.123] X-ClientProxiedBy: HQMAIL104.nvidia.com (172.18.146.11) 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 On 06/17/2018 12:53 PM, Dan Williams wrote: > [..] >> diff --git a/mm/rmap.c b/mm/rmap.c >> index 6db729dc4c50..37576f0a4645 100644 >> --- a/mm/rmap.c >> +++ b/mm/rmap.c >> @@ -1360,6 +1360,8 @@ static bool try_to_unmap_one(struct page *page, struct vm_area_struct *vma, >> flags & TTU_SPLIT_FREEZE, page); >> } >> >> + if (PageDmaPinned(page)) >> + return false; >> /* >> * We have to assume the worse case ie pmd for invalidation. Note that >> * the page can not be free in this function as call of try_to_unmap() > > We have a similiar problem with DAX and the conclusion we came to is > that it is not acceptable for userspace to arbitrarily block kernel > actions. The conclusion there was: 'wait' if the DMA is transient, and > 'revoke' if the DMA is long lived, or otherwise 'block' long-lived DMA > if a revocation mechanism is not available. > Dan, thanks...can you please say a few words (or point to the code) about the "revoke" part of this design? And whether you think it could be applied here (instead of the unconditional appproach I have above)?