drm/xe/svm: Document how xe keeps drm_pagemap references

As an aid to understanding the lifetime of the drm_pagemaps used
by the xe driver, document how the xe driver keeps the
drm_pagemap references.

v3:
- Fix formatting (Matt Brost)

Suggested-by: Matthew Brost <matthew.brost@intel.com>
Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
Link: https://patch.msgid.link/20251219113320.183860-19-thomas.hellstrom@linux.intel.com
This commit is contained in:
Thomas Hellström 2025-12-19 12:33:14 +01:00
parent 54dc5842a8
commit 1f430b8d68

View File

@ -28,6 +28,27 @@
#define XE_PEER_PAGEMAP ((void *)0ul)
#define XE_PEER_VM ((void *)1ul)
/**
* DOC: drm_pagemap reference-counting in xe:
*
* In addition to the drm_pagemap internal reference counting by its zone
* device data, the xe driver holds the following long-time references:
*
* - struct xe_pagemap:
* The xe_pagemap struct derives from struct drm_pagemap and uses its
* reference count.
* - SVM-enabled VMs:
* SVM-enabled VMs look up and keeps a reference to all xe_pagemaps on
* the same device.
* - VMAs:
* vmas keep a reference on the drm_pagemap indicated by a gpu_madvise()
* call.
*
* In addition, all drm_pagemap or xe_pagemap pointers where lifetime cannot
* be guaranteed by a vma reference under the vm lock should keep a reference.
* That includes the range->pages.dpagemap pointer.
*/
static int xe_svm_get_pagemaps(struct xe_vm *vm);
void *xe_svm_private_page_owner(struct xe_vm *vm, bool force_smem)