Skip to contentSkip to conversation

drm/ttm: Add a comment for the FAULT_FLAG_ALLOW_RETRY implementation

PATCH New Thomas Hellström (VMware) 1 participant 1 message Aug 23, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/ttm: Add a comment for the FAULT_FLAG_ALLOW_RETRY implementation

From: Thomas Hellstrom <[email protected]>

The FAULT_FLAG_ALLOW_RETRY semantics is tricky and appears poorly documented. Add a comment to the TTM fault() implementation to avoid future confusion.

---
 drivers/gpu/drm/ttm/ttm_bo_vm.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/gpu/drm/ttm/ttm_bo_vm.c +11 -0
index a61a35e57d1c..e93b1ad7828f 100644
@@ -125,6 +125,17 @@ static vm_fault_t ttm_bo_vm_fault(struct vm_fault *vmf)
 		&bdev->man[bo->mem.mem_type];
 	struct vm_area_struct cvma;
 
+	/*
+	 * FAULT_FLAG_ALLOW_RETRY indicates that the caller would like to avoid
+	 * IO waits with the mmap_sem held. With FAULT_FLAG_RETRY_NOWAIT,
+	 * the caller would like an early return with VM_FAULT_RETRY and the
+	 * mmap_sem held.
+	 * If FAULT_FLAG_RETRY_NOWAIT is not set, then we should drop the
+	 * mmap_sem, perform the wait and return VM_FAULT_RETRY without
+	 * holding it. We implement this for sleeping bo reservations
+	 * where the reservation holder may be waiting for fences, and for
+	 * fence waits.
+	 */
 	if (unlikely(!dma_resv_trylock(bo->base.resv))) {
 		if (vmf->flags & FAULT_FLAG_ALLOW_RETRY) {
 			if (!(vmf->flags & FAULT_FLAG_RETRY_NOWAIT)) {
Signature · 6 lines
2.20.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel