summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/xe/xe_vm_types.h
diff options
context:
space:
mode:
authorMatthew Brost <matthew.brost@intel.com>2023-07-20 06:44:25 +0300
committerRodrigo Vivi <rodrigo.vivi@intel.com>2023-12-21 19:37:53 +0300
commit1655c893af08997175e3404039e79f384c925ee3 (patch)
tree3bcbc64dc66e15f07b143b03444bb54463d75107 /drivers/gpu/drm/xe/xe_vm_types.h
parent8f33b4f054fc29a4774d8d10116ef460faeb84a8 (diff)
downloadlinux-1655c893af08997175e3404039e79f384c925ee3.tar.xz
drm/xe: Reduce the number list links in xe_vma
Combine the userptr, rebind, and destroy links into a union as the lists these links belong to are mutually exclusive. v2: Adjust which lists are combined (Thomas H) v3: Add kernel doc why this is safe (Thomas H), remove related change of list_del_init -> list_del (Rodrigo) Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com> Signed-off-by: Matthew Brost <matthew.brost@intel.com> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Diffstat (limited to 'drivers/gpu/drm/xe/xe_vm_types.h')
-rw-r--r--drivers/gpu/drm/xe/xe_vm_types.h37
1 files changed, 22 insertions, 15 deletions
diff --git a/drivers/gpu/drm/xe/xe_vm_types.h b/drivers/gpu/drm/xe/xe_vm_types.h
index a7386e8c2870..00bf0065d514 100644
--- a/drivers/gpu/drm/xe/xe_vm_types.h
+++ b/drivers/gpu/drm/xe/xe_vm_types.h
@@ -50,21 +50,28 @@ struct xe_vma {
*/
u64 tile_present;
- /** @userptr_link: link into VM repin list if userptr */
- struct list_head userptr_link;
-
- /**
- * @rebind_link: link into VM if this VMA needs rebinding, and
- * if it's a bo (not userptr) needs validation after a possible
- * eviction. Protected by the vm's resv lock.
- */
- struct list_head rebind_link;
-
- /**
- * @unbind_link: link or list head if an unbind of multiple VMAs, in
- * single unbind op, is being done.
- */
- struct list_head unbind_link;
+ /** @combined_links: links into lists which are mutually exclusive */
+ union {
+ /**
+ * @userptr: link into VM repin list if userptr. Protected by
+ * vm->lock in write mode.
+ */
+ struct list_head userptr;
+ /**
+ * @rebind: link into VM if this VMA needs rebinding, and
+ * if it's a bo (not userptr) needs validation after a possible
+ * eviction. Protected by the vm's resv lock and typically
+ * vm->lock is also held in write mode. The only place where
+ * vm->lock isn't held is the BO eviction path which has
+ * mutually exclusive execution with userptr.
+ */
+ struct list_head rebind;
+ /**
+ * @destroy: link to contested list when VM is being closed.
+ * Protected by vm->lock in write mode and vm's resv lock.
+ */
+ struct list_head destroy;
+ } combined_links;
/** @destroy_cb: callback to destroy VMA when unbind job is done */
struct dma_fence_cb destroy_cb;