From: Ralph Campbell <rcampbell@nvidia.com>
To: Jason Gunthorpe <jgg@ziepe.ca>, <linux-mm@kvack.org>
Cc: "Andrea Arcangeli" <aarcange@redhat.com>,
"Christoph Hellwig" <hch@lst.de>,
"John Hubbard" <jhubbard@nvidia.com>,
"Jérôme Glisse" <jglisse@redhat.com>,
"Kuehling, Felix" <Felix.Kuehling@amd.com>,
"Alex Deucher" <alexander.deucher@amd.com>,
"Christian König" <christian.koenig@amd.com>,
"David (ChunMing) Zhou" <David1.Zhou@amd.com>,
"Dimitri Sivanich" <sivanich@sgi.com>,
dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org,
linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org,
iommu@lists.linux-foundation.org,
intel-gfx@lists.freedesktop.org,
"Gavin Shan" <shangw@linux.vnet.ibm.com>,
"Andrea Righi" <andrea@betterlinux.com>,
"Jason Gunthorpe" <jgg@mellanox.com>
Subject: Re: [PATCH v3 hmm 00/11] Add mmu_notifier_get/put for managing mmu notifier registrations
Date: Wed, 14 Aug 2019 16:56:02 -0700 [thread overview]
Message-ID: <5c836cd9-3c20-aaea-8e98-e6d92e6879d9@nvidia.com> (raw)
In-Reply-To: <20190806231548.25242-1-jgg@ziepe.ca>
On 8/6/19 4:15 PM, Jason Gunthorpe wrote:
> From: Jason Gunthorpe <jgg@mellanox.com>
>
> This series introduces a new registration flow for mmu_notifiers based on
> the idea that the user would like to get a single refcounted piece of
> memory for a mm, keyed to its use.
>
> For instance many users of mmu_notifiers use an interval tree or similar
> to dispatch notifications to some object. There are many objects but only
> one notifier subscription per mm holding the tree.
>
> Of the 12 places that call mmu_notifier_register:
> - 7 are maintaining some kind of obvious mapping of mm_struct to
> mmu_notifier registration, ie in some linked list or hash table. Of
> the 7 this series converts 4 (gru, hmm, RDMA, radeon)
>
> - 3 (hfi1, gntdev, vhost) are registering multiple notifiers, but each
> one immediately does some VA range filtering, ie with an interval tree.
> These would be better with a global subsystem-wide range filter and
> could convert to this API.
>
> - 2 (kvm, amd_iommu) are deliberately using a single mm at a time, and
> really can't use this API. One of the intel-svm's modes is also in this
> list
>
> The 3/7 unconverted drivers are:
> - intel-svm
> This driver tracks mm's in a global linked list 'global_svm_list'
> and would benefit from this API.
>
> Its flow is a bit complex, since it also wants a set of non-shared
> notifiers.
>
> - i915_gem_usrptr
> This driver tracks mm's in a per-device hash
> table (dev_priv->mm_structs), but only has an optional use of
> mmu_notifiers. Since it still seems to need the hash table it is
> difficult to convert.
>
> - amdkfd/kfd_process
> This driver is using a global SRCU hash table to track mm's
>
> The control flow here is very complicated and the driver is relying on
> this hash table to be fast on the ioctl syscall path.
>
> It would definitely benefit, but only if the ioctl path didn't need to
> do the search so often.
>
> This series is already entangled with patches in the hmm & RDMA tree and
> will require some git topic branches for the RDMA ODP stuff. I intend for
> it to go through the hmm tree.
>
> There is a git version here:
>
> https://github.com/jgunthorpe/linux/commits/mmu_notifier
>
> Which has the required pre-patches for the RDMA ODP conversion that are
> still being reviewed.
>
> Jason Gunthorpe (11):
> mm/mmu_notifiers: hoist do_mmu_notifier_register down_write to the
> caller
> mm/mmu_notifiers: do not speculatively allocate a mmu_notifier_mm
> mm/mmu_notifiers: add a get/put scheme for the registration
> misc/sgi-gru: use mmu_notifier_get/put for struct gru_mm_struct
> hmm: use mmu_notifier_get/put for 'struct hmm'
> RDMA/odp: use mmu_notifier_get/put for 'struct ib_ucontext_per_mm'
> RDMA/odp: remove ib_ucontext from ib_umem
> drm/radeon: use mmu_notifier_get/put for struct radeon_mn
> drm/amdkfd: fix a use after free race with mmu_notifer unregister
> drm/amdkfd: use mmu_notifier_put
> mm/mmu_notifiers: remove unregister_no_release
>
> drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 1 +
> drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 3 -
> drivers/gpu/drm/amd/amdkfd/kfd_process.c | 88 ++++-----
> drivers/gpu/drm/nouveau/nouveau_drm.c | 3 +
> drivers/gpu/drm/radeon/radeon.h | 3 -
> drivers/gpu/drm/radeon/radeon_device.c | 2 -
> drivers/gpu/drm/radeon/radeon_drv.c | 2 +
> drivers/gpu/drm/radeon/radeon_mn.c | 157 ++++------------
> drivers/infiniband/core/umem.c | 4 +-
> drivers/infiniband/core/umem_odp.c | 183 ++++++------------
> drivers/infiniband/core/uverbs_cmd.c | 3 -
> drivers/infiniband/core/uverbs_main.c | 1 +
> drivers/infiniband/hw/mlx5/main.c | 5 -
> drivers/misc/sgi-gru/grufile.c | 1 +
> drivers/misc/sgi-gru/grutables.h | 2 -
> drivers/misc/sgi-gru/grutlbpurge.c | 84 +++------
> include/linux/hmm.h | 12 +-
> include/linux/mm_types.h | 6 -
> include/linux/mmu_notifier.h | 40 +++-
> include/rdma/ib_umem.h | 2 +-
> include/rdma/ib_umem_odp.h | 10 +-
> include/rdma/ib_verbs.h | 3 -
> kernel/fork.c | 1 -
> mm/hmm.c | 121 +++---------
> mm/mmu_notifier.c | 230 +++++++++++++++++------
> 25 files changed, 408 insertions(+), 559 deletions(-)
For the core MM, HMM, and nouveau changes you can add:
Tested-by: Ralph Campbell <rcampbell@nvidia.com>
next prev parent reply other threads:[~2019-08-14 23:56 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-06 23:15 Jason Gunthorpe
2019-08-06 23:15 ` [PATCH v3 hmm 01/11] mm/mmu_notifiers: hoist do_mmu_notifier_register down_write to the caller Jason Gunthorpe
2019-08-08 10:24 ` Christoph Hellwig
2019-08-14 20:14 ` Ralph Campbell
2019-08-06 23:15 ` [PATCH v3 hmm 02/11] mm/mmu_notifiers: do not speculatively allocate a mmu_notifier_mm Jason Gunthorpe
2019-08-08 10:26 ` Christoph Hellwig
2019-08-14 20:32 ` Ralph Campbell
2019-08-06 23:15 ` [PATCH v3 hmm 03/11] mm/mmu_notifiers: add a get/put scheme for the registration Jason Gunthorpe
2019-08-14 21:20 ` Ralph Campbell
2019-08-15 0:13 ` Jason Gunthorpe
2019-08-06 23:15 ` [PATCH v3 hmm 04/11] misc/sgi-gru: use mmu_notifier_get/put for struct gru_mm_struct Jason Gunthorpe
2019-08-08 10:25 ` Christoph Hellwig
2019-08-14 15:58 ` Jason Gunthorpe
2019-08-14 17:18 ` Dimitri Sivanich
2019-08-15 19:34 ` Jason Gunthorpe
2019-08-06 23:15 ` [PATCH v3 hmm 05/11] hmm: use mmu_notifier_get/put for 'struct hmm' Jason Gunthorpe
2019-08-08 10:28 ` Christoph Hellwig
2019-08-14 21:51 ` Ralph Campbell
2019-08-06 23:15 ` [PATCH v3 hmm 06/11] RDMA/odp: use mmu_notifier_get/put for 'struct ib_ucontext_per_mm' Jason Gunthorpe
2019-08-06 23:15 ` [PATCH v3 hmm 07/11] RDMA/odp: remove ib_ucontext from ib_umem Jason Gunthorpe
2019-08-06 23:15 ` [PATCH v3 hmm 08/11] drm/radeon: use mmu_notifier_get/put for struct radeon_mn Jason Gunthorpe
2019-08-14 16:07 ` Jason Gunthorpe
2019-08-15 8:28 ` Christian König
2019-08-15 19:46 ` Jason Gunthorpe
2019-08-06 23:15 ` [PATCH v3 hmm 09/11] drm/amdkfd: fix a use after free race with mmu_notifer unregister Jason Gunthorpe
2019-08-06 23:15 ` [PATCH v3 hmm 10/11] drm/amdkfd: use mmu_notifier_put Jason Gunthorpe
2019-08-06 23:47 ` Kuehling, Felix
2019-08-07 11:42 ` Jason Gunthorpe
2019-08-06 23:15 ` [PATCH v3 hmm 11/11] mm/mmu_notifiers: remove unregister_no_release Jason Gunthorpe
2019-08-08 10:29 ` Christoph Hellwig
2019-08-14 21:53 ` Ralph Campbell
2019-08-14 23:56 ` Ralph Campbell [this message]
2019-08-15 20:34 ` [PATCH v3 hmm 00/11] Add mmu_notifier_get/put for managing mmu notifier registrations Jason Gunthorpe
2019-08-16 15:14 ` Jason Gunthorpe
2019-08-21 19:53 ` Jason Gunthorpe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5c836cd9-3c20-aaea-8e98-e6d92e6879d9@nvidia.com \
--to=rcampbell@nvidia.com \
--cc=David1.Zhou@amd.com \
--cc=Felix.Kuehling@amd.com \
--cc=aarcange@redhat.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=andrea@betterlinux.com \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=hch@lst.de \
--cc=intel-gfx@lists.freedesktop.org \
--cc=iommu@lists.linux-foundation.org \
--cc=jgg@mellanox.com \
--cc=jgg@ziepe.ca \
--cc=jglisse@redhat.com \
--cc=jhubbard@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-rdma@vger.kernel.org \
--cc=shangw@linux.vnet.ibm.com \
--cc=sivanich@sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox