Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp8122900ybi; Thu, 6 Jun 2019 07:06:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqwgVbBInOoSYYv86unXNFcnyQUBbpm/yDBEpYiilpF0KTEteQYjOI8d+uE6ZxOxxeOKlqU0 X-Received: by 2002:a17:90a:b294:: with SMTP id c20mr113127pjr.16.1559829999013; Thu, 06 Jun 2019 07:06:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559829999; cv=none; d=google.com; s=arc-20160816; b=STELFJEDp2ObjgCVULzSIdY9RNQsxnuI0p1RF8mVuedg2bzn5CemRXp7BqeOgn2Hsy WWLjvaq7wAN9WhobAJsi8vvEDDt+/eRBCx0Ey/yJY6cMMqpfdDMK06xNQwI2BaHFl0A9 slriGp9kw+EMhWKl3YPWpFQI7Xsc4901mVlVOSRoXMyrqeEEUOrbFI9YLJYZY+w0xqr1 0gBSWC2JR9rJtJ7IrnckzgpHfhcvNPiUiFyIEOHYgAL8FbdksNrLZ2TChpZrwnM7A/B6 2/X0P97ZgpE1NPgbKV4AMmaNBocd1OB1/LgB8dVGP+QqKXrVGjriVlCqKL9FvQ4ixtTq neKg== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=QdQp9sTpwMz8UO4D5YUcHQREajmmZNXe+7QIFqHQYOg=; b=y/XS8oouYPomViqBLAd05P4yjFp65d1aSmg0iOe7NoFT6Rz62MgpI1NFhVXIs1MpX1 xCuqPPWfh+qwJ+IrS+ajc0HucCyZ+cboBStPXgaEQZ3zRPURMjNKLMY+4D0RW7iT8wuw v3MPBI3jZKzSxexpdbOTidgdaKGQQ5pdbwg5FAh5Hj/rbvCMGe9kQKyzpIxiUvcMdZ5U OtnY/ML0p4RDjnOg6tvDg187EPBEYjXHYr48NPGV2U2W8EaBxFDl3b+empAkPWBoxyBz ZGBlhDiVFGOIbdbOwdlR+CWJMjqlCKz8YBisZtmiK9R6+lZp5sRHHE1Lp0RiT26QycIR X3Xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=Z4mSKHb6; 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 v1si1922612pfv.202.2019.06.06.07.06.19; Thu, 06 Jun 2019 07:06:38 -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=Z4mSKHb6; 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 S1727961AbfFFOCm (ORCPT + 99 others); Thu, 6 Jun 2019 10:02:42 -0400 Received: from mail-qk1-f193.google.com ([209.85.222.193]:40666 "EHLO mail-qk1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726014AbfFFOCm (ORCPT ); Thu, 6 Jun 2019 10:02:42 -0400 Received: by mail-qk1-f193.google.com with SMTP id c70so1484868qkg.7 for ; Thu, 06 Jun 2019 07:02:41 -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:content-transfer-encoding:in-reply-to :user-agent; bh=QdQp9sTpwMz8UO4D5YUcHQREajmmZNXe+7QIFqHQYOg=; b=Z4mSKHb689Oa8wMsTSv8toDWQrSLWCOp4zbPJwy4y9UoJFEXs7wpQZQ5rgvYg6mVHS Sm2B76oIRwgW9aLuwMNaWMyoADojdaTXc0ddXyBvRk86gopNn2GBLOgznkPpOHCCSmms 1iH1JG0gDtz9WjybUoTKMqUOZ2sf5t5ouiIdwcHV41TM4ejRF9TkPhxUUkhOCGDBB4qD C9Nmvye3UQy2AlTqrndiuN31xF+Xg60atJPHCrBOnYvKtqEKJabPNGI2YqKh8zQ0SWxl FU5XasPYs56HDr2kTd7khg1Bmstq3VQz1HzKPTywPoL03FdeUFixpUyX0I/AV0XKW+GW yyrA== 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:content-transfer-encoding :in-reply-to:user-agent; bh=QdQp9sTpwMz8UO4D5YUcHQREajmmZNXe+7QIFqHQYOg=; b=WgQ/Xk3gucC0/lzVVxdMPQm3+A5GmvywGJuctrs3+qOuld0fKdsELsN1qKVlfk/UFO xpCqy5yxM/CBibuwnHXQpM+nd8LkfHnGFkWeR1XNV/WYtdfkwlDNmDWzWkQ2rTX4yFKQ b5Vkw9jqx9YUl23mjf/ZAvclTz4FYyDeIAOydIog5z2ZOkY3xsbtTapGdsOcK5CiVxr3 E4VNbuzZzVgYGxN0KGQ/TNx7Gh0S4sPChCZ6jR+IsPPOSzMfqSpov3hqyFzt3lgQXmYk jTEtmLCvTkvH+xQkhGtS7qyKU2gcuWGWDHOfJvhqO8BLUhFvp/BYFkeNS4YbYgib+YrL C89Q== X-Gm-Message-State: APjAAAXZVuRgLapvoEKW5UmoTCLRv0wfIANmc5eI+sFE+Zv6h1ytjNYm o5xyWa9rKX8Azv6kKAhuoGUE5g== X-Received: by 2002:ae9:e20c:: with SMTP id c12mr38555647qkc.210.1559829761101; Thu, 06 Jun 2019 07:02:41 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-156-34-55-100.dhcp-dynamic.fibreop.ns.bellaliant.net. [156.34.55.100]) by smtp.gmail.com with ESMTPSA id l3sm902129qkd.49.2019.06.06.07.02.40 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 06 Jun 2019 07:02:40 -0700 (PDT) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1hYsyV-00064G-JQ; Thu, 06 Jun 2019 11:02:39 -0300 Date: Thu, 6 Jun 2019 11:02:39 -0300 From: Jason Gunthorpe To: rcampbell@nvidia.com Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, John Hubbard , Ira Weiny , Dan Williams , Arnd Bergmann , Balbir Singh , Dan Carpenter , Matthew Wilcox , Souptick Joarder , Andrew Morton , =?utf-8?B?SsOpcsO0bWU=?= Glisse Subject: Re: [PATCH 1/5] mm/hmm: Update HMM documentation Message-ID: <20190606140239.GA21778@ziepe.ca> References: <20190506232942.12623-1-rcampbell@nvidia.com> <20190506232942.12623-2-rcampbell@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190506232942.12623-2-rcampbell@nvidia.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 06, 2019 at 04:29:38PM -0700, rcampbell@nvidia.com wrote: > From: Ralph Campbell > > Update the HMM documentation to reflect the latest API and make a few minor > wording changes. > > Signed-off-by: Ralph Campbell > Reviewed-by: Jérôme Glisse > Cc: John Hubbard > Cc: Ira Weiny > Cc: Dan Williams > Cc: Arnd Bergmann > Cc: Balbir Singh > Cc: Dan Carpenter > Cc: Matthew Wilcox > Cc: Souptick Joarder > Cc: Andrew Morton > Documentation/vm/hmm.rst | 139 ++++++++++++++++++++------------------- > 1 file changed, 73 insertions(+), 66 deletions(-) Okay, lets start picking up hmm patches in to the new shared hmm.git, as promised I will take responsibility to send these to Linus. The tree is here: https://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git/log/?h=hmm This looks fine to me with one minor comment: > diff --git a/Documentation/vm/hmm.rst b/Documentation/vm/hmm.rst > index ec1efa32af3c..7c1e929931a0 100644 > +++ b/Documentation/vm/hmm.rst > > @@ -151,21 +151,27 @@ registration of an hmm_mirror struct:: > > int hmm_mirror_register(struct hmm_mirror *mirror, > struct mm_struct *mm); > - int hmm_mirror_register_locked(struct hmm_mirror *mirror, > - struct mm_struct *mm); > > - > -The locked variant is to be used when the driver is already holding mmap_sem > -of the mm in write mode. The mirror struct has a set of callbacks that are used > +The mirror struct has a set of callbacks that are used > to propagate CPU page tables:: > > struct hmm_mirror_ops { > + /* release() - release hmm_mirror > + * > + * @mirror: pointer to struct hmm_mirror > + * > + * This is called when the mm_struct is being released. > + * The callback should make sure no references to the mirror occur > + * after the callback returns. > + */ This is not quite accurate (at least, as the other series I sent intends), the struct hmm_mirror is valid up until hmm_mirror_unregister() is called - specifically it remains valid after the release() callback. I will revise it (and the hmm.h comment it came from) to read the below. Please let me know if you'd like something else: /* release() - release hmm_mirror * * @mirror: pointer to struct hmm_mirror * * This is called when the mm_struct is being released. The callback * must ensure that all access to any pages obtained from this mirror * is halted before the callback returns. All future access should * fault. */ The key task for release is to fence off all device access to any related pages as the mm is about to recycle them and the device must not cause a use-after-free. I applied it to hmm.git Thanks, Jason