Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3181982imm; Sun, 17 Jun 2018 13:11:43 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLvrbFr3rSWhVDR7KM1eY0nqp4rbvcg8NBJBBa5wIZGXv68+KxiT/uzFChtigU5ROwCwhNv X-Received: by 2002:a63:70a:: with SMTP id 10-v6mr8977377pgh.216.1529266303172; Sun, 17 Jun 2018 13:11:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529266303; cv=none; d=google.com; s=arc-20160816; b=DnPmPR9FDawwKZaUbFny7ms2mZ2uqb2rwrhJm96hK9X1z0z+8a+a8elfatM2wOc+uK 3ra/QcDOufVVZtXbVnIsQBWtlVqrqA5ZZy/YH2UUIvUaK5jgtSzZ1wTIcY9hbWC1O6Tw TCjelytkEcFkOPh6H7IyoHmZfg22XD1bzSESaM4rBwF/864z5hhiwvZ15Y5i/bwpiuDm x8eWIA+x1U8LBjSNSAcfm1+SrK/4iVOGFzEtObxK9pe/tfaOX5ikhObnmZNfrQILp8VX b1h5/zGhQMy8/oYfiJ1RgTJj9rCb68B1cxCuHX53LpntuVOXAH9mD3vaYK4mNVgslnl7 lzXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=GVZefsCHLq2Ewe4eFfdTEudwvKBKJYNRroBA9WyEBco=; b=FVrU6Zjb6fn+uJMRQoAq9HN6M9ymYnAGIlc+8bFPGD5O2r7yU1Uc6pkJCbNX2q0zOw +f6G3tiXar8t4E/qsl+UZPorQNaFLKIZDqjyiGSLTEZ9O+bpsvuBrPqwXQojkAn7SysK Ox+G39vYylcGoBA7q8UyzcxSQ7naFsbrX6wldk/mkEenQ0JduxFQvSGEru5ODgR/5M9C uIaWukLvbtAxu4tU185XRFzN9v6XBx0s2eShBdj2Ut6IjHxYB2DtVFgOUlwEwOHXdI9F SGzuPR+FvwlPH4GCIhpzZu5u4ndStVfmkRcDdCSKMvp9DPA4JKgIkzOm6EplyaBvzqZw qkeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=EZPKwHOa; 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k3-v6si10692484pgq.28.2018.06.17.13.11.26; Sun, 17 Jun 2018 13:11:43 -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; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=EZPKwHOa; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934221AbeFQUKI (ORCPT + 99 others); Sun, 17 Jun 2018 16:10:08 -0400 Received: from mail-ot0-f193.google.com ([74.125.82.193]:43440 "EHLO mail-ot0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933406AbeFQUKF (ORCPT ); Sun, 17 Jun 2018 16:10:05 -0400 Received: by mail-ot0-f193.google.com with SMTP id i19-v6so16269034otk.10 for ; Sun, 17 Jun 2018 13:10:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=GVZefsCHLq2Ewe4eFfdTEudwvKBKJYNRroBA9WyEBco=; b=EZPKwHOaX0d6JU82cImInUG+eQcPSS2hCY3BHUnZtVaq/w8oiks6mZR8KEZYS2liYM 0Z9YIU59pYA/hMzlhuxEwOOfYik9K9HnI58sYDsXCuuh5KU0A4ERm3C3E+K/698pNqXU 6TZ32t8VR8E2/XhPdF/xRkol9agtiZ3SeeeVBpkXdoXmlQr4SPIsqxQ0Fp/9BlBUwjPw kw/QGjgvse52yqWskuElrFTSGUsYMmv5jhsEEbDs5t6dMlCB6l2VyY8wOUyBm/4A4y9K wBfM7QZex8yotATdBlFb+wrP+RlXoTSxkYOobEIOv6473NkYhi2C53bBQUw112TDL+cr h4Lw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=GVZefsCHLq2Ewe4eFfdTEudwvKBKJYNRroBA9WyEBco=; b=KzFY529ftssWgAed8E012U3uPBUw5Z/3eAM7QGj9q9WuQ1q/1cQFch7xk/5fvkJhLy FJGrpKr6ROvHy6KAZPfZCHDfQ9x7H+MGl6Oeq7R6XxSRz5EdctqC9+OltlkD553VA8wo rPa6uLFXybE9Tj8OXBGXYW/t+IoS/5ckS0lg4/8hA9wNg+WWMkX6AE1lmm96ZPD0Uv/s D+/YFtWGB/8bCDk+iSEGWAKVqRcqa4KRIzYsRW0T0s0OMEFQKmwpHp3+SSXnb6vUQvNs eQKf3pqvtMD8LQvrqB55MV8i7ZmPhauVvs31plCEShlZoAgYOML8lvhsw5G6CqMLdQA6 1MhQ== X-Gm-Message-State: APt69E2328KBIudOlAMahJtsXrWNMRh8mYWynJcemKnofH3G4OzgUnCv K18CgtZLdYZjgeVJsa80ckjqGxLarQFLS9vUskvPsQ== X-Received: by 2002:a9d:32ca:: with SMTP id u68-v6mr6548120otb.117.1529266204966; Sun, 17 Jun 2018 13:10:04 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a9d:2ea9:0:0:0:0:0 with HTTP; Sun, 17 Jun 2018 13:10:04 -0700 (PDT) In-Reply-To: <20180617200432.krw36wrcwidb25cj@ziepe.ca> References: <20180617012510.20139-1-jhubbard@nvidia.com> <20180617012510.20139-3-jhubbard@nvidia.com> <20180617200432.krw36wrcwidb25cj@ziepe.ca> From: Dan Williams Date: Sun, 17 Jun 2018 13:10:04 -0700 Message-ID: Subject: Re: [PATCH 2/2] mm: set PG_dma_pinned on get_user_pages*() To: Jason Gunthorpe Cc: john.hubbard@gmail.com, Matthew Wilcox , Michal Hocko , Christopher Lameter , Jan Kara , Linux MM , LKML , linux-rdma , John Hubbard , Christoph Hellwig Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jun 17, 2018 at 1:04 PM, Jason Gunthorpe wrote: > On Sun, Jun 17, 2018 at 12:53:04PM -0700, Dan Williams wrote: >> > diff --git a/mm/rmap.c b/mm/rmap.c >> > index 6db729dc4c50..37576f0a4645 100644 >> > +++ 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. > > This might be the right answer for certain things, but it shouldn't be > the immediate reaction to everthing. There are many user APIs that > block kernel actions and hold kernel resources. > > IMHO, there should be an identifiable objection, eg is blocking going > to create a DOS, dead-lock, insecurity, etc? I believe kernel behavior regression is a primary concern as now fallocate() and truncate() can randomly fail where they didn't before.