RFC EMM Notifier V3
Get series with b4
b4 am [email protected]Versions newest first
- v1 RFC Latest10 patches 12 repliesIn review
V2->V3 from the cover letter
- Fix rcu issues
- Fix emm_referenced handling
- Use Andrea's mm_lock/unlock to prevent registration races.
- Keep simple API since there does not seem to be a need to add additional callbacks (mm_lock does not require callbacks like emm_start/stop that I envisioned).
- Reduce CC list (the volume we are producing here must be annoying...).
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/10 | emm: mm_lock: Lock a process against reclaiminclude/ mm/ | +76 | 5 replies | |
| 2/10 | emm: notifier logicinclude/ include/ kernel/ +9 more | +212 | 7 replies | |
| 3/10 | emm: Move tlb flushing into free_pgtablesinclude/ mm/ mm/ | +15 | 0 replies | |
| 4/10 | emm: Convert i_mmap_lock to i_mmap_semarch/ fs/ fs/ +12 more | +66 | 0 replies | |
| 5/10 | emm: Remove tlb pointer from the parameters of unmap vmasinclude/ mm/ mm/ | +21 | 0 replies | |
| 6/10 | emm: Convert anon_vma lock to rw_sem and refcountinclude/ mm/ mm/ +1 more | +73 | 0 replies | |
| 7/10 | xpmem: This patch exports zap_page_range as it is needed by XPMEM.mm/ | +1 | 0 replies | |
| 8/10 | xpmem: Locking rules for taking multiple mmap_sem locks.mm/ | +3 | 0 replies | |
| 9/10 | xpmem: The device driverdrivers/ drivers/ drivers/ +7 more | +4395 | 0 replies | |
| 10/10 | xpmem: Simple examplexpmem_test/ xpmem_test/ xpmem_test/ +1 more | +278 | 0 replies |
Reviews trailers per patch
1 of 10 patches has a Reviewed-by or Acked-by.
| Patch | Paul E. McKenney |
|---|---|
| 1/10 | |
| 2/10 | A-b |
| 3/10 | |
| 4/10 | |
| 5/10 | |
| 6/10 | |
| 7/10 | |
| 8/10 | |
| 9/10 | |
| 10/10 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [patch 00/10] [RFC] EMM Notifier V3
V2->V3:
- Fix rcu issues
- Fix emm_referenced handling
- Use Andrea's mm_lock/unlock to prevent registration races.
- Keep simple API since there does not seem to be a need to add additional callbacks (mm_lock does not require callbacks like emm_start/stop that I envisioned).
- Reduce CC list (the volume we are producing here must be annoying...).
V1->V2:
- Additional optimizations in the VM
- Convert vm spinlocks to rw sems.
- Add XPMEM driver (requires sleeping in callbacks)
- Add XPMEM example
This patch implements a simple callback for device drivers that establish their own references to pages (KVM, GRU, XPmem, RDMA/Infiniband, DMA engines etc). These references are unknown to the VM (therefore external).
With these callbacks it is possible for the device driver to release external references when the VM requests it. This enables swapping, page migration and allows support of remapping, permission changes etc etc for the externally mapped memory.
With this functionality it becomes also possible to avoid pinning or mlocking pages (commonly done to stop the VM from unmapping device mapped pages).
A device driver must subscribe to a process using
emm_register_notifier(struct emm_notifier *, struct mm_struct *)
The VM will then perform callbacks for operations that unmap or change permissions of pages in that address space. When the process terminates the callback function is called with emm_release.
Callbacks are performed before and after the unmapping action of the VM.
emm_invalidate_start before
emm_invalidate_end after
The device driver must hold off establishing new references to pages in the range specified between a callback with emm_invalidate_start and the subsequent call with emm_invalidate_end set. This allows the VM to ensure that no concurrent driver actions are performed on an address range while performing remapping or unmapping operations.
This patchset contains additional modifications needed to ensure that the callbacks can sleep. For that purpose two key locks in the vm need to be converted to rw_sems. These patches are brand new, invasive and need extensive discussion and evaluation.
The first patch alone may be applied if callbacks in atomic context are sufficient for a device driver (likely the case for KVM and GRU and simple DMA drivers).
Following the VM modifications is the XPMEM device driver that allows sharing of memory between processes running on different instances of Linux. This is also a prototype. It is known to run trivial sample programs included as the last patch.