drm/xe/userptr: Misc fixes
Fix a couple of outstanding bugs and / or inconsistencies:
- Start using mmget_not_zero(), following the mmgrab() kerneldoc before using a remote mm in a kthread
In compute- and fault mode, A userptr may become unmapped before the rebind worker / fault handler runs. Rather than failing the userptr rebind, point the missing pages to a per-vm userptr scratch page.- Since we don't keep userptr pages pinned while bound to GPU, use get_user_pages_fast() rather than pin_user_pages_fast().
- Lock instead of trylock when dirtying userptr pages. The deadlock condition motivating the trylock as detailed in i915 doesn't exist in xe.
- Don't offer any shortcuts out of the mmu_notifier when the process is exiting or the vma is about to be destroyed. Again, since we don't pin userptr pages while bound, we must idle the vm or zap the GPU PTEs in the mmu_notifier. The only thing gating pages from being handed back to the system as part of shrinking, for example, is the completion of the mmu_notifier. This is different from i915 where we keep pages pinned.
v3:
- Ditch the userptr scratch page. Needs further thinking.
Edited by Thomas Hellström