[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190606140239.GA21778@ziepe.ca>
Date: Thu, 6 Jun 2019 11:02:39 -0300
From: Jason Gunthorpe <jgg@...pe.ca>
To: rcampbell@...dia.com
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org,
John Hubbard <jhubbard@...dia.com>,
Ira Weiny <ira.weiny@...el.com>,
Dan Williams <dan.j.williams@...el.com>,
Arnd Bergmann <arnd@...db.de>,
Balbir Singh <bsingharora@...il.com>,
Dan Carpenter <dan.carpenter@...cle.com>,
Matthew Wilcox <willy@...radead.org>,
Souptick Joarder <jrdr.linux@...il.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Jérôme Glisse <jglisse@...hat.com>
Subject: Re: [PATCH 1/5] mm/hmm: Update HMM documentation
On Mon, May 06, 2019 at 04:29:38PM -0700, rcampbell@...dia.com wrote:
> From: Ralph Campbell <rcampbell@...dia.com>
>
> Update the HMM documentation to reflect the latest API and make a few minor
> wording changes.
>
> Signed-off-by: Ralph Campbell <rcampbell@...dia.com>
> Reviewed-by: Jérôme Glisse <jglisse@...hat.com>
> Cc: John Hubbard <jhubbard@...dia.com>
> Cc: Ira Weiny <ira.weiny@...el.com>
> Cc: Dan Williams <dan.j.williams@...el.com>
> Cc: Arnd Bergmann <arnd@...db.de>
> Cc: Balbir Singh <bsingharora@...il.com>
> Cc: Dan Carpenter <dan.carpenter@...cle.com>
> Cc: Matthew Wilcox <willy@...radead.org>
> Cc: Souptick Joarder <jrdr.linux@...il.com>
> Cc: Andrew Morton <akpm@...ux-foundation.org>
> 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
Powered by blists - more mailing lists