Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4303266imm; Mon, 18 Jun 2018 12:33:10 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJJ5iKAX/kLm0jIe8App/k1fk97lVI2ISew13DXP/u0Yc970yxVAK0jPhgMwRIv4tuJLCZ/ X-Received: by 2002:a62:e816:: with SMTP id c22-v6mr14731879pfi.124.1529350390888; Mon, 18 Jun 2018 12:33:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529350390; cv=none; d=google.com; s=arc-20160816; b=0CJY/SdyQU/1UfrXfl983V1rEC5ylo2/iDQTPCU+ksY3A8EzlF5RWycISEHRhibf0O G3KTnpfiqluTLxbzETPQIytxVpem/L5gNw0eV4q4rVTB1eiuXaCfgozWdHLC9v+ly6a2 iXOLLnVWxbHFohL/NLH+RQqcOJKN1O2JPUu45FHMnlxCmwKasug4WrhRYXRaSng0l+gr PLkz31xRUX7JO4d0bcXay8B2KNfJkodP0LTb9xiVjAQCGKYeW3AR3Zo9KPpJCRAeg3jg QPI0n7DJXLEfa+EveqAnflQRzCMI2gx8zvFrM/Xqq/PdO288KvyAXdbhsq+ieQtOk8c8 iPAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=BFIL8fYqv5EECsFWtaoAgr3hcwTQIzajnx3mIeiDiW0=; b=EEQu33qWOxFZrNLLm/ScIoPKCVRqCOouKQAzF5agCbRbsgIbn55yAfU9F5nV9fACV0 dGa25YLgrTG+bQrHGK/8T06cPzGQGsyJdNjuEFrwMPSKIGsRtG6MWfUFhpY4sm9fYVmQ HfJWmGDVbqip7ucoUVityVPUnSEt3I5mpNaLQ6tkRhGecx1ClLvTg8JQCSlyX1JLwMZ/ RcpXE3y8rtXhDlkM0HBexw2imq4o7KLoetbTE4XtNbexBv7373b9fqgGoDpKIW4VPDrD 7fpiTkbAdb7MmAPnnyDvgFMWaDDhgvO7mZo6M03u35ixf+Owc8lFsBkh7yEO+N4uxvrq M8kg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=AXwFGIuQ; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b18-v6si11858167pgs.417.2018.06.18.12.32.57; Mon, 18 Jun 2018 12:33:10 -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=@ziepe.ca header.s=google header.b=AXwFGIuQ; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936469AbeFRTcH (ORCPT + 99 others); Mon, 18 Jun 2018 15:32:07 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:33254 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936376AbeFRTcF (ORCPT ); Mon, 18 Jun 2018 15:32:05 -0400 Received: by mail-wr0-f196.google.com with SMTP id k16-v6so18032892wro.0 for ; Mon, 18 Jun 2018 12:32:04 -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:user-agent; bh=BFIL8fYqv5EECsFWtaoAgr3hcwTQIzajnx3mIeiDiW0=; b=AXwFGIuQWWxl8K8rm/7rIlSFEc5LLbO832MaUDGSK/Bb0KvDdPcEXGfXAEYWi1UO/r h+MSmEqYlBgPOuEcFeHv4SP/yuMwdV0igeDrYemO/vPHJGDCjYVvS0zsoffoU4cM5ROj XOl9/SiMS8BBi9sn6tsS+TgJZ5gfdDLujZ5h8g6Z9C1XLz4sZH+ujD4G1HiKfgdhAcfQ dSFkdfiySvoHZx9UlGohRU4Ik036sBVYILY3txd5IF/b6CDHeUrWMHFEJlH3KoJlCF84 OONiN4gHObd+zZWYcRjAoSKjJoIYgRlzkD7RNorVtl2FpmPLI6fyOxT5rCufmYXwQ/Gv sCxg== 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:user-agent; bh=BFIL8fYqv5EECsFWtaoAgr3hcwTQIzajnx3mIeiDiW0=; b=aiYYVqy2uoHHfu0Cg6JRBE2RmJdPW1S5AimP4SSbwVfuvVFWO7taOVekl3Pw3+QH+x RmBhob3mqLuBsL2LMH/xpZbh7MJB8gC1HSa0Fq8C1yd2Fm1s23RTeI3BghoO5MK/cgOd hwkB17ljY0epad7f9uoAeg0seMpIyYi8LVi16Wnnn8k9Vl7Heeyurn7F8gyMu4OLG5Aa V/Ll2A+xJTAb6EeY5fM6wi5YsN2TsRiixsw6/P8YdmHvHTYyMkY8EAE+Fc6rO29UadDH CfvZi89/Ac8QmQMsAy6vlol1+MBpbHfHWjRJ39An3qLcNYNWl3qTEwpk1P5AtQEKdkjW biHg== X-Gm-Message-State: APt69E0+oIeTyAeBxuJ1sG75CT9t3YAxwOGdZBJQkxzXRiC/nxhZBqXV HEslE+tV+DFLwFEMBCyO+vnAsQ== X-Received: by 2002:adf:c844:: with SMTP id e4-v6mr11286868wrh.236.1529350323867; Mon, 18 Jun 2018 12:32:03 -0700 (PDT) Received: from ziepe.ca (S010614cc2056d97f.ed.shawcable.net. [174.3.196.123]) by smtp.gmail.com with ESMTPSA id k17-v6sm12042846wmc.23.2018.06.18.12.32.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Jun 2018 12:32:03 -0700 (PDT) Received: from jgg by mlx.ziepe.ca with local (Exim 4.86_2) (envelope-from ) id 1fUzsc-0002vO-Lu; Mon, 18 Jun 2018 13:31:58 -0600 Date: Mon, 18 Jun 2018 13:31:58 -0600 From: Jason Gunthorpe To: Dan Williams Cc: John Hubbard , Christoph Hellwig , John Hubbard , Matthew Wilcox , Michal Hocko , Christopher Lameter , Jan Kara , Linux MM , LKML , linux-rdma Subject: Re: [PATCH 2/2] mm: set PG_dma_pinned on get_user_pages*() Message-ID: <20180618193158.GE6805@ziepe.ca> References: <20180617012510.20139-3-jhubbard@nvidia.com> <20180617200432.krw36wrcwidb25cj@ziepe.ca> <311eba48-60f1-b6cc-d001-5cc3ed4d76a9@nvidia.com> <20180618081258.GB16991@lst.de> <3898ef6b-2fa0-e852-a9ac-d904b47320d5@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 18, 2018 at 12:21:46PM -0700, Dan Williams wrote: > On Mon, Jun 18, 2018 at 11:14 AM, John Hubbard wrote: > > On 06/18/2018 10:56 AM, Dan Williams wrote: > >> On Mon, Jun 18, 2018 at 10:50 AM, John Hubbard wrote: > >>> On 06/18/2018 01:12 AM, Christoph Hellwig wrote: > >>>> On Sun, Jun 17, 2018 at 01:28:18PM -0700, John Hubbard wrote: > >>>>> Yes. However, my thinking was: get_user_pages() can become a way to indicate that > >>>>> these pages are going to be treated specially. In particular, the caller > >>>>> does not really want or need to support certain file operations, while the > >>>>> page is flagged this way. > >>>>> > >>>>> If necessary, we could add a new API call. > >>>> > >>>> That API call is called get_user_pages_longterm. > >>> > >>> OK...I had the impression that this was just semi-temporary API for dax, but > >>> given that it's an exported symbol, I guess it really is here to stay. > >> > >> The plan is to go back and provide api changes that bypass > >> get_user_page_longterm() for RDMA. However, for VFIO and others, it's > >> not clear what we could do. In the VFIO case the guest would need to > >> be prepared handle the revocation. > > > > OK, let's see if I understand that plan correctly: > > > > 1. Change RDMA users (this could be done entirely in the various device drivers' > > code, unless I'm overlooking something) to use mmu notifiers, and to do their > > DMA to/from non-pinned pages. > > The problem with this approach is surprising the RDMA drivers with > notifications of teardowns. It's the RDMA userspace applications that > need the notification, and it likely needs to be explicit opt-in, at > least for the non-ODP drivers. Well, more than that, we have no real plan on how to accomplish this, or any idea if it can even really work.. Most userspace give up control of the memory lifetime to the remote side of the connection and have no way to recover it other than a full teardown. Given that John is trying to fix a kernel oops, I don't think we should tie progress on it to the RDMA notification idea. .. and given that John is trying to fix a kernel oops, maybe the weird/bad/ugly behavior of ftruncte is a better bug to have than for unprivileged users to be able to oops the kernel??? Jason