[PATCH v2 hmm 01/11] mm/hmm: fix use after free with struct hmm in the mmu notifiers
jgg at ziepe.ca
Sat Jun 8 11:33:05 UTC 2019
On Sat, Jun 08, 2019 at 01:49:48AM -0700, Christoph Hellwig wrote:
> I still think sruct hmm should die. We already have a structure used
> for additional information for drivers having crazly tight integration
> into the VM, and it is called struct mmu_notifier_mm. We really need
> to reuse that intead of duplicating it badly.
Probably. But at least in ODP we needed something very similar to
'struct hmm' to make our mmu notifier implementation work.
The mmu notifier api really lends itself to having a per-mm structure
in the driver to hold the 'struct mmu_notifier'..
I think I see other drivers are doing things like assuming that there
is only one mm in their world (despite being FD based, so this is not
So, my first attempt would be an api something like:
priv = mmu_notififer_attach_mm(ops, current->mm, sizeof(my_priv))
ops->invalidate_start(struct mmu_notififer *mn):
struct p *priv = mmu_notifier_priv(mn);
- There is only one priv per mm
- All the srcu stuff is handled inside mmu notifier
- It is reference counted, so ops can be attached multiple times to
the same mm
Then odp's per_mm, and struct hmm (if we keep it at all) is simply a
'priv' in the above.
I was thinking of looking at this stuff next, once this series is
More information about the amd-gfx