Skip to contentSkip to conversation

xe bo shrinker and exhaustive eviction

PATCH Superseded Thomas Hellström 2 participants 28 messages May 15, 2024

Subsystems (11)

v1 of 17 Superseded Latest is v17 →

lore
Share & tools
lore

Thomas Hellström

author maintainer
#0 lore raw

cover xe bo shrinker and exhaustive eviction

CI testing of shrinker- and eviction patches

Thomas Hellström (21):
drm/ttm: Allow TTM LRU list nodes of different types drm/ttm: Slightly clean up LRU list iteration
drm/ttm: Use LRU hitches
drm/ttm, drm/amdgpu, drm/xe: Consider hitch moves within bulk sublist
moves
drm/exec: Rework contended locking
drm/ttm: Provide a generic LRU walker helper
drm/ttm: Use restartable LRU and sleeping locks for swapping. drm/ttm: sleeping evict lock.
drm/ttm: Add a virtual base class for graphics memory backup drm/ttm/pool: Provide a helper to shrink pages.
drm/ttm: Use fault-injection to test error paths
drm/ttm, drm/xe: Add a shrinker for xe bos dma-buf/dma-resv: Introduce dma_resv_trylock_ctx() drm/exec: drm_exec_trylock()
drm/exec: Add a snapshot capability.
drm/exec: Introduce an evict mode
drm/ttm: Support drm_exec locking for eviction and swapping drm/ttm: Convert ttm vm to using drm_exec.
drm/xe: Use drm_exec for fault locking
drm/ttm: Use drm_exec_trylock for bo initialization drm/xe: Initial support for drm exec locking during validate.

 drivers/gpu/drm/Kconfig                      |  10 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c       |   6 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c      |   4 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c      |  12 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c      |   8 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_seq64.c    |   4 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_umsch_mm.c |   8 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c       |   4 +
 drivers/gpu/drm/drm_exec.c                   | 169 ++++++-
 drivers/gpu/drm/drm_gpuvm.c                  |   8 +-
 drivers/gpu/drm/i915/gem/i915_gem_ttm.c      |   4 +-
 drivers/gpu/drm/nouveau/nouveau_gem.c        |   4 +-
 drivers/gpu/drm/nouveau/nouveau_uvmm.c       |   2 +-
 drivers/gpu/drm/radeon/radeon_gem.c          |   4 +-
 drivers/gpu/drm/tests/drm_exec_test.c        |  12 +-
 drivers/gpu/drm/ttm/Makefile                 |   2 +-
 drivers/gpu/drm/ttm/ttm_backup_shmem.c       | 137 ++++++
 drivers/gpu/drm/ttm/ttm_bo.c                 | 477 +++++++++----------
 drivers/gpu/drm/ttm/ttm_bo_util.c            | 266 +++++++++++
 drivers/gpu/drm/ttm/ttm_bo_vm.c              | 101 ++--
 drivers/gpu/drm/ttm/ttm_device.c             |  29 +-
 drivers/gpu/drm/ttm/ttm_pool.c               | 412 +++++++++++++++-
 drivers/gpu/drm/ttm/ttm_resource.c           | 267 ++++++++---
 drivers/gpu/drm/ttm/ttm_tt.c                 |  37 ++
 drivers/gpu/drm/vmwgfx/vmwgfx_page_dirty.c   |   6 +-
 drivers/gpu/drm/xe/Makefile                  |   1 +
 drivers/gpu/drm/xe/display/xe_fb_pin.c       |   2 +-
 drivers/gpu/drm/xe/tests/xe_bo.c             | 124 ++++-
 drivers/gpu/drm/xe/tests/xe_bo_test.c        |   1 +
 drivers/gpu/drm/xe/tests/xe_bo_test.h        |   1 +
 drivers/gpu/drm/xe/tests/xe_dma_buf.c        |   4 +-
 drivers/gpu/drm/xe/tests/xe_migrate.c        |   2 +-
 drivers/gpu/drm/xe/xe_bo.c                   | 173 +++++--
 drivers/gpu/drm/xe/xe_bo.h                   |   8 +-
 drivers/gpu/drm/xe/xe_device.c               |   8 +
 drivers/gpu/drm/xe/xe_device_types.h         |   2 +
 drivers/gpu/drm/xe/xe_dma_buf.c              |   2 +-
 drivers/gpu/drm/xe/xe_ggtt.c                 |   2 +-
 drivers/gpu/drm/xe/xe_gt_pagefault.c         |   6 +-
 drivers/gpu/drm/xe/xe_shrinker.c             | 224 +++++++++
 drivers/gpu/drm/xe/xe_shrinker.h             |  18 +
 drivers/gpu/drm/xe/xe_vm.c                   |  18 +-
 include/drm/drm_exec.h                       |  37 +-
 include/drm/ttm/ttm_backup.h                 | 136 ++++++
 include/drm/ttm/ttm_bo.h                     |  59 ++-
 include/drm/ttm/ttm_pool.h                   |   5 +
 include/drm/ttm/ttm_resource.h               | 102 +++-
 include/drm/ttm/ttm_tt.h                     |  20 +
 include/linux/dma-resv.h                     |  25 +-
 49 files changed, 2457 insertions(+), 516 deletions(-)
 create mode 100644 drivers/gpu/drm/ttm/ttm_backup_shmem.c
 create mode 100644 drivers/gpu/drm/xe/xe_shrinker.c
 create mode 100644 drivers/gpu/drm/xe/xe_shrinker.h
 create mode 100644 include/drm/ttm/ttm_backup.h
Signature · 1 line
2.44.0
author maintainer
#1 lore raw

PATCH 1/21 drm/ttm: Allow TTM LRU list nodes of different types

To be able to handle list unlocking while traversing the LRU list, we want the iterators not only to point to the next position of the list traversal, but to insert themselves as list nodes at that point to work around the fact that the next node might otherwise disappear from the list while the iterator is pointing to it.

These list nodes need to be easily distinguishable from other list nodes so that others traversing the list can skip over them.

So declare a struct ttm_lru_item, with a struct list_head member and a type enum. This will slightly increase the size of a struct ttm_resource.

Changes in previous series:
- Update enum ttm_lru_item_type documentation.

Cc Christian König <[email protected]>
Cc Somalapuram Amaranath <[email protected]>
---
 drivers/gpu/drm/ttm/ttm_device.c   |  4 +-
 drivers/gpu/drm/ttm/ttm_resource.c | 89 +++++++++++++++++++++++-------
 include/drm/ttm/ttm_resource.h     | 54 +++++++++++++++++-
 3 files changed, 125 insertions(+), 22 deletions(-)
drivers/gpu/drm/ttm/ttm_device.c +2 -2
index 434cf0258000..09411978a13a 100644
@@ -274,14 +274,14 @@ static void ttm_device_clear_lru_dma_mappings(struct ttm_device *bdev,
 	struct ttm_resource *res;
 
 	spin_lock(&bdev->lru_lock);
-	while ((res = list_first_entry_or_null(list, typeof(*res), lru))) {
+	while ((res = ttm_lru_first_res_or_null(list))) {
 		struct ttm_buffer_object *bo = res->bo;
 
 		/* Take ref against racing releases once lru_lock is unlocked */
 		if (!ttm_bo_get_unless_zero(bo))
 			continue;
 
-		list_del_init(&res->lru);
+		list_del_init(&bo->resource->lru.link);
 		spin_unlock(&bdev->lru_lock);
 
 		if (bo->ttm)
drivers/gpu/drm/ttm/ttm_resource.c +70 -19

162 lines not on this page · raw message

include/drm/ttm/ttm_resource.h +53 -1

74 lines not on this page · raw message

Signature · 1 line
2.44.0
author maintainer
#2 lore raw

PATCH 2/21 drm/ttm: Slightly clean up LRU list iteration

In reply to Thomas Hellström

Simplify the ttm_resource_manager_next() interface to only take the cursor and reuse ttm_resource_manager_next() functionality from ttm_resource_manager_first().

---
 drivers/gpu/drm/ttm/ttm_resource.c | 48 +++++++++++++-----------------
 include/drm/ttm/ttm_resource.h     | 10 ++++---
 2 files changed, 27 insertions(+), 31 deletions(-)
drivers/gpu/drm/ttm/ttm_resource.c +21 -27
index db9a7a3717c4..8bfbddddc0e8 100644
@@ -496,50 +496,44 @@ struct ttm_resource *
 ttm_resource_manager_first(struct ttm_resource_manager *man,
 			   struct ttm_resource_cursor *cursor)
 {
-	struct ttm_lru_item *lru;
-
 	lockdep_assert_held(&man->bdev->lru_lock);
 
-	for (cursor->priority = 0; cursor->priority < TTM_MAX_BO_PRIORITY;
-	     ++cursor->priority)
-		list_for_each_entry(lru, &man->lru[cursor->priority], link) {
-			if (ttm_lru_item_is_res(lru))
-				return ttm_lru_item_to_res(lru);
-		}
-
-	return NULL;
+	cursor->priority = 0;
+	cursor->man = man;
+	cursor->cur = &man->lru[cursor->priority];
+	return ttm_resource_manager_next(cursor);
 }
 
 /**
  * ttm_resource_manager_next
  *
- * @man: resource manager to iterate over
  * @cursor: cursor to record the position
- * @res: the current resource pointer
  *
- * Returns the next resource from the resource manager.
+ * Return: the next resource from the resource manager.
  */
 struct ttm_resource *
-ttm_resource_manager_next(struct ttm_resource_manager *man,
-			  struct ttm_resource_cursor *cursor,
-			  struct ttm_resource *res)
+ttm_resource_manager_next(struct ttm_resource_cursor *cursor)
 {
-	struct ttm_lru_item *lru = &res->lru;
+	struct ttm_resource_manager *man = cursor->man;
+	struct ttm_lru_item *lru;
 
 	lockdep_assert_held(&man->bdev->lru_lock);
 
-	list_for_each_entry_continue(lru, &man->lru[cursor->priority], link) {
-		if (ttm_lru_item_is_res(lru))
-			return ttm_lru_item_to_res(lru);
-	}
-
-	for (++cursor->priority; cursor->priority < TTM_MAX_BO_PRIORITY;
-	     ++cursor->priority)
-		list_for_each_entry(lru, &man->lru[cursor->priority], link) {
-			if (ttm_lru_item_is_res(lru))
-				ttm_lru_item_to_res(lru);
+	for (;;) {
+		lru = list_entry(cursor->cur, typeof(*lru), link);
+		list_for_each_entry_continue(lru, &man->lru[cursor->priority], link) {
+			if (ttm_lru_item_is_res(lru)) {
+				cursor->cur = &lru->link;
+				return ttm_lru_item_to_res(lru);
+			}
 		}
 
+		if (++cursor->priority >= TTM_MAX_BO_PRIORITY)
+			break;
+
+		cursor->cur = &man->lru[cursor->priority];
+	}
+
 	return NULL;
 }
 
include/drm/ttm/ttm_resource.h +6 -4
index 1511d91e290d..7d81fd5b5b83 100644
@@ -272,11 +272,15 @@ ttm_lru_item_to_res(struct ttm_lru_item *item)
 /**
  * struct ttm_resource_cursor
  *
+ * @man: The resource manager currently being iterated over.
+ * @cur: The list head the cursor currently points to.
  * @priority: the current priority
  *
  * Cursor to iterate over the resources in a manager.
  */
 struct ttm_resource_cursor {
+	struct ttm_resource_manager *man;
+	struct list_head *cur;
 	unsigned int priority;
 };
 
@@ -438,9 +442,7 @@ struct ttm_resource *
 ttm_resource_manager_first(struct ttm_resource_manager *man,
 			   struct ttm_resource_cursor *cursor);
 struct ttm_resource *
-ttm_resource_manager_next(struct ttm_resource_manager *man,
-			  struct ttm_resource_cursor *cursor,
-			  struct ttm_resource *res);
+ttm_resource_manager_next(struct ttm_resource_cursor *cursor);
 
 struct ttm_resource *
 ttm_lru_first_res_or_null(struct list_head *head);
@@ -455,7 +457,7 @@ ttm_lru_first_res_or_null(struct list_head *head);
  */
 #define ttm_resource_manager_for_each_res(man, cursor, res)		\
 	for (res = ttm_resource_manager_first(man, cursor); res;	\
-	     res = ttm_resource_manager_next(man, cursor, res))
+	     res = ttm_resource_manager_next(cursor))
 
 struct ttm_kmap_iter *
 ttm_kmap_iter_iomap_init(struct ttm_kmap_iter_iomap *iter_io,
Signature · 1 line
2.44.0
author maintainer
#5 lore raw

PATCH 5/21 drm/exec: Rework contended locking

In reply to Thomas Hellström
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c       |  6 ++---
 drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c      |  4 ++--
 drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c      |  8 +++----
 drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c      |  8 +++----
 drivers/gpu/drm/amd/amdgpu/amdgpu_seq64.c    |  4 ++--
 drivers/gpu/drm/amd/amdgpu/amdgpu_umsch_mm.c |  8 +++----
 drivers/gpu/drm/drm_exec.c                   | 23 ++++++++++++++------
 drivers/gpu/drm/drm_gpuvm.c                  |  8 +++----
 drivers/gpu/drm/nouveau/nouveau_uvmm.c       |  2 +-
 drivers/gpu/drm/tests/drm_exec_test.c        | 12 +++++-----
 drivers/gpu/drm/xe/xe_gt_pagefault.c         |  4 ++--
 drivers/gpu/drm/xe/xe_vm.c                   | 10 ++++-----
 include/drm/drm_exec.h                       | 19 +++++++++++-----
 13 files changed, 67 insertions(+), 49 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +3 -3
index ec888fc6ead8..299e46a6d934 100644
@@ -897,7 +897,7 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
 
 	drm_exec_until_all_locked(&p->exec) {
 		r = amdgpu_vm_lock_pd(&fpriv->vm, &p->exec, 1 + p->gang_size);
-		drm_exec_retry_on_contention(&p->exec);
+		r = drm_exec_retry_on_contention(&p->exec, r);
 		if (unlikely(r))
 			goto out_free_user_pages;
 
@@ -905,7 +905,7 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
 			/* One fence for TTM and one for each CS job */
 			r = drm_exec_prepare_obj(&p->exec, &e->bo->tbo.base,
 						 1 + p->gang_size);
-			drm_exec_retry_on_contention(&p->exec);
+			r = drm_exec_retry_on_contention(&p->exec, r);
 			if (unlikely(r))
 				goto out_free_user_pages;
 
@@ -915,7 +915,7 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
 		if (p->uf_bo) {
 			r = drm_exec_prepare_obj(&p->exec, &p->uf_bo->tbo.base,
 						 1 + p->gang_size);
-			drm_exec_retry_on_contention(&p->exec);
+			r = drm_exec_retry_on_contention(&p->exec, r);
 			if (unlikely(r))
 				goto out_free_user_pages;
 		}
drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c +2 -2
index cfdf558b48b6..8b2b86c7a6c5 100644
@@ -74,7 +74,7 @@ int amdgpu_map_static_csa(struct amdgpu_device *adev, struct amdgpu_vm *vm,
 		r = amdgpu_vm_lock_pd(vm, &exec, 0);
 		if (likely(!r))
 			r = drm_exec_lock_obj(&exec, &bo->tbo.base);
-		drm_exec_retry_on_contention(&exec);
+		r = drm_exec_retry_on_contention(&exec, r);
 		if (unlikely(r)) {
 			DRM_ERROR("failed to reserve CSA,PD BOs: err=%d\n", r);
 			goto error;
@@ -114,7 +114,7 @@ int amdgpu_unmap_static_csa(struct amdgpu_device *adev, struct amdgpu_vm *vm,
 		r = amdgpu_vm_lock_pd(vm, &exec, 0);
 		if (likely(!r))
 			r = drm_exec_lock_obj(&exec, &bo->tbo.base);
-		drm_exec_retry_on_contention(&exec);
+		r = drm_exec_retry_on_contention(&exec, r);
 		if (unlikely(r)) {
 			DRM_ERROR("failed to reserve CSA,PD BOs: err=%d\n", r);
 			goto error;
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +4 -4
index 67c234bcf89f..17e16c971e21 100644
@@ -239,12 +239,12 @@ static void amdgpu_gem_object_close(struct drm_gem_object *obj,
 	drm_exec_init(&exec, DRM_EXEC_IGNORE_DUPLICATES, 0);
 	drm_exec_until_all_locked(&exec) {
 		r = drm_exec_prepare_obj(&exec, &bo->tbo.base, 1);
-		drm_exec_retry_on_contention(&exec);
+		r = drm_exec_retry_on_contention(&exec, r);
 		if (unlikely(r))
 			goto out_unlock;
 
 		r = amdgpu_vm_lock_pd(vm, &exec, 0);
-		drm_exec_retry_on_contention(&exec);
+		r = drm_exec_retry_on_contention(&exec, r);
 		if (unlikely(r))
 			goto out_unlock;
 	}
@@ -776,13 +776,13 @@ int amdgpu_gem_va_ioctl(struct drm_device *dev, void *data,
 	drm_exec_until_all_locked(&exec) {
 		if (gobj) {
 			r = drm_exec_lock_obj(&exec, gobj);
-			drm_exec_retry_on_contention(&exec);
+			r = drm_exec_retry_on_contention(&exec, r);
 			if (unlikely(r))
 				goto error;
 		}
 
 		r = amdgpu_vm_lock_pd(&fpriv->vm, &exec, 2);
-		drm_exec_retry_on_contention(&exec);
+		r = drm_exec_retry_on_contention(&exec, r);
 		if (unlikely(r))
 			goto error;
 	}
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c +4 -4
index 5ca5c47ab54e..1b1a5147606e 100644
@@ -1221,12 +1221,12 @@ int amdgpu_mes_ctx_map_meta_data(struct amdgpu_device *adev,
 	drm_exec_until_all_locked(&exec) {
 		r = drm_exec_lock_obj(&exec,
 				      &ctx_data->meta_data_obj->tbo.base);
-		drm_exec_retry_on_contention(&exec);
+		r = drm_exec_retry_on_contention(&exec, r);
 		if (unlikely(r))
 			goto error_fini_exec;
 
 		r = amdgpu_vm_lock_pd(vm, &exec, 0);
-		drm_exec_retry_on_contention(&exec);
+		r = drm_exec_retry_on_contention(&exec, r);
 		if (unlikely(r))
 			goto error_fini_exec;
 	}
@@ -1292,12 +1292,12 @@ int amdgpu_mes_ctx_unmap_meta_data(struct amdgpu_device *adev,
 	drm_exec_until_all_locked(&exec) {
 		r = drm_exec_lock_obj(&exec,
 				      &ctx_data->meta_data_obj->tbo.base);
-		drm_exec_retry_on_contention(&exec);
+		r = drm_exec_retry_on_contention(&exec, r);
 		if (unlikely(r))
 			goto out_unlock;
 
 		r = amdgpu_vm_lock_pd(vm, &exec, 0);
-		drm_exec_retry_on_contention(&exec);
+		r = drm_exec_retry_on_contention(&exec, r);
 		if (unlikely(r))
 			goto out_unlock;
 	}
drivers/gpu/drm/amd/amdgpu/amdgpu_seq64.c +2 -2
index e22cb2b5cd92..72b8213e352c 100644
@@ -77,7 +77,7 @@ int amdgpu_seq64_map(struct amdgpu_device *adev, struct amdgpu_vm *vm,
 		r = amdgpu_vm_lock_pd(vm, &exec, 0);
 		if (likely(!r))
 			r = drm_exec_lock_obj(&exec, &bo->tbo.base);
-		drm_exec_retry_on_contention(&exec);
+		r = drm_exec_retry_on_contention(&exec, r);
 		if (unlikely(r))
 			goto error;
 	}
@@ -138,7 +138,7 @@ void amdgpu_seq64_unmap(struct amdgpu_device *adev, struct amdgpu_fpriv *fpriv)
 		r = amdgpu_vm_lock_pd(vm, &exec, 0);
 		if (likely(!r))
 			r = drm_exec_lock_obj(&exec, &bo->tbo.base);
-		drm_exec_retry_on_contention(&exec);
+		r = drm_exec_retry_on_contention(&exec, r);
 		if (unlikely(r))
 			goto error;
 	}
drivers/gpu/drm/amd/amdgpu/amdgpu_umsch_mm.c +4 -4
index e01c1c8e64c4..63392ce43945 100644
@@ -89,12 +89,12 @@ static int map_ring_data(struct amdgpu_device *adev, struct amdgpu_vm *vm,
 	drm_exec_init(&exec, 0, 0);
 	drm_exec_until_all_locked(&exec) {
 		r = drm_exec_lock_obj(&exec, &bo->tbo.base);
-		drm_exec_retry_on_contention(&exec);
+		r = drm_exec_retry_on_contention(&exec, r);
 		if (unlikely(r))
 			goto error_fini_exec;
 
 		r = amdgpu_vm_lock_pd(vm, &exec, 0);
-		drm_exec_retry_on_contention(&exec);
+		r = drm_exec_retry_on_contention(&exec, r);
 		if (unlikely(r))
 			goto error_fini_exec;
 	}
@@ -152,12 +152,12 @@ static int unmap_ring_data(struct amdgpu_device *adev, struct amdgpu_vm *vm,
 	drm_exec_init(&exec, 0, 0);
 	drm_exec_until_all_locked(&exec) {
 		r = drm_exec_lock_obj(&exec, &bo->tbo.base);
-		drm_exec_retry_on_contention(&exec);
+		r = drm_exec_retry_on_contention(&exec, r);
 		if (unlikely(r))
 			goto out_unlock;
 
 		r = amdgpu_vm_lock_pd(vm, &exec, 0);
-		drm_exec_retry_on_contention(&exec);
+		r = drm_exec_retry_on_contention(&exec, r);
 		if (unlikely(r))
 			goto out_unlock;
 	}
drivers/gpu/drm/drm_exec.c +16 -7
index 2da094bdf8a4..2a28cbccaec7 100644
@@ -48,7 +48,8 @@
  */
 
 /* Dummy value used to initially enter the retry loop */
-#define DRM_EXEC_DUMMY ((void *)~0)
+#define DRM_EXEC_DUMMY ERR_PTR(-ESTALE)
+#define DRM_EXEC_CONTENDED ERR_PTR(-EDEADLK)
 
 /* Unlock all objects and drop references */
 static void drm_exec_unlock_all(struct drm_exec *exec)
@@ -131,8 +132,7 @@ bool drm_exec_cleanup(struct drm_exec *exec)
 		return true;
 	}
 
-	drm_exec_unlock_all(exec);
-	exec->num_objects = 0;
+	exec->contended = NULL;
 	return true;
 }
 EXPORT_SYMBOL(drm_exec_cleanup);
@@ -194,6 +194,19 @@ static int drm_exec_lock_contended(struct drm_exec *exec)
 	return ret;
 }
 
+int drm_exec_handle_contended(struct drm_exec *exec)
+{
+	int ret;
+
+	drm_exec_unlock_all(exec);
+	exec->num_objects = 0;
+	ret = drm_exec_lock_contended(exec);
+	exec->contended = DRM_EXEC_CONTENDED;
+
+	return ret;
+}
+EXPORT_SYMBOL(drm_exec_handle_contended);
+
 /**
  * drm_exec_lock_obj - lock a GEM object for use
  * @exec: the drm_exec object with the state
@@ -209,10 +222,6 @@ int drm_exec_lock_obj(struct drm_exec *exec, struct drm_gem_object *obj)
 {
 	int ret;
 
-	ret = drm_exec_lock_contended(exec);
-	if (unlikely(ret))
-		return ret;
-
 	if (exec->prelocked == obj) {
 		drm_gem_object_put(exec->prelocked);
 		exec->prelocked = NULL;
drivers/gpu/drm/drm_gpuvm.c +4 -4
index f9eb56f24bef..0923d6ae18e2 100644
@@ -1254,18 +1254,18 @@ drm_gpuvm_exec_lock(struct drm_gpuvm_exec *vm_exec)
 
 	drm_exec_until_all_locked(exec) {
 		ret = drm_gpuvm_prepare_vm(gpuvm, exec, num_fences);
-		drm_exec_retry_on_contention(exec);
+		ret = drm_exec_retry_on_contention(exec, ret);
 		if (ret)
 			goto err;
 
 		ret = drm_gpuvm_prepare_objects(gpuvm, exec, num_fences);
-		drm_exec_retry_on_contention(exec);
+		ret = drm_exec_retry_on_contention(exec, ret);
 		if (ret)
 			goto err;
 
 		if (vm_exec->extra.fn) {
 			ret = vm_exec->extra.fn(vm_exec);
-			drm_exec_retry_on_contention(exec);
+			ret = drm_exec_retry_on_contention(exec, ret);
 			if (ret)
 				goto err;
 		}
@@ -1346,7 +1346,7 @@ drm_gpuvm_exec_lock_range(struct drm_gpuvm_exec *vm_exec,
 	drm_exec_until_all_locked(exec) {
 		ret = drm_gpuvm_prepare_range(gpuvm, exec, addr, range,
 					      vm_exec->num_fences);
-		drm_exec_retry_on_contention(exec);
+		ret = drm_exec_retry_on_contention(exec, ret);
 		if (ret)
 			goto err;
 	}
drivers/gpu/drm/nouveau/nouveau_uvmm.c +1 -1
index ee02cd833c5e..0c871634fdfb 100644
@@ -1350,7 +1350,7 @@ nouveau_uvmm_bind_job_submit(struct nouveau_job *job,
 	drm_exec_init(exec, vme->flags, 0);
 	drm_exec_until_all_locked(exec) {
 		ret = bind_lock_validate(job, exec, vme->num_fences);
-		drm_exec_retry_on_contention(exec);
+		ret = drm_exec_retry_on_contention(exec, ret);
 		if (ret) {
 			op = list_last_op(&bind_job->ops);
 			goto unwind;
drivers/gpu/drm/tests/drm_exec_test.c +6 -6
index 81f928a429ba..28558fdb08df 100644
@@ -63,7 +63,7 @@ static void test_lock(struct kunit *test)
 	drm_exec_init(&exec, DRM_EXEC_INTERRUPTIBLE_WAIT, 0);
 	drm_exec_until_all_locked(&exec) {
 		ret = drm_exec_lock_obj(&exec, &gobj);
-		drm_exec_retry_on_contention(&exec);
+		ret = drm_exec_retry_on_contention(&exec, ret);
 		KUNIT_EXPECT_EQ(test, ret, 0);
 		if (ret)
 			break;
@@ -83,14 +83,14 @@ static void test_lock_unlock(struct kunit *test)
 	drm_exec_init(&exec, DRM_EXEC_INTERRUPTIBLE_WAIT, 0);
 	drm_exec_until_all_locked(&exec) {
 		ret = drm_exec_lock_obj(&exec, &gobj);
-		drm_exec_retry_on_contention(&exec);
+		ret = drm_exec_retry_on_contention(&exec, ret);
 		KUNIT_EXPECT_EQ(test, ret, 0);
 		if (ret)
 			break;
 
 		drm_exec_unlock_obj(&exec, &gobj);
 		ret = drm_exec_lock_obj(&exec, &gobj);
-		drm_exec_retry_on_contention(&exec);
+		ret = drm_exec_retry_on_contention(&exec, ret);
 		KUNIT_EXPECT_EQ(test, ret, 0);
 		if (ret)
 			break;
@@ -110,13 +110,13 @@ static void test_duplicates(struct kunit *test)
 	drm_exec_init(&exec, DRM_EXEC_IGNORE_DUPLICATES, 0);
 	drm_exec_until_all_locked(&exec) {
 		ret = drm_exec_lock_obj(&exec, &gobj);
-		drm_exec_retry_on_contention(&exec);
+		ret = drm_exec_retry_on_contention(&exec, ret);
 		KUNIT_EXPECT_EQ(test, ret, 0);
 		if (ret)
 			break;
 
 		ret = drm_exec_lock_obj(&exec, &gobj);
-		drm_exec_retry_on_contention(&exec);
+		ret = drm_exec_retry_on_contention(&exec, ret);
 		KUNIT_EXPECT_EQ(test, ret, 0);
 		if (ret)
 			break;
@@ -137,7 +137,7 @@ static void test_prepare(struct kunit *test)
 	drm_exec_init(&exec, DRM_EXEC_INTERRUPTIBLE_WAIT, 0);
 	drm_exec_until_all_locked(&exec) {
 		ret = drm_exec_prepare_obj(&exec, &gobj, 1);
-		drm_exec_retry_on_contention(&exec);
+		ret = drm_exec_retry_on_contention(&exec, ret);
 		KUNIT_EXPECT_EQ(test, ret, 0);
 		if (ret)
 			break;
drivers/gpu/drm/xe/xe_gt_pagefault.c +2 -2
index 040dd142c49c..20ec1ab1b52d 100644
@@ -200,7 +200,7 @@ static int handle_pagefault(struct xe_gt *gt, struct pagefault *pf)
 	drm_exec_init(&exec, 0, 0);
 	drm_exec_until_all_locked(&exec) {
 		ret = xe_pf_begin(&exec, vma, atomic, tile->id);
-		drm_exec_retry_on_contention(&exec);
+		ret = drm_exec_retry_on_contention(&exec, ret);
 		if (ret)
 			goto unlock_dma_resv;
 
@@ -543,7 +543,7 @@ static int handle_acc(struct xe_gt *gt, struct acc *acc)
 	drm_exec_init(&exec, 0, 0);
 	drm_exec_until_all_locked(&exec) {
 		ret = xe_pf_begin(&exec, vma, true, tile->id);
-		drm_exec_retry_on_contention(&exec);
+		ret = drm_exec_retry_on_contention(&exec, ret);
 		if (ret)
 			break;
 	}
drivers/gpu/drm/xe/xe_vm.c +5 -5
index e2ec148c9c33..335524e803e7 100644
@@ -501,7 +501,7 @@ static void preempt_rebind_work_func(struct work_struct *w)
 		bool done = false;
 
 		err = xe_preempt_work_begin(&exec, vm, &done);
-		drm_exec_retry_on_contention(&exec);
+		err = drm_exec_retry_on_contention(&exec, err);
 		if (err || done) {
 			drm_exec_fini(&exec);
 			if (err && xe_vm_validate_should_retry(&exec, err, &end))
@@ -1052,7 +1052,7 @@ static void xe_vma_destroy_unlocked(struct xe_vma *vma)
 	drm_exec_init(&exec, 0, 0);
 	drm_exec_until_all_locked(&exec) {
 		err = xe_vm_lock_vma(&exec, vma);
-		drm_exec_retry_on_contention(&exec);
+		err = drm_exec_retry_on_contention(&exec, err);
 		if (XE_WARN_ON(err))
 			break;
 	}
@@ -2148,11 +2148,11 @@ static struct xe_vma *new_vma(struct xe_vm *vm, struct drm_gpuva_op_map *op,
 			err = 0;
 			if (!bo->vm) {
 				err = drm_exec_lock_obj(&exec, xe_vm_obj(vm));
-				drm_exec_retry_on_contention(&exec);
+				err = drm_exec_retry_on_contention(&exec, err);
 			}
 			if (!err) {
 				err = drm_exec_lock_obj(&exec, &bo->ttm.base);
-				drm_exec_retry_on_contention(&exec);
+				err = drm_exec_retry_on_contention(&exec, err);
 			}
 			if (err) {
 				drm_exec_fini(&exec);
@@ -2884,7 +2884,7 @@ static int vm_bind_ioctl_ops_execute(struct xe_vm *vm,
 		      DRM_EXEC_IGNORE_DUPLICATES, 0);
 	drm_exec_until_all_locked(&exec) {
 		err = vm_bind_ioctl_ops_lock_and_prep(&exec, vm, vops);
-		drm_exec_retry_on_contention(&exec);
+		err = drm_exec_retry_on_contention(&exec, err);
 		if (err)
 			goto unlock;
 
include/drm/drm_exec.h +14 -5
index aa786b828a0a..a3490794ef35 100644
@@ -51,6 +51,8 @@ struct drm_exec {
 	struct drm_gem_object *prelocked;
 };
 
+int drm_exec_handle_contended(struct drm_exec *exec);
+
 /**
  * drm_exec_obj() - Return the object for a give drm_exec index
  * @exec: Pointer to the drm_exec context
@@ -117,11 +119,18 @@ __PASTE(__drm_exec_, __LINE__):						\
  * Control flow helper to continue when a contention was detected and we need to
  * clean up and re-start the loop to prepare all GEM objects.
  */
-#define drm_exec_retry_on_contention(exec)			\
-	do {							\
-		if (unlikely(drm_exec_is_contended(exec)))	\
-			goto *__drm_exec_retry_ptr;		\
-	} while (0)
+#define drm_exec_retry_on_contention(exec, _ret)		\
+	({							\
+		int __ret = (_ret);				\
+								\
+		if (unlikely(drm_exec_is_contended(exec))) {		\
+			WARN_ON(__ret != -EDEADLK);			\
+			__ret = drm_exec_handle_contended(exec);	\
+			if (!__ret)					\
+				goto *__drm_exec_retry_ptr;		\
+		}							\
+		__ret;						\
+	})
 
 /**
  * drm_exec_is_contended - check for contention
Signature · 1 line
2.44.0
author maintainer
#6 lore raw

PATCH 6/21 drm/ttm: Provide a generic LRU walker helper

In reply to Thomas Hellström

Provide a generic LRU walker in TTM, in the spirit of drm_gem_lru_scan() but building on the restartable TTM LRU functionality.

The LRU walker optionally supports locking objects as part of a drm_exec locking transaction, and can thus be used for both exhaustive eviction and shrinking. And, in fact, direct shrinking in the case where we fail to populate system memory objects and want to retry by shrinking purgeable or evictable local objects, which a shrinker is not capable of doing.

Cc Christian König <[email protected]>
Cc Somalapuram Amaranath <[email protected]>
---
 drivers/gpu/drm/ttm/ttm_bo_util.c | 162 ++++++++++++++++++++++++++++++
 include/drm/ttm/ttm_bo.h          |  32 ++++++
 2 files changed, 194 insertions(+)
drivers/gpu/drm/ttm/ttm_bo_util.c +162 -0
index 0b3f4267130c..3ca28025dfc3 100644
@@ -768,3 +768,165 @@ int ttm_bo_pipeline_gutting(struct ttm_buffer_object *bo)
 	ttm_tt_destroy(bo->bdev, ttm);
 	return ret;
 }
+
+static bool ttm_lru_walk_trylock(struct ttm_lru_walk *walk,
+				 struct ttm_buffer_object *bo,
+				 bool *needs_unlock)
+{
+	struct ttm_operation_ctx *ctx = walk->ctx;
+
+	*needs_unlock = false;
+
+	if (dma_resv_trylock(bo->base.resv)) {
+		*needs_unlock = true;
+		return true;
+	}
+
+	if (bo->base.resv == ctx->resv && ctx->allow_res_evict) {
+		dma_resv_assert_held(bo->base.resv);
+		return true;
+	}
+
+	return false;
+}
+
+static int ttm_lru_walk_ticketlock(struct ttm_lru_walk *walk,
+				   struct ttm_buffer_object *bo,
+				   bool *needs_unlock)
+{
+	struct dma_resv *resv = bo->base.resv;
+	int ret;
+
+	if (walk->ctx->interruptible)
+		ret = dma_resv_lock_interruptible(resv, walk->ticket);
+	else
+		ret = dma_resv_lock(resv, walk->ticket);
+
+	if (ret == -EDEADLK)
+		ret = -ENOSPC;
+
+	if (!ret) {
+		*needs_unlock = true;
+		/* Only a single ticketlock per loop */
+		walk->ticket = NULL;
+	}
+
+	return ret;
+}
+
+static void ttm_lru_walk_unlock(struct ttm_buffer_object *bo, bool locked)
+{
+	if (locked)
+		dma_resv_unlock(bo->base.resv);
+}
+
+/**
+ * ttm_lru_walk_for_evict() - Perform a LRU list walk, with actions taken on
+ * valid items.
+ * @walk: describe the walks and actions taken
+ * @bdev: The TTM device.
+ * @man: The struct ttm_resource manager whose LRU lists we're walking.
+ * @target: The end condition for the walk.
+ *
+ * The LRU lists of @man are walk, and for each struct ttm_resource encountered,
+ * the corresponding ttm_buffer_object is locked and taken a reference on, and
+ * the LRU lock is dropped. the LRU lock may be dropped before locking and, in
+ * that case, it's verified that the item actually remains on the LRU list after
+ * the lock, and that the buffer object hasn't changed.
+ *
+ * With a locked object, the actions indicated by @walk->process_bo are
+ * performed, and after that, the bo is unlocked, the refcount dropped and the
+ * next struct ttm_resource is processed. Here we rely on TTM's restartable
+ * LRU list implementation.
+ *
+ * Typically @walk->process_bo() would return the number of pages evicted, and
+ * that when the total exceeds @target, or when the LRU list has been walked
+ * in full, iteration is terminated. It's also terminated on error.
+ *
+ * Buffer object dma_resv locking:
+ * This locking is performed using the combined interpretation of @walk->exec and
+ * @walk->ctx according to the following.
+ * 1) Sleeping locks: Sleeping locks are used exclusively if @walk->exec is true.
+ * The buffer object are not unlocked. That is the caller's responsibility.
+ * 2) Assuming bo is already locked: This assumption is made iff @walk->exec is false,
+ * @walk->ctx->allow_res_evict is true and bo->base.resv == @walk->ctx->resv.
+ * This is for cases where it is desired to evict bos sharing a reservation lock
+ * that is already held by the process. Thes bo locks are not unlocked during
+ * the walk.
+ * 3) Trylocking. Trylocking is done in all other cases. If trylocking fails, the
+ * iteration skips the current item and continues. Trylocks are always unlocked
+ * by the walk.
+ *
+ * Note that the way dma_resv individualization is done, locking needs to be done
+ * either with the LRU lock held (trylocking only) or with a reference on the
+ * object.
+ *
+ * Return: (Typically) The number of pages evicted or negative error code on error.
+ */
+long ttm_lru_walk_for_evict(struct ttm_lru_walk *walk, struct ttm_device *bdev,
+			       struct ttm_resource_manager *man, long target)
+{
+	struct ttm_resource_cursor cursor;
+	struct ttm_resource *res;
+	long sofar = 0;
+	long lret;
+
+	spin_lock(&bdev->lru_lock);
+	ttm_resource_manager_for_each_res(man, &cursor, res) {
+		struct ttm_buffer_object *bo = res->bo;
+		bool bo_needs_unlock = false;
+		bool bo_locked = false;
+		int mem_type;
+		
+		if (!bo || bo->resource != res)
+			continue;
+
+		if (ttm_lru_walk_trylock(walk, bo, &bo_needs_unlock))
+			bo_locked = true;
+		else if ((!walk->ticket) || walk->ctx->no_wait_gpu ||
+			 walk->trylock_only)
+			continue;
+
+		if (!ttm_bo_get_unless_zero(bo)) {
+			ttm_lru_walk_unlock(bo, bo_needs_unlock);
+			continue;
+		}
+
+		mem_type = res->mem_type;
+		spin_unlock(&bdev->lru_lock);
+
+		lret = 0;
+		if (!bo_locked && walk->ticket)
+			lret = ttm_lru_walk_ticketlock(walk, bo, &bo_needs_unlock);
+
+		/*
+		 * Note that in between the release of the lru lock and the
+		 * ticketlock, the bo may have switched resource,
+		 * and also memory type, since the resource may have been
+		 * freed and allocated again with a different memory type.
+		 * In that case, just skip it.
+		 */
+		if (!lret && bo->resource == res && res->mem_type == mem_type)
+			lret = walk->ops->process_bo(walk, bo);
+
+		ttm_lru_walk_unlock(bo, bo_needs_unlock);
+		ttm_bo_put(bo);
+		if (lret == -EBUSY)
+			lret = 0;
+		if (lret < 0) {
+			sofar = lret;
+			goto out;
+		}
+
+		sofar += lret;
+		if (sofar >= target)
+			goto out;
+
+		cond_resched();
+		spin_lock(&bdev->lru_lock);
+	}
+	spin_unlock(&bdev->lru_lock);
+out:
+	ttm_resource_cursor_fini(&cursor);
+	return sofar;
+}
include/drm/ttm/ttm_bo.h +32 -0
index 6ccf96c91f3a..8c542ebbe698 100644
@@ -190,6 +190,38 @@ struct ttm_operation_ctx {
 	uint64_t bytes_moved;
 };
 
+struct ttm_lru_walk;
+
+/** struct ttm_lru_walk_ops - Operations for a LRU walk. */
+struct ttm_lru_walk_ops {
+	/**
+	 * process_bo - Process this bo.
+	 * @walk: struct ttm_lru_walk describing the walk.
+	 * @bo: A locked and referenced buffer object.
+	 *
+	 * Return: Negative error code on error, Number of processed pages on
+	 * success. 0 also indicates success.
+	 */
+	long (*process_bo)(struct ttm_lru_walk *walk, struct ttm_buffer_object *bo);
+};
+
+/**
+ * struct ttm_lru_walk - Structure describing a LRU walk.
+ * @ops: Pointer to the ops structure.
+ * @ctx: Pointer to the struct ttm_operation_ctx.
+ * @ticket: The struct ww_acquire_ctx if any.
+ * @tryock_only: Only use trylock for locking.
+ */
+struct ttm_lru_walk {
+	const struct ttm_lru_walk_ops *ops;
+	struct ttm_operation_ctx *ctx;
+	struct ww_acquire_ctx *ticket;
+	bool trylock_only;
+};
+
+long ttm_lru_walk_for_evict(struct ttm_lru_walk *walk, struct ttm_device *bdev,
+			    struct ttm_resource_manager *man, long target);
+
 /**
  * ttm_bo_get - reference a struct ttm_buffer_object
  *
Signature · 1 line
2.44.0
author maintainer
#7 lore raw

PATCH 7/21 drm/ttm: Use restartable LRU and sleeping locks for swapping.

In reply to Thomas Hellström
---
 drivers/gpu/drm/ttm/ttm_bo.c     | 87 ++++++++++++++++++++------------
 drivers/gpu/drm/ttm/ttm_device.c | 29 ++---------
 include/drm/ttm/ttm_bo.h         |  5 +-
 3 files changed, 64 insertions(+), 57 deletions(-)
drivers/gpu/drm/ttm/ttm_bo.c +56 -31
index 43eda720657f..d1c219fd784b 100644
@@ -1118,11 +1118,19 @@ int ttm_bo_wait_ctx(struct ttm_buffer_object *bo, struct ttm_operation_ctx *ctx)
 }
 EXPORT_SYMBOL(ttm_bo_wait_ctx);
 
-int ttm_bo_swapout(struct ttm_buffer_object *bo, struct ttm_operation_ctx *ctx,
-		   gfp_t gfp_flags)
+
+struct ttm_bo_swapout_walk {
+	struct ttm_lru_walk walk;
+	gfp_t gfp_flags;
+};
+
+static long
+ttm_bo_swapout_cb(struct ttm_lru_walk *walk, struct ttm_buffer_object *bo)
 {
-	struct ttm_place place;
-	bool locked;
+	struct ttm_place place = {.mem_type = bo->resource->mem_type};
+	struct ttm_bo_swapout_walk *swapout_walk =
+		container_of(walk, typeof(*swapout_walk), walk);
+	struct ttm_operation_ctx *ctx = walk->ctx;
 	long ret;
 
 	/*
@@ -1131,28 +1139,29 @@ int ttm_bo_swapout(struct ttm_buffer_object *bo, struct ttm_operation_ctx *ctx,
 	 * The driver may use the fact that we're moving from SYSTEM
 	 * as an indication that we're about to swap out.
 	 */
-	memset(&place, 0, sizeof(place));
-	place.mem_type = bo->resource->mem_type;
-	if (!ttm_bo_evict_swapout_allowable(bo, ctx, &place, &locked, NULL))
-		return -EBUSY;
+	if (!bo->bdev->funcs->eviction_valuable(bo, &place)) {
+		ret = -EBUSY;
+		goto out;
+	}
 
 	if (!bo->ttm || !ttm_tt_is_populated(bo->ttm) ||
 	    bo->ttm->page_flags & TTM_TT_FLAG_EXTERNAL ||
-	    bo->ttm->page_flags & TTM_TT_FLAG_SWAPPED ||
-	    !ttm_bo_get_unless_zero(bo)) {
-		if (locked)
-			dma_resv_unlock(bo->base.resv);
-		return -EBUSY;
+	    bo->ttm->page_flags & TTM_TT_FLAG_SWAPPED) {
+		ret = -EBUSY;
+		goto out;
 	}
 
 	if (bo->deleted) {
-		ret = ttm_bo_cleanup_refs(bo, false, false, locked);
-		ttm_bo_put(bo);
-		return ret == -EBUSY ? -ENOSPC : ret;
-	}
+		pgoff_t num_pages = bo->ttm->num_pages;
 
-	/* TODO: Cleanup the locking */
-	spin_unlock(&bo->bdev->lru_lock);
+		ret = ttm_bo_wait_ctx(bo, ctx);
+		if (ret)
+			goto out;
+
+		ttm_bo_cleanup_memtype_use(bo);
+		ret = num_pages;
+		goto out;
+	}
 
 	/*
 	 * Move to system cached
@@ -1164,11 +1173,11 @@ int ttm_bo_swapout(struct ttm_buffer_object *bo, struct ttm_operation_ctx *ctx,
 		memset(&hop, 0, sizeof(hop));
 		place.mem_type = TTM_PL_SYSTEM;
 		ret = ttm_resource_alloc(bo, &place, &evict_mem);
-		if (unlikely(ret))
+		if (ret)
 			goto out;
 
 		ret = ttm_bo_handle_move_mem(bo, evict_mem, true, ctx, &hop);
-		if (unlikely(ret != 0)) {
+		if (ret) {
 			WARN(ret == -EMULTIHOP, "Unexpected multihop in swaput - likely driver bug.\n");
 			ttm_resource_free(bo, &evict_mem);
 			goto out;
@@ -1179,7 +1188,7 @@ int ttm_bo_swapout(struct ttm_buffer_object *bo, struct ttm_operation_ctx *ctx,
 	 * Make sure BO is idle.
 	 */
 	ret = ttm_bo_wait_ctx(bo, ctx);
-	if (unlikely(ret != 0))
+	if (ret)
 		goto out;
 
 	ttm_bo_unmap_virtual(bo);
@@ -1192,19 +1201,35 @@ int ttm_bo_swapout(struct ttm_buffer_object *bo, struct ttm_operation_ctx *ctx,
 		bo->bdev->funcs->swap_notify(bo);
 
 	if (ttm_tt_is_populated(bo->ttm))
-		ret = ttm_tt_swapout(bo->bdev, bo->ttm, gfp_flags);
+		ret = ttm_tt_swapout(bo->bdev, bo->ttm, swapout_walk->gfp_flags);
 out:
+	/* Consider some error codes fatal. Others may continue the walk. */
+	if (ret == -ENOMEM || ret == -EINTR || ret == -ERESTARTSYS ||
+	    ret == -EAGAIN || ret > 0)
+		return ret;
 
-	/*
-	 * Unreserve without putting on LRU to avoid swapping out an
-	 * already swapped buffer.
-	 */
-	if (locked)
-		dma_resv_unlock(bo->base.resv);
-	ttm_bo_put(bo);
-	return ret == -EBUSY ? -ENOSPC : ret;
+	return 0;
 }
 
+const struct ttm_lru_walk_ops ttm_swap_ops = {
+	.process_bo = ttm_bo_swapout_cb,
+};
+
+long ttm_bo_swapout(struct ttm_device *bdev, struct ttm_operation_ctx *ctx,
+		    struct ttm_resource_manager *man, gfp_t gfp_flags,
+		    pgoff_t target)
+{
+	struct ttm_bo_swapout_walk swapout_walk = {
+		.walk = {
+			.ops = &ttm_swap_ops,
+			.ctx = ctx,
+		},
+		.gfp_flags = gfp_flags,
+	};
+
+	return ttm_lru_walk_for_evict(&swapout_walk.walk, bdev, man, target);
+}
+	
 void ttm_bo_tt_destroy(struct ttm_buffer_object *bo)
 {
 	if (bo->ttm == NULL)
drivers/gpu/drm/ttm/ttm_device.c +5 -24
index f9e9b1ec8c8a..c9d08ecc0f3b 100644
@@ -148,11 +148,9 @@ int ttm_global_swapout(struct ttm_operation_ctx *ctx, gfp_t gfp_flags)
 int ttm_device_swapout(struct ttm_device *bdev, struct ttm_operation_ctx *ctx,
 		       gfp_t gfp_flags)
 {
-	struct ttm_resource_cursor cursor;
 	struct ttm_resource_manager *man;
-	struct ttm_resource *res;
 	unsigned i;
-	int ret;
+	long lret;
 
 	spin_lock(&bdev->lru_lock);
 	for (i = TTM_PL_SYSTEM; i < TTM_NUM_MEM_TYPES; ++i) {
@@ -160,28 +158,11 @@ int ttm_device_swapout(struct ttm_device *bdev, struct ttm_operation_ctx *ctx,
 		if (!man || !man->use_tt)
 			continue;
 
-		ttm_resource_manager_for_each_res(man, &cursor, res) {
-			struct ttm_buffer_object *bo = res->bo;
-			uint32_t num_pages;
-
-			if (!bo || bo->resource != res)
-				continue;
-
-			num_pages = PFN_UP(bo->base.size);
-			ret = ttm_bo_swapout(bo, ctx, gfp_flags);
-			/* ttm_bo_swapout has dropped the lru_lock */
-			if (!ret) {
-				ttm_resource_cursor_fini(&cursor);
-				return num_pages;
-			}
-			if (ret != -EBUSY) {
-				ttm_resource_cursor_fini(&cursor);
-				return ret;
-			}
-		}
+		lret = ttm_bo_swapout(bdev, ctx, man, gfp_flags, 1);
+		/* Can be both positive (num_pages) and negative (error) */
+		if (lret)
+			return lret;
 	}
-	ttm_resource_cursor_fini_locked(&cursor);
-	spin_unlock(&bdev->lru_lock);
 	return 0;
 }
 EXPORT_SYMBOL(ttm_device_swapout);
include/drm/ttm/ttm_bo.h +3 -2
index 8c542ebbe698..8c43939e95e9 100644
@@ -410,8 +410,9 @@ void ttm_bo_kunmap(struct ttm_bo_kmap_obj *map);
 int ttm_bo_vmap(struct ttm_buffer_object *bo, struct iosys_map *map);
 void ttm_bo_vunmap(struct ttm_buffer_object *bo, struct iosys_map *map);
 int ttm_bo_mmap_obj(struct vm_area_struct *vma, struct ttm_buffer_object *bo);
-int ttm_bo_swapout(struct ttm_buffer_object *bo, struct ttm_operation_ctx *ctx,
-		   gfp_t gfp_flags);
+long ttm_bo_swapout(struct ttm_device *bdev, struct ttm_operation_ctx *ctx,
+		    struct ttm_resource_manager *man, gfp_t gfp_flags,
+		    pgoff_t target);
 void ttm_bo_pin(struct ttm_buffer_object *bo);
 void ttm_bo_unpin(struct ttm_buffer_object *bo);
 int ttm_mem_evict_first(struct ttm_device *bdev,
Signature · 1 line
2.44.0
author maintainer
#9 lore raw

PATCH 9/21 drm/ttm: Add a virtual base class for graphics memory backup

In reply to Thomas Hellström

Initially intended for experimenting with different backup solutions (shmem vs direct swap cache insertion), abstract the backup destination using a virtual base class.

Also provide a sample implementation for shmem.

While when settling on a preferred backup solution, one could perhaps skip the abstraction, this functionality may actually come in handy for configurable dedicated graphics memory backup to fast nvme files or similar, whithout affecting swap-space. Could indeed be useful for VRAM backup on S4 and other cases.

Cc Christian König <[email protected]>
Cc Somalapuram Amaranath <[email protected]>
---
 drivers/gpu/drm/ttm/Makefile           |   2 +-
 drivers/gpu/drm/ttm/ttm_backup_shmem.c | 137 +++++++++++++++++++++++++
 include/drm/ttm/ttm_backup.h           | 136 ++++++++++++++++++++++++
 3 files changed, 274 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/ttm/ttm_backup_shmem.c
 create mode 100644 include/drm/ttm/ttm_backup.h
drivers/gpu/drm/ttm/Makefile +1 -1
index dad298127226..5e980dd90e41 100644
@@ -4,7 +4,7 @@
 
 ttm-y := ttm_tt.o ttm_bo.o ttm_bo_util.o ttm_bo_vm.o ttm_module.o \
 	ttm_execbuf_util.o ttm_range_manager.o ttm_resource.o ttm_pool.o \
-	ttm_device.o ttm_sys_manager.o
+	ttm_device.o ttm_sys_manager.o ttm_backup_shmem.o
 ttm-$(CONFIG_AGP) += ttm_agp_backend.o
 
 obj-$(CONFIG_DRM_TTM) += ttm.o
drivers/gpu/drm/ttm/ttm_backup_shmem.c new file +137 -0

137 lines not on this page · raw message

include/drm/ttm/ttm_backup.h new file +136 -0

136 lines not on this page · raw message

Signature · 1 line
2.44.0
author maintainer
#10 lore raw

PATCH 10/21 drm/ttm/pool: Provide a helper to shrink pages.

In reply to Thomas Hellström

Provide a helper to shrink ttm_tt page-vectors on a per-page basis. A ttm_backup backend could then in theory get away with allocating a single temporary page for each struct ttm_tt.

This is accomplished by splitting larger pages before trying to back them up.

In the future we could allow ttm_backup to handle backing up large pages as well, but currently there's no benefit in doing that, since the shmem backup backend would have to split those anyway to avoid allocating too much temporary memory, and if the backend instead inserts pages into the swap-cache, those are split on reclaim by the core.

Due to potential backup- and recover errors, allow partially swapped out struct ttm_tt's, although mark them as swapped out stopping them from being swapped out a second time. More details in the ttm_pool.c DOC section.

v2:
- A couple of cleanups and error fixes in ttm_pool_back_up_tt.
- s/back_up/backup/
- Add a writeback parameter to the exported interface.

Cc Christian König <[email protected]>
Cc Somalapuram Amaranath <[email protected]>
---
 drivers/gpu/drm/ttm/ttm_pool.c | 397 +++++++++++++++++++++++++++++++--
 drivers/gpu/drm/ttm/ttm_tt.c   |  37 +++
 include/drm/ttm/ttm_pool.h     |   5 +
 include/drm/ttm/ttm_tt.h       |  20 ++
 4 files changed, 446 insertions(+), 13 deletions(-)
drivers/gpu/drm/ttm/ttm_pool.c +384 -13
index 6e1fd6985ffc..38e50cf81b0a 100644
@@ -41,6 +41,7 @@
 #include <asm/set_memory.h>
 #endif
 
+#include <drm/ttm/ttm_backup.h>
 #include <drm/ttm/ttm_pool.h>
 #include <drm/ttm/ttm_tt.h>
 #include <drm/ttm/ttm_bo.h>
@@ -58,6 +59,32 @@ struct ttm_pool_dma {
 	unsigned long vaddr;
 };
 
+/**
+ * struct ttm_pool_tt_restore - State representing restore from backup
+ * @alloced_pages: Total number of already allocated pages for the ttm_tt.
+ * @restored_pages: Number of (sub) pages restored from swap for this
+ *		     chunk of 1 << @order pages.
+ * @first_page: The ttm page ptr representing for @old_pages[0].
+ * @caching_divide: Page pointer where subsequent pages are cached.
+ * @old_pages: Backup copy of page pointers that were replaced by the new
+ *	       page allocation.
+ * @pool: The pool used for page allocation while restoring.
+ * @order: The order of the last page allocated while restoring.
+ *
+ * Recovery from backup might fail when we've recovered less than the
+ * full ttm_tt. In order not to loose any data (yet), keep information
+ * around that allows us to restart a failed ttm backup recovery.
+ */
+struct ttm_pool_tt_restore {
+	pgoff_t alloced_pages;
+	pgoff_t restored_pages;
+	struct page **first_page;
+	struct page **caching_divide;
+	struct ttm_pool *pool;
+	unsigned int order;
+	struct page *old_pages[];
+};
+
 static unsigned long page_pool_size;
 
 MODULE_PARM_DESC(page_pool_size, "Number of pages in the WC/UC/DMA pool");
@@ -354,11 +381,102 @@ static unsigned int ttm_pool_page_order(struct ttm_pool *pool, struct page *p)
 	return p->private;
 }
 
+/*
+ * To be able to insert single pages into backup directly,
+ * we need to split multi-order page allocations and make them look
+ * like single-page allocations.
+ */
+static void ttm_pool_split_for_swap(struct ttm_pool *pool, struct page *p)
+{
+	unsigned int order = ttm_pool_page_order(pool, p);
+	pgoff_t nr;
+
+	if (!order)
+		return;
+
+	split_page(p, order);
+	nr = 1UL << order;
+	while (nr--)
+		(p++)->private = 0;
+}
+
+/**
+ * DOC: Partial backup and restoration of a struct ttm_tt.
+ *
+ * Swapout using ttm_backup::ops::backup_page() and swapin using
+ * ttm_backup::ops::copy_backed_up_page() may fail.
+ * The former most likely due to lack of swap-space or memory, the latter due
+ * to lack of memory or because of signal interruption during waits.
+ *
+ * Backupfailure is easily handled by using a ttm_tt pages vector that holds
+ * both swap entries and page pointers. This has to be taken into account when
+ * restoring such a ttm_tt from backup, and when freeing it while backed up.
+ * When restoring, for simplicity, new pages are actually allocated from the
+ * pool and the contents of any old pages are copied in and then the old pages
+ * are released.
+ *
+ * For restoration failures, the struct ttm_pool_tt_restore holds sufficient state
+ * to be able to resume an interrupted restore, and that structure is freed once
+ * the restoration is complete. If the struct ttm_tt is destroyed while there
+ * is a valid struct ttm_pool_tt_restore attached, that is also properly taken
+ * care of.
+ */
+
+static bool ttm_pool_restore_valid(const struct ttm_pool_tt_restore *restore)
+{
+	return restore && restore->restored_pages < (1 << restore->order);
+}
+
+static int ttm_pool_restore_tt(struct ttm_pool_tt_restore *restore,
+			       struct ttm_backup *backup,
+			       struct ttm_operation_ctx *ctx)
+{
+	unsigned int i, nr = 1 << restore->order;
+	int ret = 0;
+
+	if (!ttm_pool_restore_valid(restore))
+		return 0;
+
+	for (i = restore->restored_pages; i < nr; ++i) {
+		struct page *p = restore->old_pages[i];
+
+		if (ttm_backup_page_ptr_is_handle(p)) {
+			unsigned long handle = ttm_backup_page_ptr_to_handle(p);
+
+			if (handle == 0)
+				continue;
+
+			ret = backup->ops->copy_backed_up_page
+				(backup, restore->first_page[i],
+				 handle, ctx->interruptible);
+			if (ret)
+				break;
+
+			backup->ops->drop(backup, handle);
+		} else if (p) {
+			/*
+			 * We could probably avoid splitting the old page
+			 * using clever logic, but ATM we don't care.
+			 */
+			ttm_pool_split_for_swap(restore->pool, p);
+			copy_highpage(restore->first_page[i], p);
+			__free_pages(p, 0);
+		}
+
+		restore->restored_pages++;
+		restore->old_pages[i] = NULL;
+		cond_resched();
+	}
+
+	return ret;
+}
+
 /* Called when we got a page, either from a pool or newly allocated */
 static int ttm_pool_page_allocated(struct ttm_pool *pool, unsigned int order,
 				   struct page *p, dma_addr_t **dma_addr,
 				   unsigned long *num_pages,
-				   struct page ***pages)
+				   struct page ***pages,
+				   struct ttm_pool_tt_restore *restore)
 {
 	unsigned int i;
 	int r;
@@ -369,6 +487,16 @@ static int ttm_pool_page_allocated(struct ttm_pool *pool, unsigned int order,
 			return r;
 	}
 
+	if (restore) {
+		memcpy(restore->old_pages, *pages,
+		       (1 << order) * sizeof(*restore->old_pages));
+		memset(*pages, 0, (1 << order) * sizeof(**pages));
+		restore->order = order;
+		restore->restored_pages = 0;
+		restore->first_page = *pages;
+		restore->alloced_pages += 1UL << order;
+	}
+
 	*num_pages -= 1 << order;
 	for (i = 1 << order; i; --i, ++(*pages), ++p)
 		**pages = p;
@@ -394,22 +522,39 @@ static void ttm_pool_free_range(struct ttm_pool *pool, struct ttm_tt *tt,
 				pgoff_t start_page, pgoff_t end_page)
 {
 	struct page **pages = &tt->pages[start_page];
+	struct ttm_backup *backup = tt->backup;
 	unsigned int order;
 	pgoff_t i, nr;
 
 	for (i = start_page; i < end_page; i += nr, pages += nr) {
 		struct ttm_pool_type *pt = NULL;
+		struct page *p = *pages;
+
+		if (ttm_backup_page_ptr_is_handle(p)) {
+			unsigned long handle = ttm_backup_page_ptr_to_handle(p);
+
+			nr = 1;
+			if (handle != 0)
+				backup->ops->drop(backup, handle);
+			continue;
+		}
+
+		if (pool) {
+			order = ttm_pool_page_order(pool, p);
+			nr = (1UL << order);
+			if (tt->dma_address)
+				ttm_pool_unmap(pool, tt->dma_address[i], nr);
 
-		order = ttm_pool_page_order(pool, *pages);
-		nr = (1UL << order);
-		if (tt->dma_address)
-			ttm_pool_unmap(pool, tt->dma_address[i], nr);
+			pt = ttm_pool_select_type(pool, caching, order);
+		} else {
+			order = p->private;
+			nr = (1UL << order);
+		}
 
-		pt = ttm_pool_select_type(pool, caching, order);
 		if (pt)
-			ttm_pool_type_give(pt, *pages);
+			ttm_pool_type_give(pt, p);
 		else
-			ttm_pool_free_page(pool, caching, order, *pages);
+			ttm_pool_free_page(pool, caching, order, p);
 	}
 }
 
@@ -453,9 +598,37 @@ int ttm_pool_alloc(struct ttm_pool *pool, struct ttm_tt *tt,
 	else
 		gfp_flags |= GFP_HIGHUSER;
 
-	for (order = min_t(unsigned int, MAX_PAGE_ORDER, __fls(num_pages));
-	     num_pages;
-	     order = min_t(unsigned int, order, __fls(num_pages))) {
+	order = min_t(unsigned int, MAX_PAGE_ORDER, __fls(num_pages));
+
+	if (tt->page_flags & TTM_TT_FLAG_PRIV_BACKED_UP) {
+		if (!tt->restore) {
+			gfp_t gfp = GFP_KERNEL | __GFP_NOWARN;
+
+			if (ctx->gfp_retry_mayfail)
+				gfp |= __GFP_RETRY_MAYFAIL;
+
+			tt->restore =
+				kvzalloc(struct_size(tt->restore, old_pages,
+						     (size_t)1 << order), gfp);
+			/* RFC: Possibly loop on -ENOMEM and reduce order. */
+			if (!tt->restore)
+				return -ENOMEM;
+		} else if (ttm_pool_restore_valid(tt->restore)) {
+			struct ttm_pool_tt_restore *restore = tt->restore;
+
+			num_pages -= restore->alloced_pages;
+			order = min_t(unsigned int, order, __fls(num_pages));
+			pages += restore->alloced_pages;
+			r = ttm_pool_restore_tt(restore, tt->backup, ctx);
+			if (r)
+				return r;
+			caching = restore->caching_divide;
+		}
+
+		tt->restore->pool = pool;
+	}
+
+	for (; num_pages; order = min_t(unsigned int, order, __fls(num_pages))) {
 		struct ttm_pool_type *pt;
 
 		page_caching = tt->caching;
@@ -472,11 +645,19 @@ int ttm_pool_alloc(struct ttm_pool *pool, struct ttm_tt *tt,
 				r = ttm_pool_page_allocated(pool, order, p,
 							    &dma_addr,
 							    &num_pages,
-							    &pages);
+							    &pages,
+							    tt->restore);
 				if (r)
 					goto error_free_page;
 
 				caching = pages;
+				if (ttm_pool_restore_valid(tt->restore)) {
+					r = ttm_pool_restore_tt(tt->restore, tt->backup,
+								ctx);
+					if (r)
+						goto error_free_all;
+				}
+
 				if (num_pages < (1 << order))
 					break;
 
@@ -496,9 +677,17 @@ int ttm_pool_alloc(struct ttm_pool *pool, struct ttm_tt *tt,
 				caching = pages;
 			}
 			r = ttm_pool_page_allocated(pool, order, p, &dma_addr,
-						    &num_pages, &pages);
+						    &num_pages, &pages,
+						    tt->restore);
 			if (r)
 				goto error_free_page;
+
+			if (ttm_pool_restore_valid(tt->restore)) {
+				r = ttm_pool_restore_tt(tt->restore, tt->backup, ctx);
+				if (r)
+					goto error_free_all;
+			}
+
 			if (PageHighMem(p))
 				caching = pages;
 		}
@@ -517,12 +706,26 @@ int ttm_pool_alloc(struct ttm_pool *pool, struct ttm_tt *tt,
 	if (r)
 		goto error_free_all;
 
+	if (tt->restore) {
+		kvfree(tt->restore);
+		tt->restore = NULL;
+	}
+
+	if (tt->page_flags & TTM_TT_FLAG_PRIV_BACKED_UP)
+		tt->page_flags &= ~(TTM_TT_FLAG_PRIV_BACKED_UP |
+				    TTM_TT_FLAG_SWAPPED);
+
 	return 0;
 
 error_free_page:
 	ttm_pool_free_page(pool, page_caching, order, p);
 
 error_free_all:
+	if (tt->page_flags & TTM_TT_FLAG_PRIV_BACKED_UP) {
+		tt->restore->caching_divide = caching;
+		return r;
+	}
+
 	num_pages = tt->num_pages - num_pages;
 	caching_divide = caching - tt->pages;
 	ttm_pool_free_range(pool, tt, tt->caching, 0, caching_divide);
@@ -549,6 +752,174 @@ void ttm_pool_free(struct ttm_pool *pool, struct ttm_tt *tt)
 }
 EXPORT_SYMBOL(ttm_pool_free);
 
+/**
+ * ttm_pool_release_backed_up() - Release content of a swapped-out struct ttm_tt
+ * @tt: The struct ttm_tt.
+ *
+ * Release handles with associated content or any remaining pages of
+ * a backed-up struct ttm_tt.
+ */
+void ttm_pool_release_backed_up(struct ttm_tt *tt)
+{
+	struct ttm_backup *backup = tt->backup;
+	struct ttm_pool_tt_restore *restore;
+	pgoff_t i, start_page = 0;
+	unsigned long handle;
+
+	if (!(tt->page_flags & TTM_TT_FLAG_PRIV_BACKED_UP))
+		return;
+
+	restore = tt->restore;
+
+	if (ttm_pool_restore_valid(restore)) {
+		pgoff_t nr = 1UL << restore->order;
+
+		for (i = restore->restored_pages; i < nr; ++i) {
+			struct page *p = restore->old_pages[i];
+
+			if (ttm_backup_page_ptr_is_handle(p)) {
+				handle = ttm_backup_page_ptr_to_handle(p);
+				if (handle == 0)
+					continue;
+
+				backup->ops->drop(backup, handle);
+			} else if (p) {
+				ttm_pool_split_for_swap(restore->pool, p);
+				__free_pages(p, 0);
+			}
+		}
+	}
+
+	if (restore) {
+		pgoff_t mid = restore->caching_divide - tt->pages;
+
+		start_page = restore->alloced_pages;
+		/* Pages that might be dma-mapped and non-cached */
+		ttm_pool_free_range(restore->pool, tt, tt->caching,
+				    0, mid);
+		/* Pages that might be dma-mapped but cached */
+		ttm_pool_free_range(restore->pool, tt, ttm_cached,
+				    mid, restore->alloced_pages);
+	}
+
+	/* Shrunken pages. Cached and not dma-mapped. */
+	ttm_pool_free_range(NULL, tt, ttm_cached, start_page, tt->num_pages);
+
+	if (restore) {
+		kvfree(restore);
+		tt->restore = NULL;
+	}
+
+	tt->page_flags &= ~(TTM_TT_FLAG_PRIV_BACKED_UP | TTM_TT_FLAG_SWAPPED);
+}
+
+/**
+ * ttm_pool_backup_tt() - Back up or purge a struct ttm_tt
+ * @pool: The pool used when allocating the struct ttm_tt.
+ * @ttm: The struct ttm_tt.
+ * @purge: Don't back up but release pages directly to system.
+ * @writeback: If !@purge, Try to write out directly to the
+ * underlying persistent media.
+ *
+ * Back up or purge a struct ttm_tt. If @purge is true, then
+ * all pages will be freed directly to the system rather than to the pool
+ * they were allocated from, making the function behave similarly to
+ * ttm_pool_free(). If @purge is false the pages will be backed up instead,
+ * exchanged for handles.
+ * A subsequent call to ttm_pool_alloc() will then read back the content and
+ * a subsequent call to ttm_pool_release_shrunken() will drop it.
+ * If backup of a page fails for whatever reason, @ttm will still be
+ * partially backed up, retaining those pages for which backup fails.
+ *
+ * Return: Number of pages actually backed up or freed, or negative
+ * error code on error.
+ */
+long ttm_pool_backup_tt(struct ttm_pool *pool, struct ttm_tt *ttm, bool purge,
+			bool writeback)
+{
+	struct ttm_backup *backup = ttm->backup;
+	struct page *page;
+	unsigned long handle;
+	gfp_t alloc_gfp;
+	gfp_t gfp;
+	int ret = 0;
+	pgoff_t shrunken = 0;
+	pgoff_t i, num_pages;
+
+	if ((!get_nr_swap_pages() && !purge) ||
+	    pool->use_dma_alloc ||
+	    (ttm->page_flags & TTM_TT_FLAG_PRIV_BACKED_UP))
+		return -EBUSY;
+
+#ifdef CONFIG_X86
+	/* Anything returned to the system needs to be cached. */
+	if (ttm->caching != ttm_cached)
+		set_pages_array_wb(ttm->pages, ttm->num_pages);
+#endif
+
+	if (ttm->dma_address || purge) {
+		for (i = 0; i < ttm->num_pages; i += num_pages) {
+			unsigned int order;
+
+			page = ttm->pages[i];
+			if (unlikely(!page)) {
+				num_pages = 1;
+				continue;
+			}
+
+			order = ttm_pool_page_order(pool, page);
+			num_pages = 1UL << order;
+			if (ttm->dma_address)
+				ttm_pool_unmap(pool, ttm->dma_address[i],
+					       num_pages);
+			if (purge) {
+				shrunken += num_pages;
+				page->private = 0;
+				__free_pages(page, order);
+				memset(ttm->pages + i, 0,
+				       num_pages * sizeof(*ttm->pages));
+			}
+		}
+	}
+
+	if (purge)
+		return shrunken;
+
+	if (pool->use_dma32)
+		gfp = GFP_DMA32;
+	else
+		gfp = GFP_HIGHUSER;
+
+	alloc_gfp = GFP_KERNEL | __GFP_HIGH | __GFP_NOWARN | __GFP_RETRY_MAYFAIL;
+
+	for (i = 0; i < ttm->num_pages; ++i) {
+		page = ttm->pages[i];
+		if (unlikely(!page))
+			continue;
+
+		ttm_pool_split_for_swap(pool, page);
+
+		handle = backup->ops->backup_page(backup, page, writeback, i,
+						  gfp, alloc_gfp);
+		if (handle) {
+			ttm->pages[i] = ttm_backup_handle_to_page_ptr(handle);
+			put_page(page);
+			shrunken++;
+		} else {
+			/* We allow partially shrunken tts */
+			ret = -ENOMEM;
+			break;
+		}
+		cond_resched();
+	}
+
+	if (shrunken)
+		ttm->page_flags |= (TTM_TT_FLAG_PRIV_BACKED_UP |
+				    TTM_TT_FLAG_SWAPPED);
+
+	return shrunken ? shrunken : ret;
+}
+
 /**
  * ttm_pool_init - Initialize a pool
  *
drivers/gpu/drm/ttm/ttm_tt.c +37 -0
index 7b00ddf0ce49..bc994b8e7e73 100644
@@ -40,6 +40,7 @@
 #include <drm/drm_cache.h>
 #include <drm/drm_device.h>
 #include <drm/drm_util.h>
+#include <drm/ttm/ttm_backup.h>
 #include <drm/ttm/ttm_bo.h>
 #include <drm/ttm/ttm_tt.h>
 
@@ -158,6 +159,7 @@ static void ttm_tt_init_fields(struct ttm_tt *ttm,
 	ttm->swap_storage = NULL;
 	ttm->sg = bo->sg;
 	ttm->caching = caching;
+	ttm->restore = NULL;
 }
 
 int ttm_tt_init(struct ttm_tt *ttm, struct ttm_buffer_object *bo,
@@ -182,6 +184,12 @@ void ttm_tt_fini(struct ttm_tt *ttm)
 		fput(ttm->swap_storage);
 	ttm->swap_storage = NULL;
 
+	ttm_pool_release_backed_up(ttm);
+	if (ttm->backup) {
+		ttm->backup->ops->fini(ttm->backup);
+		ttm->backup = NULL;
+	}
+
 	if (ttm->pages)
 		kvfree(ttm->pages);
 	else
@@ -252,6 +260,35 @@ int ttm_tt_swapin(struct ttm_tt *ttm)
 	return ret;
 }
 
+/**
+ * ttm_tt_backup() - Helper to back up a struct ttm_tt.
+ * @bdev: The TTM device.
+ * @tt: The struct ttm_tt.
+ * @purge: Don't back up but release pages directly to system,
+ * bypassing any pooling.
+ * @writeback: If !@purge, try to write out directly to the
+ * underlying persistent media.
+ *
+ * Helper for a TTM driver to use from the bo_shrink() method to shrink
+ * a struct ttm_tt, after it has done the necessary unbinding. This function
+ * will update the page accounting and call ttm_pool_shrink_tt to free pages
+ * or move them to the swap cache.
+ *
+ * Return: Number of pages freed or swapped out, or negative error code on
+ * error.
+ */
+long ttm_tt_backup(struct ttm_device *bdev, struct ttm_tt *tt, bool purge,
+		   bool writeback)
+{
+	long ret = ttm_pool_backup_tt(&bdev->pool, tt, purge, writeback);
+
+	if (ret > 0)
+		tt->page_flags &= ~TTM_TT_FLAG_PRIV_POPULATED;
+
+	return ret;
+}
+EXPORT_SYMBOL(ttm_tt_backup);
+
 /**
  * ttm_tt_swapout - swap out tt object
  *
include/drm/ttm/ttm_pool.h +5 -0
index 160d954a261e..4e4db369952b 100644
@@ -89,6 +89,11 @@ void ttm_pool_fini(struct ttm_pool *pool);
 
 int ttm_pool_debugfs(struct ttm_pool *pool, struct seq_file *m);
 
+void ttm_pool_release_backed_up(struct ttm_tt *tt);
+
+long ttm_pool_backup_tt(struct ttm_pool *pool, struct ttm_tt *ttm,
+			bool purge, bool writeback);
+
 int ttm_pool_mgr_init(unsigned long num_pages);
 void ttm_pool_mgr_fini(void);
 
include/drm/ttm/ttm_tt.h +20 -0
index 2b9d856ff388..6b990f1e7dd0 100644
@@ -32,11 +32,13 @@
 #include <drm/ttm/ttm_caching.h>
 #include <drm/ttm/ttm_kmap_iter.h>
 
+struct ttm_backup;
 struct ttm_device;
 struct ttm_tt;
 struct ttm_resource;
 struct ttm_buffer_object;
 struct ttm_operation_ctx;
+struct ttm_pool_tt_restore;
 
 /**
  * struct ttm_tt - This is a structure holding the pages, caching- and aperture
@@ -85,6 +87,9 @@ struct ttm_tt {
 	 * fault handling abuses the DMA api a bit and dma_map_attrs can't be
 	 * used to assure pgprot always matches.
 	 *
+	 * TTM_TT_FLAG_PRIV_BACKED_UP: TTM internal only. This is set if the
+	 * struct ttm_tt has been (possibly partially) backed up.
+	 *
 	 * TTM_TT_FLAG_PRIV_POPULATED: TTM internal only. DO NOT USE. This is
 	 * set by TTM after ttm_tt_populate() has successfully returned, and is
 	 * then unset when TTM calls ttm_tt_unpopulate().
@@ -96,6 +101,7 @@ struct ttm_tt {
 #define TTM_TT_FLAG_DECRYPTED		BIT(4)
 
 #define TTM_TT_FLAG_PRIV_POPULATED	BIT(5)
+#define TTM_TT_FLAG_PRIV_BACKED_UP	BIT(6)
 	uint32_t page_flags;
 	/** @num_pages: Number of pages in the page array. */
 	uint32_t num_pages;
@@ -105,11 +111,21 @@ struct ttm_tt {
 	dma_addr_t *dma_address;
 	/** @swap_storage: Pointer to shmem struct file for swap storage. */
 	struct file *swap_storage;
+	/**
+	 * @backup: Pointer to backup struct for backed up tts.
+	 * RFC: Could possibly be unified with @swap_storage.
+	 */
+	struct ttm_backup *backup;
 	/**
 	 * @caching: The current caching state of the pages, see enum
 	 * ttm_caching.
 	 */
 	enum ttm_caching caching;
+	/**
+	 * @restore: Partial restoration from backup state.
+	 * RFC: Incorporate in struct ttm_backup?
+	 */
+	struct ttm_pool_tt_restore *restore;
 };
 
 /**
@@ -230,6 +246,10 @@ void ttm_tt_mgr_init(unsigned long num_pages, unsigned long num_dma32_pages);
 struct ttm_kmap_iter *ttm_kmap_iter_tt_init(struct ttm_kmap_iter_tt *iter_tt,
 					    struct ttm_tt *tt);
 unsigned long ttm_tt_pages_limit(void);
+
+long ttm_tt_backup(struct ttm_device *bdev, struct ttm_tt *tt, bool purge,
+		   bool writeback);
+
 #if IS_ENABLED(CONFIG_AGP)
 #include <linux/agp_backend.h>
 
Signature · 1 line
2.44.0
author maintainer
#12 lore raw

PATCH 12/21 drm/ttm, drm/xe: Add a shrinker for xe bos

In reply to Thomas Hellström

Rather than relying on the TTM watermark accounting add a shrinker for xe_bos in TT or system memory.

Leverage the newly added TTM per-page shrinking and shmem backup support.

Although xe doesn't fully support WONTNEED (purgeable) bos yet, introduce and add shrinker support for purgeable ttm_tts.

v2:
- Cleanups bugfixes and a KUNIT shrinker test.
- Add writeback support, and activate if kswapd.

---
 drivers/gpu/drm/ttm/ttm_bo_util.c     |  75 +++++++++
 drivers/gpu/drm/xe/Makefile           |   1 +
 drivers/gpu/drm/xe/tests/xe_bo.c      | 118 ++++++++++++++
 drivers/gpu/drm/xe/tests/xe_bo_test.c |   1 +
 drivers/gpu/drm/xe/tests/xe_bo_test.h |   1 +
 drivers/gpu/drm/xe/xe_bo.c            | 128 +++++++++++++--
 drivers/gpu/drm/xe/xe_bo.h            |   4 +
 drivers/gpu/drm/xe/xe_device.c        |   8 +
 drivers/gpu/drm/xe/xe_device_types.h  |   2 +
 drivers/gpu/drm/xe/xe_shrinker.c      | 224 ++++++++++++++++++++++++++
 drivers/gpu/drm/xe/xe_shrinker.h      |  18 +++
 include/drm/ttm/ttm_bo.h              |   3 +
 12 files changed, 567 insertions(+), 16 deletions(-)
 create mode 100644 drivers/gpu/drm/xe/xe_shrinker.c
 create mode 100644 drivers/gpu/drm/xe/xe_shrinker.h
drivers/gpu/drm/ttm/ttm_bo_util.c +75 -0
index 3ca28025dfc3..1d9c066689e8 100644
@@ -930,3 +930,78 @@ long ttm_lru_walk_for_evict(struct ttm_lru_walk *walk, struct ttm_device *bdev,
 	ttm_resource_cursor_fini(&cursor);
 	return sofar;
 }
+EXPORT_SYMBOL(ttm_lru_walk_for_evict);
+
+/**
+ * ttm_bo_try_shrink - LRU walk helper to shrink a ttm buffer object.
+ * @walk: The struct xe_ttm_lru_walk that describes the walk.
+ * @bo: The buffer object.
+ * @purge: Whether to attempt to purge the bo content since it's no
+ * longer needed.
+ * @writeback: If !@purge, attempt to write out to persistent storage.
+ *
+ * The function uses the ttm_tt_back_up functionality to back up or
+ * purge a struct ttm_tt. If the bo is not in system, it's first
+ * moved there.
+ *
+ * Return: The number of pages shrunken or purged, or
+ * negative error code on failure.
+ */
+long ttm_bo_try_shrink(struct ttm_lru_walk *walk, struct ttm_buffer_object *bo,
+		       bool purge, bool writeback)
+{
+	static const struct ttm_place sys_placement_flags = {
+		.fpfn = 0,
+		.lpfn = 0,
+		.mem_type = TTM_PL_SYSTEM,
+		.flags = 0,
+	};
+	static struct ttm_placement sys_placement = {
+		.num_placement = 1,
+		.placement = &sys_placement_flags,
+	};
+	struct ttm_operation_ctx *ctx = walk->ctx;
+	struct ttm_tt *tt = bo->ttm;
+	long lret;
+
+	dma_resv_assert_held(bo->base.resv);
+
+	if (!tt || !ttm_tt_is_populated(tt))
+		return 0;
+
+	if (bo->resource->mem_type != TTM_PL_SYSTEM) {
+		int ret = ttm_bo_validate(bo, &sys_placement, ctx);
+
+		if (ret) {
+			if (ret == -EINTR || ret == -EDEADLK ||
+			    ret == -ERESTARTSYS)
+				return ret;
+			return 0;
+		}
+	}
+
+	if (ctx->no_wait_gpu &&
+	    !dma_resv_test_signaled(bo->base.resv,
+				    DMA_RESV_USAGE_BOOKKEEP))
+		return 0;
+
+	lret = dma_resv_wait_timeout(bo->base.resv,
+				     DMA_RESV_USAGE_BOOKKEEP,
+				     ctx->interruptible,
+				     MAX_SCHEDULE_TIMEOUT);
+	if (lret < 0) {
+		if (lret == -ERESTARTSYS)
+			return lret;
+		return 0;
+	}
+
+	if (bo->deleted)
+		lret = ttm_tt_backup(bo->bdev, tt, true, writeback);
+	else
+		lret = ttm_tt_backup(bo->bdev, tt, purge, writeback);
+	if (lret < 0 && lret != -EINTR)
+		return 0;
+
+	return lret;
+}
+EXPORT_SYMBOL(ttm_bo_try_shrink);
drivers/gpu/drm/xe/Makefile +1 -0
index b620389761d5..99daf95b2c27 100644
@@ -130,6 +130,7 @@ xe-y += xe_bb.o \
 	xe_ring_ops.o \
 	xe_sa.o \
 	xe_sched_job.o \
+	xe_shrinker.o \
 	xe_step.o \
 	xe_sync.o \
 	xe_tile.o \
drivers/gpu/drm/xe/tests/xe_bo.c +118 -0

127 lines not on this page · raw message

drivers/gpu/drm/xe/tests/xe_bo_test.c +1 -0
index a324cde77db8..317fa923e287 100644
@@ -10,6 +10,7 @@
 static struct kunit_case xe_bo_tests[] = {
 	KUNIT_CASE(xe_ccs_migrate_kunit),
 	KUNIT_CASE(xe_bo_evict_kunit),
+	KUNIT_CASE_SLOW(xe_bo_shrink_kunit),
 	{}
 };
 
drivers/gpu/drm/xe/tests/xe_bo_test.h +1 -0
index 0113ab45066a..7f44d14a45c5 100644
@@ -10,5 +10,6 @@ struct kunit;
 
 void xe_ccs_migrate_kunit(struct kunit *test);
 void xe_bo_evict_kunit(struct kunit *test);
+void xe_bo_shrink_kunit(struct kunit *test);
 
 #endif
drivers/gpu/drm/xe/xe_bo.c +112 -16

255 lines not on this page · raw message

drivers/gpu/drm/xe/xe_bo.h +4 -0
index 6de894c728f5..220e71086e65 100644
@@ -63,6 +63,7 @@
 #define XE_BO_PROPS_INVALID	(-1)
 
 struct sg_table;
+struct xe_ttm_lru_walk;
 
 struct xe_bo *xe_bo_alloc(void);
 void xe_bo_free(struct xe_bo *bo);
@@ -315,6 +316,9 @@ static inline unsigned int xe_sg_segment_size(struct device *dev)
 
 #define i915_gem_object_flush_if_display(obj)		((void)(obj))
 
+long xe_bo_shrink(struct ttm_lru_walk *walk, struct ttm_buffer_object *bo,
+		  bool purge, bool writeback);
+
 #if IS_ENABLED(CONFIG_DRM_XE_KUNIT_TEST)
 /**
  * xe_bo_is_mem_type - Whether the bo currently resides in the given
drivers/gpu/drm/xe/xe_device.c +8 -0
index 8da90934c900..7080558adb80 100644
@@ -42,6 +42,7 @@
 #include "xe_pcode.h"
 #include "xe_pm.h"
 #include "xe_query.h"
+#include "xe_shrinker.h"
 #include "xe_sriov.h"
 #include "xe_tile.h"
 #include "xe_ttm_stolen_mgr.h"
@@ -239,6 +240,9 @@ static void xe_device_destroy(struct drm_device *dev, void *dummy)
 	if (xe->unordered_wq)
 		destroy_workqueue(xe->unordered_wq);
 
+	if (!IS_ERR_OR_NULL(xe->mem.shrinker))
+		xe_shrinker_destroy(xe->mem.shrinker);
+
 	ttm_device_fini(&xe->ttm);
 }
 
@@ -268,6 +272,10 @@ struct xe_device *xe_device_create(struct pci_dev *pdev,
 	if (err)
 		goto err;
 
+	xe->mem.shrinker = xe_shrinker_create(xe);
+	if (IS_ERR(xe->mem.shrinker))
+		return ERR_CAST(xe->mem.shrinker);
+
 	xe->info.devid = pdev->device;
 	xe->info.revid = pdev->revision;
 	xe->info.force_execlist = xe_modparam.force_execlist;
drivers/gpu/drm/xe/xe_device_types.h +2 -0
index 5c5e36de452a..fc4f4d17a89f 100644
@@ -319,6 +319,8 @@ struct xe_device {
 		struct xe_mem_region vram;
 		/** @mem.sys_mgr: system TTM manager */
 		struct ttm_resource_manager sys_mgr;
+		/** @mem.sys_mgr: system memory shrinker. */
+		struct xe_shrinker *shrinker;
 	} mem;
 
 	/** @sriov: device level virtualization data */
drivers/gpu/drm/xe/xe_shrinker.c new file +224 -0

224 lines not on this page · raw message

drivers/gpu/drm/xe/xe_shrinker.h new file +18 -0
new file mode 100644
index 000000000000..28a038f4fcbf
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2024 Intel Corporation
+ */
+
+#ifndef _XE_SHRINKER_H_
+#define _XE_SHRINKER_H_
+
+struct xe_shrinker;
+struct xe_device;
+
+void xe_shrinker_mod_pages(struct xe_shrinker *shrinker, long shrinkable, long purgeable);
+
+struct xe_shrinker *xe_shrinker_create(struct xe_device *xe);
+
+void xe_shrinker_destroy(struct xe_shrinker *shrinker);
+
+#endif
include/drm/ttm/ttm_bo.h +3 -0
index 30c3a5fd9099..da2bf3ca3ee3 100644
@@ -222,6 +222,9 @@ struct ttm_lru_walk {
 long ttm_lru_walk_for_evict(struct ttm_lru_walk *walk, struct ttm_device *bdev,
 			    struct ttm_resource_manager *man, long target);
 
+long ttm_bo_try_shrink(struct ttm_lru_walk *walk, struct ttm_buffer_object *bo,
+		       bool purge, bool writeback);
+
 /**
  * ttm_bo_get - reference a struct ttm_buffer_object
  *
Signature · 1 line
2.44.0
author maintainer
#8 lore raw

PATCH 8/21 drm/ttm: sleeping evict lock.

In reply to Thomas Hellström
---
 drivers/gpu/drm/ttm/ttm_bo.c       | 344 +++++++++++------------------
 drivers/gpu/drm/ttm/ttm_device.c   |   1 -
 drivers/gpu/drm/ttm/ttm_resource.c |  22 +-
 include/drm/ttm/ttm_bo.h           |   8 +-
 4 files changed, 133 insertions(+), 242 deletions(-)
drivers/gpu/drm/ttm/ttm_bo.c +126 -218
index d1c219fd784b..e5a8eac9478a 100644
@@ -224,80 +224,6 @@ static void ttm_bo_flush_all_fences(struct ttm_buffer_object *bo)
 	dma_resv_iter_end(&cursor);
 }
 
-/**
- * ttm_bo_cleanup_refs
- * If bo idle, remove from lru lists, and unref.
- * If not idle, block if possible.
- *
- * Must be called with lru_lock and reservation held, this function
- * will drop the lru lock and optionally the reservation lock before returning.
- *
- * @bo:                    The buffer object to clean-up
- * @interruptible:         Any sleeps should occur interruptibly.
- * @no_wait_gpu:           Never wait for gpu. Return -EBUSY instead.
- * @unlock_resv:           Unlock the reservation lock as well.
- */
-
-static int ttm_bo_cleanup_refs(struct ttm_buffer_object *bo,
-			       bool interruptible, bool no_wait_gpu,
-			       bool unlock_resv)
-{
-	struct dma_resv *resv = &bo->base._resv;
-	int ret;
-
-	if (dma_resv_test_signaled(resv, DMA_RESV_USAGE_BOOKKEEP))
-		ret = 0;
-	else
-		ret = -EBUSY;
-
-	if (ret && !no_wait_gpu) {
-		long lret;
-
-		if (unlock_resv)
-			dma_resv_unlock(bo->base.resv);
-		spin_unlock(&bo->bdev->lru_lock);
-
-		lret = dma_resv_wait_timeout(resv, DMA_RESV_USAGE_BOOKKEEP,
-					     interruptible,
-					     30 * HZ);
-
-		if (lret < 0)
-			return lret;
-		else if (lret == 0)
-			return -EBUSY;
-
-		spin_lock(&bo->bdev->lru_lock);
-		if (unlock_resv && !dma_resv_trylock(bo->base.resv)) {
-			/*
-			 * We raced, and lost, someone else holds the reservation now,
-			 * and is probably busy in ttm_bo_cleanup_memtype_use.
-			 *
-			 * Even if it's not the case, because we finished waiting any
-			 * delayed destruction would succeed, so just return success
-			 * here.
-			 */
-			spin_unlock(&bo->bdev->lru_lock);
-			return 0;
-		}
-		ret = 0;
-	}
-
-	if (ret) {
-		if (unlock_resv)
-			dma_resv_unlock(bo->base.resv);
-		spin_unlock(&bo->bdev->lru_lock);
-		return ret;
-	}
-
-	spin_unlock(&bo->bdev->lru_lock);
-	ttm_bo_cleanup_memtype_use(bo);
-
-	if (unlock_resv)
-		dma_resv_unlock(bo->base.resv);
-
-	return 0;
-}
-
 /*
  * Block for the dma_resv object to become idle, lock the buffer and clean up
  * the resource and tt object.
@@ -505,151 +431,131 @@ bool ttm_bo_eviction_valuable(struct ttm_buffer_object *bo,
 }
 EXPORT_SYMBOL(ttm_bo_eviction_valuable);
 
-/*
- * Check the target bo is allowable to be evicted or swapout, including cases:
- *
- * a. if share same reservation object with ctx->resv, have assumption
- * reservation objects should already be locked, so not lock again and
- * return true directly when either the opreation allow_reserved_eviction
- * or the target bo already is in delayed free list;
- *
- * b. Otherwise, trylock it.
- */
-static bool ttm_bo_evict_swapout_allowable(struct ttm_buffer_object *bo,
-					   struct ttm_operation_ctx *ctx,
-					   const struct ttm_place *place,
-					   bool *locked, bool *busy)
+int ttm_bo_evict_first(struct ttm_device *bdev, struct ttm_resource_manager *man,
+		       struct ttm_operation_ctx *ctx)
 {
-	bool ret = false;
-
-	if (bo->pin_count) {
-		*locked = false;
-		if (busy)
-			*busy = false;
-		return false;
-	}
-
-	if (bo->base.resv == ctx->resv) {
-		dma_resv_assert_held(bo->base.resv);
-		if (ctx->allow_res_evict)
-			ret = true;
-		*locked = false;
-		if (busy)
-			*busy = false;
-	} else {
-		ret = dma_resv_trylock(bo->base.resv);
-		*locked = ret;
-		if (busy)
-			*busy = !ret;
+	struct ttm_resource_cursor cursor;
+	struct ttm_resource *res;
+	struct ttm_buffer_object *bo;
+	int ret = 0;
+	
+	spin_lock(&bdev->lru_lock);
+	res = ttm_resource_manager_first(man, &cursor);
+	if (!res) {
+		ret = -ENOENT;
+		goto out_no_ref;
 	}
+	bo = res->bo;
+	if (!ttm_bo_get_unless_zero(bo))
+		goto out_no_ref;
+	spin_unlock(&bdev->lru_lock);
+	dma_resv_lock(bo->base.resv, NULL);
+	if (bo->resource != res)
+		goto out_bad_res;
 
-	if (ret && place && (bo->resource->mem_type != place->mem_type ||
-		!bo->bdev->funcs->eviction_valuable(bo, place))) {
-		ret = false;
-		if (*locked) {
-			dma_resv_unlock(bo->base.resv);
-			*locked = false;
-		}
+	if (bo->deleted) {
+		ret = ttm_bo_wait_ctx(bo, ctx);
+		if (ret)
+			ttm_bo_cleanup_memtype_use(bo);
+	} else {	
+		ret = ttm_bo_evict(bo, ctx);
 	}
-
+out_bad_res:
+	dma_resv_unlock(bo->base.resv);
+	ttm_bo_put(bo);
+	ttm_resource_cursor_fini(&cursor);
 	return ret;
+	
+out_no_ref:
+	ttm_resource_cursor_fini_locked(&cursor);
+	spin_unlock(&bdev->lru_lock);
+	return -ENOENT;
 }
+		
+struct ttm_bo_evict_walk {
+	struct ttm_lru_walk walk;
+	const struct ttm_place *place;
+	struct ttm_buffer_object *evictor;
+	struct ttm_resource **res;
+	unsigned long evicted;
+};
 
-/**
- * ttm_mem_evict_wait_busy - wait for a busy BO to become available
- *
- * @busy_bo: BO which couldn't be locked with trylock
- * @ctx: operation context
- * @ticket: acquire ticket
- *
- * Try to lock a busy buffer object to avoid failing eviction.
- */
-static int ttm_mem_evict_wait_busy(struct ttm_buffer_object *busy_bo,
-				   struct ttm_operation_ctx *ctx,
-				   struct ww_acquire_ctx *ticket)
+static long ttm_bo_evict_cb(struct ttm_lru_walk *walk, struct ttm_buffer_object *bo)
 {
-	int r;
+	struct ttm_bo_evict_walk *evict_walk =
+		container_of(walk, typeof(*evict_walk), walk);
+	long lret;
 
-	if (!busy_bo || !ticket)
-		return -EBUSY;
+	if (!bo->bdev->funcs->eviction_valuable(bo, evict_walk->place))
+		return 0;
 
-	if (ctx->interruptible)
-		r = dma_resv_lock_interruptible(busy_bo->base.resv,
-							  ticket);
-	else
-		r = dma_resv_lock(busy_bo->base.resv, ticket);
+	if (bo->deleted) {
+		lret = ttm_bo_wait_ctx(bo, walk->ctx);
+		if (!lret)
+			ttm_bo_cleanup_memtype_use(bo);
+	} else {	
+		lret = ttm_bo_evict(bo, walk->ctx);
+	}
 
-	/*
-	 * TODO: It would be better to keep the BO locked until allocation is at
-	 * least tried one more time, but that would mean a much larger rework
-	 * of TTM.
-	 */
-	if (!r)
-		dma_resv_unlock(busy_bo->base.resv);
+	if (lret)
+		goto out;
 
-	return r == -EDEADLK ? -EBUSY : r;
+	evict_walk->evicted++;
+	if (evict_walk->res)
+		lret = ttm_resource_alloc(evict_walk->evictor, evict_walk->place,
+					  evict_walk->res);
+	if (lret == 0) 
+		return 1;
+out:
+	/* Errors that should terminate the walk. */
+	if (lret == -ENOMEM || lret == -EINTR || lret == -ERESTARTSYS ||
+	    lret == -EAGAIN)
+		return lret;
+	
+	return 0;
 }
 
-int ttm_mem_evict_first(struct ttm_device *bdev,
-			struct ttm_resource_manager *man,
-			const struct ttm_place *place,
-			struct ttm_operation_ctx *ctx,
-			struct ww_acquire_ctx *ticket)
-{
-	struct ttm_buffer_object *bo = NULL, *busy_bo = NULL;
-	struct ttm_resource_cursor cursor;
-	struct ttm_resource *res;
-	bool locked = false;
-	int ret;
-
-	spin_lock(&bdev->lru_lock);
-	ttm_resource_manager_for_each_res(man, &cursor, res) {
-		bool busy;
-
-		if (!ttm_bo_evict_swapout_allowable(res->bo, ctx, place,
-						    &locked, &busy)) {
-			if (busy && !busy_bo && ticket !=
-			    dma_resv_locking_ctx(res->bo->base.resv))
-				busy_bo = res->bo;
-			continue;
-		}
-
-		if (ttm_bo_get_unless_zero(res->bo)) {
-			bo = res->bo;
-			break;
-		}
-		if (locked)
-			dma_resv_unlock(res->bo->base.resv);
-	}
-	ttm_resource_cursor_fini_locked(&cursor);
-
-	if (!bo) {
-		if (busy_bo && !ttm_bo_get_unless_zero(busy_bo))
-			busy_bo = NULL;
-		spin_unlock(&bdev->lru_lock);
-		ret = ttm_mem_evict_wait_busy(busy_bo, ctx, ticket);
-		if (busy_bo)
-			ttm_bo_put(busy_bo);
-		return ret;
-	}
-
-	if (bo->deleted) {
-		ret = ttm_bo_cleanup_refs(bo, ctx->interruptible,
-					  ctx->no_wait_gpu, locked);
-		ttm_bo_put(bo);
-		return ret;
-	}
+static const struct ttm_lru_walk_ops ttm_evict_walk_ops = {
+	.process_bo = ttm_bo_evict_cb,
+};
 
-	spin_unlock(&bdev->lru_lock);
+static int ttm_bo_evict_alloc(struct ttm_device *bdev,
+			      struct ttm_resource_manager *man,
+			      const struct ttm_place *place,
+			      struct ttm_buffer_object *evictor,
+			      struct ttm_operation_ctx *ctx,
+			      struct ww_acquire_ctx *ticket,
+			      struct ttm_resource **res)
+{
+	struct ttm_bo_evict_walk evict_walk = {
+		.walk = {
+			.ops = &ttm_evict_walk_ops,
+			.ctx = ctx,
+			.ticket = ticket,
+		},
+		.place = place,
+		.evictor = evictor,
+		.res = res,
+	};
+	long lret;
 
-	ret = ttm_bo_evict(bo, ctx);
-	if (locked)
-		ttm_bo_unreserve(bo);
-	else
-		ttm_bo_move_to_lru_tail_unlocked(bo);
+	evict_walk.walk.trylock_only = true;
+	lret = ttm_lru_walk_for_evict(&evict_walk.walk, bdev, man, 1);
+	if (lret || !ticket)
+		goto out;
 
-	ttm_bo_put(bo);
-	return ret;
+	/* If ticket-locking, repeat while we make progress. */
+	evict_walk.walk.trylock_only = false;
+	do {
+		evict_walk.evicted = 0;
+		lret = ttm_lru_walk_for_evict(&evict_walk.walk, bdev, man, 1);
+	} while (!lret && evict_walk.evicted);
+out:
+	if (lret < 0)
+		return lret;
+	if (lret == 0)
+		return -EBUSY;
+	return 0;
 }
 
 /**
@@ -760,6 +666,7 @@ static int ttm_bo_alloc_resource(struct ttm_buffer_object *bo,
 	for (i = 0; i < placement->num_placement; ++i) {
 		const struct ttm_place *place = &placement->placement[i];
 		struct ttm_resource_manager *man;
+		bool may_evict;
 
 		man = ttm_manager_type(bdev, place->mem_type);
 		if (!man || !ttm_resource_manager_used(man))
@@ -769,22 +676,21 @@ static int ttm_bo_alloc_resource(struct ttm_buffer_object *bo,
 				    TTM_PL_FLAG_FALLBACK))
 			continue;
 
-		do {
-			ret = ttm_resource_alloc(bo, place, res);
-			if (unlikely(ret && ret != -ENOSPC))
-				return ret;
-			if (likely(!ret) || !force_space)
-				break;
-
-			ret = ttm_mem_evict_first(bdev, man, place, ctx,
-						  ticket);
-			if (unlikely(ret == -EBUSY))
-				break;
-			if (unlikely(ret))
+		may_evict = (force_space && place->mem_type != TTM_PL_SYSTEM);
+		ret = ttm_resource_alloc(bo, place, res);
+		if (ret) {
+			if (ret != -ENOSPC)
+				return ret;		
+			if (!may_evict)
+				continue;
+
+			ret = ttm_bo_evict_alloc(bdev, man, place, bo, ctx,
+						 ticket, res);
+			if (ret == -EBUSY)
+				continue;
+			if (ret)
 				return ret;
-		} while (1);
-		if (ret)
-			continue;
+		}
 
 		ret = ttm_bo_add_move_fence(bo, man, ctx->no_wait_gpu);
 		if (unlikely(ret)) {
@@ -796,7 +702,6 @@ static int ttm_bo_alloc_resource(struct ttm_buffer_object *bo,
 		}
 		return 0;
 	}
-
 	return -ENOSPC;
 }
 
@@ -822,6 +727,9 @@ int ttm_bo_mem_space(struct ttm_buffer_object *bo,
 	do {
 		ret = ttm_bo_alloc_resource(bo, placement, ctx,
 					    force_space, res);
+		if (ret)
+			pr_err("mem space failure %pe, force_space %d\n",
+			       ERR_PTR(ret), force_space);
 		force_space = !force_space;
 	} while (ret == -ENOSPC && force_space);
 
drivers/gpu/drm/ttm/ttm_device.c +0 -1
index c9d08ecc0f3b..ee575d8a54c0 100644
@@ -152,7 +152,6 @@ int ttm_device_swapout(struct ttm_device *bdev, struct ttm_operation_ctx *ctx,
 	unsigned i;
 	long lret;
 
-	spin_lock(&bdev->lru_lock);
 	for (i = TTM_PL_SYSTEM; i < TTM_NUM_MEM_TYPES; ++i) {
 		man = ttm_manager_type(bdev, i);
 		if (!man || !man->use_tt)
drivers/gpu/drm/ttm/ttm_resource.c +4 -18
index 9b80bdcf2216..2cea0ff7acb1 100644
@@ -509,25 +509,11 @@ int ttm_resource_manager_evict_all(struct ttm_device *bdev,
 	};
 	struct dma_fence *fence;
 	int ret;
-	unsigned i;
-
-	/*
-	 * Can't use standard list traversal since we're unlocking.
-	 */
-
-	spin_lock(&bdev->lru_lock);
-	for (i = 0; i < TTM_MAX_BO_PRIORITY; ++i) {
-		while (!list_empty(&man->lru[i])) {
-			spin_unlock(&bdev->lru_lock);
-			ret = ttm_mem_evict_first(bdev, man, NULL, &ctx,
-						  NULL);
-			if (ret)
-				return ret;
-			spin_lock(&bdev->lru_lock);
-		}
-	}
-	spin_unlock(&bdev->lru_lock);
 
+	do {
+		ret = ttm_bo_evict_first(bdev, man, &ctx);
+	} while (!ret);
+	
 	spin_lock(&man->move_lock);
 	fence = dma_fence_get(man->move);
 	spin_unlock(&man->move_lock);
include/drm/ttm/ttm_bo.h +3 -5
index 8c43939e95e9..30c3a5fd9099 100644
@@ -415,11 +415,9 @@ long ttm_bo_swapout(struct ttm_device *bdev, struct ttm_operation_ctx *ctx,
 		    pgoff_t target);
 void ttm_bo_pin(struct ttm_buffer_object *bo);
 void ttm_bo_unpin(struct ttm_buffer_object *bo);
-int ttm_mem_evict_first(struct ttm_device *bdev,
-			struct ttm_resource_manager *man,
-			const struct ttm_place *place,
-			struct ttm_operation_ctx *ctx,
-			struct ww_acquire_ctx *ticket);
+int ttm_bo_evict_first(struct ttm_device *bdev,
+		       struct ttm_resource_manager *man,
+		       struct ttm_operation_ctx *ctx);
 vm_fault_t ttm_bo_vm_reserve(struct ttm_buffer_object *bo,
 			     struct vm_fault *vmf);
 vm_fault_t ttm_bo_vm_fault_reserved(struct vm_fault *vmf,
Signature · 1 line
2.44.0
author maintainer
#11 lore raw

PATCH 11/21 drm/ttm: Use fault-injection to test error paths

In reply to Thomas Hellström

Use fault-injection to test partial TTM swapout and interrupted swapin. Return -EINTR for swapin to test the callers ability to handle and restart the swapin, and on swapout perform a partial swapout to test that the swapin and release_shrunken functionality.

Cc Christian König <[email protected]>
Cc Somalapuram Amaranath <[email protected]>
---
 drivers/gpu/drm/Kconfig        | 10 ++++++++++
 drivers/gpu/drm/ttm/ttm_pool.c | 17 ++++++++++++++++-
 2 files changed, 26 insertions(+), 1 deletion(-)
drivers/gpu/drm/Kconfig +10 -0
index 026444eeb5c6..f041ef44228d 100644
@@ -258,6 +258,16 @@ config DRM_GPUVM
 	  GPU-VM representation providing helpers to manage a GPUs virtual
 	  address space
 
+config DRM_TTM_BACKUP_FAULT_INJECT
+	bool "Enable fault injection during TTM backup"
+	depends on DRM_TTM
+	default n
+	help
+	  Inject recoverable failures during TTM backup and recovery of
+	  backed-up objects. For DRM driver developers only.
+
+	  If in doubt, choose N.
+
 config DRM_BUDDY
 	tristate
 	depends on DRM
drivers/gpu/drm/ttm/ttm_pool.c +16 -1
index 38e50cf81b0a..d32a1f2e5e50 100644
@@ -431,6 +431,7 @@ static int ttm_pool_restore_tt(struct ttm_pool_tt_restore *restore,
 			       struct ttm_backup *backup,
 			       struct ttm_operation_ctx *ctx)
 {
+	static unsigned long __maybe_unused swappedin;
 	unsigned int i, nr = 1 << restore->order;
 	int ret = 0;
 
@@ -446,6 +447,13 @@ static int ttm_pool_restore_tt(struct ttm_pool_tt_restore *restore,
 			if (handle == 0)
 				continue;
 
+			if (IS_ENABLED(CONFIG_DRM_TTM_BACKUP_FAULT_INJECT) &&
+			    ctx->interruptible &&
+			    ++swappedin % 100 == 0) {
+				ret = -EINTR;
+				break;
+			}
+
 			ret = backup->ops->copy_backed_up_page
 				(backup, restore->first_page[i],
 				 handle, ctx->interruptible);
@@ -892,7 +900,14 @@ long ttm_pool_backup_tt(struct ttm_pool *pool, struct ttm_tt *ttm, bool purge,
 
 	alloc_gfp = GFP_KERNEL | __GFP_HIGH | __GFP_NOWARN | __GFP_RETRY_MAYFAIL;
 
-	for (i = 0; i < ttm->num_pages; ++i) {
+	num_pages = ttm->num_pages;
+
+	/* Pretend doing fault injection by shrinking only half of the pages. */
+
+	if (IS_ENABLED(CONFIG_DRM_TTM_BACKUP_FAULT_INJECT))
+		num_pages = DIV_ROUND_UP(num_pages, 2);
+
+	for (i = 0; i < num_pages; ++i) {
 		page = ttm->pages[i];
 		if (unlikely(!page))
 			continue;
Signature · 1 line
2.44.0
author maintainer
#19 lore raw

PATCH 19/21 drm/xe: Use drm_exec for fault locking

In reply to Thomas Hellström
---
 drivers/gpu/drm/xe/xe_bo.c | 38 +++++++++++++++++++++++---------------
 1 file changed, 23 insertions(+), 15 deletions(-)
drivers/gpu/drm/xe/xe_bo.c +23 -15
index 3c56858e0751..27d7d36401b5 100644
@@ -1217,29 +1217,37 @@ static vm_fault_t xe_gem_fault(struct vm_fault *vmf)
 	struct xe_device *xe = to_xe_device(ddev);
 	struct xe_bo *bo = ttm_to_xe_bo(tbo);
 	bool needs_rpm = bo->flags & XE_BO_FLAG_VRAM_MASK;
+	struct drm_exec exec;
 	vm_fault_t ret;
-	int idx;
+	int idx, err;
 
 	if (needs_rpm)
 		xe_pm_runtime_get(xe);
 
-	ret = ttm_bo_vm_reserve(tbo, vmf, NULL);
-	if (ret)
-		goto out;
+	drm_exec_init(&exec, DRM_EXEC_INTERRUPTIBLE_WAIT, 16);
+	drm_exec_until_all_locked(&exec) {
+		ret = ttm_bo_vm_reserve(tbo, vmf, &exec);
+		err = drm_exec_retry_on_contention(&exec, 0);
+		if (err)
+			ret = VM_FAULT_NOPAGE;
+		if (ret)
+			goto out;
 
-	if (drm_dev_enter(ddev, &idx)) {
-		trace_xe_bo_cpu_fault(bo);
+		if (drm_dev_enter(ddev, &idx)) {
+			trace_xe_bo_cpu_fault(bo);
 
-		ret = ttm_bo_vm_fault_reserved(vmf, vmf->vma->vm_page_prot,
-					       TTM_BO_VM_NUM_PREFAULT,
-					       NULL);
-		drm_dev_exit(idx);
-	} else {
-		ret = ttm_bo_vm_dummy_page(vmf, vmf->vma->vm_page_prot);
+			ret = ttm_bo_vm_fault_reserved(vmf, vmf->vma->vm_page_prot,
+						       TTM_BO_VM_NUM_PREFAULT,
+						       &exec);
+			drm_dev_exit(idx);
+			err = drm_exec_retry_on_contention(&exec, 0);
+			if (err)
+				ret = VM_FAULT_NOPAGE;
+		} else {
+			ret = ttm_bo_vm_dummy_page(vmf, vmf->vma->vm_page_prot);
+		}
 	}
 
-	if (ret == VM_FAULT_RETRY && !(vmf->flags & FAULT_FLAG_RETRY_NOWAIT))
-		goto out;
 	/*
 	 * ttm_bo_vm_reserve() already has dma_resv_lock.
 	 */
@@ -1250,8 +1258,8 @@ static vm_fault_t xe_gem_fault(struct vm_fault *vmf)
 		mutex_unlock(&xe->mem_access.vram_userfault.lock);
 	}
 
-	dma_resv_unlock(tbo->base.resv);
 out:
+	drm_exec_fini(&exec);
 	if (needs_rpm)
 		xe_pm_runtime_put(xe);
 
Signature · 1 line
2.44.0
author maintainer
#16 lore raw

PATCH 16/21 drm/exec: Introduce an evict mode

In reply to Thomas Hellström

Locking for eviction is in some way different from locking for submission:

1) We can't lock objects that are already locked for submission, hence DRM_EXEC_IGNORE_DUPLICATES must be unset.
2) We must be able to re-lock objects locked for eviction, either for submission or for yet another eviction, in particular objects sharing a single resv must be considered.
3) There is no point to keep a contending object after the transaction restart. We don't know whether we actuall want to use it again.

So introduce a drm_exec evict mode, and for now instead of explicitly setting it using a function call or implement separate locking functions that use evict mode, assume evict mode if there is a snapshot registered. This can easily be changed later.

To keep track of resvs locked for eviction, use a pointer set implemented by an xarray. This is probably not the most efficient data structure but used as an easy-to-implement first approach. If the set is empty (evict mode never used), the performance- and memory usage impact will be very small.

---
 drivers/gpu/drm/drm_exec.c | 78 ++++++++++++++++++++++++++++++++++----
 include/drm/drm_exec.h     |  4 ++
 2 files changed, 75 insertions(+), 7 deletions(-)
drivers/gpu/drm/drm_exec.c +71 -7
index 934f60e75744..ceab7c810eda 100644
@@ -65,6 +65,10 @@ static void drm_exec_unlock_all(struct drm_exec *exec)
 
 	drm_gem_object_put(exec->prelocked);
 	exec->prelocked = NULL;
+
+	/* garbage collect */
+	xa_destroy(&exec->resv_set);
+	xa_init(&exec->resv_set);
 }
 
 /**
@@ -91,6 +95,8 @@ void drm_exec_init(struct drm_exec *exec, u32 flags, unsigned nr)
 	exec->num_objects = 0;
 	exec->contended = DRM_EXEC_DUMMY;
 	exec->prelocked = NULL;
+	exec->drop_contended = false;
+	xa_init(&exec->resv_set);
 }
 EXPORT_SYMBOL(drm_exec_init);
 
@@ -109,6 +115,7 @@ void drm_exec_fini(struct drm_exec *exec)
 		drm_gem_object_put(exec->contended);
 		ww_acquire_fini(&exec->ticket);
 	}
+	xa_destroy(&exec->resv_set);
 }
 EXPORT_SYMBOL(drm_exec_fini);
 
@@ -138,6 +145,30 @@ bool drm_exec_cleanup(struct drm_exec *exec)
 }
 EXPORT_SYMBOL(drm_exec_cleanup);
 
+static unsigned long drm_exec_resv_to_key(const struct dma_resv *resv)
+{
+	return (unsigned long) resv / __alignof__(typeof(*resv));
+}
+
+static void
+drm_exec_resv_set_erase(struct drm_exec *exec, unsigned long key)
+{
+	if (xa_load(&exec->resv_set, key))
+		xa_erase(&exec->resv_set, key);
+}
+
+static bool drm_exec_in_evict_mode(struct drm_exec *exec)
+{
+	return !!exec->snap;
+}
+
+static void drm_exec_set_evict_mode(struct drm_exec *exec,
+				    struct drm_exec_snapshot *snap)
+{
+	exec->snap = snap;
+	exec->flags &= ~DRM_EXEC_IGNORE_DUPLICATES;
+}
+
 /* Track the locked object in the array */
 static int drm_exec_obj_locked(struct drm_exec *exec,
 			       struct drm_gem_object *obj)
@@ -157,6 +188,15 @@ static int drm_exec_obj_locked(struct drm_exec *exec,
 	drm_gem_object_get(obj);
 	exec->objects[exec->num_objects++] = obj;
 
+	/*
+	 * Errors here are not fatal, It means the object we locked
+	 * for eviction can't be locked again. If that is problematic
+	 * we may need to reconsider this.
+	 */
+	if (drm_exec_in_evict_mode(exec))
+		(void) xa_store(&exec->resv_set, drm_exec_resv_to_key(obj->resv),
+				obj->resv, GFP_KERNEL | __GFP_RETRY_MAYFAIL |
+				__GFP_NOWARN);
 	return 0;
 }
 
@@ -180,6 +220,9 @@ static int drm_exec_lock_contended(struct drm_exec *exec)
 		dma_resv_lock_slow(obj->resv, &exec->ticket);
 	}
 
+	if (exec->drop_contended)
+		goto error_unlock;
+
 	ret = drm_exec_obj_locked(exec, obj);
 	if (unlikely(ret))
 		goto error_unlock;
@@ -232,10 +275,19 @@ int drm_exec_trylock_obj(struct drm_exec *exec, struct drm_gem_object *obj)
 	}
 
 	if (!dma_resv_trylock_ctx(obj->resv, &exec->ticket)) {
-		if (dma_resv_locking_ctx(obj->resv) == &exec->ticket)
-			return (exec->flags & DRM_EXEC_IGNORE_DUPLICATES) ? 0 : -EALREADY;
-		else
+		if (dma_resv_locking_ctx(obj->resv) == &exec->ticket) {
+			unsigned long key = drm_exec_resv_to_key(obj->resv);
+
+			if (exec->flags & DRM_EXEC_IGNORE_DUPLICATES ||
+			    xa_load(&exec->resv_set, key)) {
+				if (!drm_exec_in_evict_mode(exec))
+					drm_exec_resv_set_erase(exec, key);
+				return 0;
+			}
+			return -EALREADY;
+		} else {
 			return -EBUSY;
+		}
 	}
 
 	ret = drm_exec_obj_locked(exec, obj);
@@ -275,12 +327,20 @@ int drm_exec_lock_obj(struct drm_exec *exec, struct drm_gem_object *obj)
 	if (unlikely(ret == -EDEADLK)) {
 		drm_gem_object_get(obj);
 		exec->contended = obj;
+		exec->drop_contended = drm_exec_in_evict_mode(exec);
 		return -EDEADLK;
 	}
 
-	if (unlikely(ret == -EALREADY) &&
-	    exec->flags & DRM_EXEC_IGNORE_DUPLICATES)
-		return 0;
+	if (unlikely(ret == -EALREADY)) {
+		unsigned long key = drm_exec_resv_to_key(obj->resv);
+
+		if (exec->flags & DRM_EXEC_IGNORE_DUPLICATES ||
+		    xa_load(&exec->resv_set, key)) {
+			if (!drm_exec_in_evict_mode(exec))
+				drm_exec_resv_set_erase(exec, key);
+			return 0;
+		}
+	}
 
 	if (unlikely(ret))
 		return ret;
@@ -311,6 +371,7 @@ void drm_exec_unlock_obj(struct drm_exec *exec, struct drm_gem_object *obj)
 
 	for (i = exec->num_objects; i--;) {
 		if (exec->objects[i] == obj) {
+			drm_exec_resv_set_erase(exec, drm_exec_resv_to_key(obj->resv));
 			dma_resv_unlock(obj->resv);
 			for (++i; i < exec->num_objects; ++i)
 				exec->objects[i - 1] = exec->objects[i];
@@ -394,12 +455,14 @@ void drm_exec_restore(struct drm_exec *exec, struct drm_exec_snapshot *snap)
 		if (index + 1 == snap->num_locked)
 			break;
 
+		xa_erase(&exec->resv_set, drm_exec_resv_to_key(obj->resv));
 		dma_resv_unlock(obj->resv);
 		drm_gem_object_put(obj);
 		exec->objects[index] = NULL;
 	}
 
 	exec->num_objects = snap->num_locked;
+	exec->flags = snap->flags;
 	
 	if (!exec->prelocked)
 		exec->prelocked = snap->prelocked;
@@ -414,8 +477,9 @@ void drm_exec_snapshot(struct drm_exec *exec, struct drm_exec_snapshot *snap)
 	snap->prelocked = exec->prelocked;
 	if (snap->prelocked)
 		drm_gem_object_get(snap->prelocked);
+	snap->flags = exec->flags;
 	snap->saved_snap = exec->snap;
-	exec->snap = snap;	
+	drm_exec_set_evict_mode(exec, snap);
 }
 EXPORT_SYMBOL(drm_exec_snapshot);
 
include/drm/drm_exec.h +4 -0
index b82e4c8ead11..d615ce6b9f6d 100644
@@ -5,6 +5,7 @@
 
 #include <linux/compiler.h>
 #include <linux/ww_mutex.h>
+#include <linux/xarray.h>
 
 #define DRM_EXEC_INTERRUPTIBLE_WAIT	BIT(0)
 #define DRM_EXEC_IGNORE_DUPLICATES	BIT(1)
@@ -49,12 +50,15 @@ struct drm_exec {
 	 */
 	struct drm_gem_object *prelocked;
 	struct drm_exec_snapshot *snap;
+	struct xarray resv_set;
+	bool drop_contended;
 };
 
 struct drm_exec_snapshot {
 	struct drm_exec_snapshot *saved_snap;
 	struct drm_gem_object *prelocked;
 	unsigned long num_locked;
+	u32 flags;
 };
 
 int drm_exec_handle_contended(struct drm_exec *exec);
Signature · 1 line
2.44.0
author maintainer
#17 lore raw

PATCH 17/21 drm/ttm: Support drm_exec locking for eviction and swapping

In reply to Thomas Hellström
---
 drivers/gpu/drm/ttm/ttm_bo.c      | 40 +++++++++++++++++++-------
 drivers/gpu/drm/ttm/ttm_bo_util.c | 47 +++++++++++++++++++++++++------
 include/drm/ttm/ttm_bo.h          |  5 ++++
 3 files changed, 73 insertions(+), 19 deletions(-)
drivers/gpu/drm/ttm/ttm_bo.c +30 -10
index e5a8eac9478a..103a26e51792 100644
@@ -31,6 +31,8 @@
 
 #define pr_fmt(fmt) "[TTM] " fmt
 
+#include <drm/drm_exec.h>
+
 #include <drm/ttm/ttm_bo.h>
 #include <drm/ttm/ttm_placement.h>
 #include <drm/ttm/ttm_tt.h>
@@ -539,10 +541,12 @@ static int ttm_bo_evict_alloc(struct ttm_device *bdev,
 	};
 	long lret;
 
-	evict_walk.walk.trylock_only = true;
-	lret = ttm_lru_walk_for_evict(&evict_walk.walk, bdev, man, 1);
-	if (lret || !ticket)
-		goto out;
+	if (!ctx->exec || !IS_ENABLED(CONFIG_DEBUG_WW_MUTEX_SLOWPATH)) {
+		evict_walk.walk.trylock_only = true;
+		lret = ttm_lru_walk_for_evict(&evict_walk.walk, bdev, man, 1);
+		if (lret || !(ticket || ctx->exec))
+			goto out;
+	}
 
 	/* If ticket-locking, repeat while we make progress. */
 	evict_walk.walk.trylock_only = false;
@@ -756,6 +760,7 @@ int ttm_bo_validate(struct ttm_buffer_object *bo,
 		    struct ttm_placement *placement,
 		    struct ttm_operation_ctx *ctx)
 {
+	struct drm_exec_snapshot snap;
 	struct ttm_resource *res;
 	struct ttm_place hop;
 	bool force_space;
@@ -769,17 +774,24 @@ int ttm_bo_validate(struct ttm_buffer_object *bo,
 	if (!placement->num_placement)
 		return ttm_bo_pipeline_gutting(bo);
 
+	if (ctx->exec)
+		drm_exec_snapshot(ctx->exec, &snap);
+  
 	force_space = false;
 	do {
 		/* Check whether we need to move buffer. */
 		if (bo->resource &&
 		    ttm_resource_compatible(bo->resource, placement,
-					    force_space))
-			return 0;
+					    force_space)) {
+			ret = 0;
+			goto out;
+		}
 
 		/* Moving of pinned BOs is forbidden */
-		if (bo->pin_count)
-			return -EINVAL;
+		if (bo->pin_count) {
+			ret = -EINVAL;
+			goto out;
+		}
 
 		/*
 		 * Determine where to move the buffer.
@@ -796,7 +808,7 @@ int ttm_bo_validate(struct ttm_buffer_object *bo,
 		if (ret == -ENOSPC)
 			continue;
 		if (ret)
-			return ret;
+			goto out;
 
 bounce:
 		ret = ttm_bo_handle_move_mem(bo, res, false, ctx, &hop);
@@ -808,11 +820,14 @@ int ttm_bo_validate(struct ttm_buffer_object *bo,
 		}
 		if (ret) {
 			ttm_resource_free(bo, &res);
-			return ret;
+			goto out;
 		}
 
 	} while (ret && force_space);
 
+	if (ctx->exec)
+		drm_exec_restore(ctx->exec, &snap);
+
 	/* For backward compatibility with userspace */
 	if (ret == -ENOSPC)
 		return -ENOMEM;
@@ -826,6 +841,11 @@ int ttm_bo_validate(struct ttm_buffer_object *bo,
 			return ret;
 	}
 	return 0;
+out:
+	if (ctx->exec)
+		drm_exec_restore(ctx->exec, &snap);
+
+	return ret;
 }
 EXPORT_SYMBOL(ttm_bo_validate);
 
drivers/gpu/drm/ttm/ttm_bo_util.c +38 -9

86 lines not on this page · raw message

include/drm/ttm/ttm_bo.h +5 -0
index da2bf3ca3ee3..0839f870b818 100644
@@ -164,6 +164,8 @@ struct ttm_bo_kmap_obj {
 	struct ttm_buffer_object *bo;
 };
 
+struct drm_exec;
+
 /**
  * struct ttm_operation_ctx
  *
@@ -175,6 +177,8 @@ struct ttm_bo_kmap_obj {
  * @force_alloc: Don't check the memory account during suspend or CPU page
  * faults. Should only be used by TTM internally.
  * @resv: Reservation object to allow reserved evictions with.
+ * @exec: If part of a drm_exec transaction, pointer to the struct drm_exec.
+ * Null otherwise.
  * @bytes_moved: Statistics on how many bytes have been moved.
  *
  * Context for TTM operations like changing buffer placement or general memory
@@ -187,6 +191,7 @@ struct ttm_operation_ctx {
 	bool allow_res_evict;
 	bool force_alloc;
 	struct dma_resv *resv;
+	struct drm_exec *exec;
 	uint64_t bytes_moved;
 };
 
Signature · 1 line
2.44.0
author maintainer
#18 lore raw

PATCH 18/21 drm/ttm: Convert ttm vm to using drm_exec.

In reply to Thomas Hellström
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c    |   4 +-
 drivers/gpu/drm/i915/gem/i915_gem_ttm.c    |   4 +-
 drivers/gpu/drm/nouveau/nouveau_gem.c      |   4 +-
 drivers/gpu/drm/radeon/radeon_gem.c        |   4 +-
 drivers/gpu/drm/ttm/ttm_bo_vm.c            | 101 ++++++++++++++-------
 drivers/gpu/drm/vmwgfx/vmwgfx_page_dirty.c |   6 +-
 drivers/gpu/drm/xe/xe_bo.c                 |   5 +-
 include/drm/ttm/ttm_bo.h                   |   6 +-
 8 files changed, 85 insertions(+), 49 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +2 -2
index 17e16c971e21..22d61cdb0d88 100644
@@ -52,7 +52,7 @@ static vm_fault_t amdgpu_gem_fault(struct vm_fault *vmf)
 	vm_fault_t ret;
 	int idx;
 
-	ret = ttm_bo_vm_reserve(bo, vmf);
+	ret = ttm_bo_vm_reserve(bo, vmf, NULL);
 	if (ret)
 		return ret;
 
@@ -64,7 +64,7 @@ static vm_fault_t amdgpu_gem_fault(struct vm_fault *vmf)
 		}
 
 		ret = ttm_bo_vm_fault_reserved(vmf, vmf->vma->vm_page_prot,
-					       TTM_BO_VM_NUM_PREFAULT);
+					       TTM_BO_VM_NUM_PREFAULT, NULL);
 
 		drm_dev_exit(idx);
 	} else {
drivers/gpu/drm/i915/gem/i915_gem_ttm.c +2 -2
index e6f177183c0f..c66e2b54c9a2 100644
@@ -1046,7 +1046,7 @@ static vm_fault_t vm_fault_ttm(struct vm_fault *vmf)
 		     area->vm_flags & VM_WRITE))
 		return VM_FAULT_SIGBUS;
 
-	ret = ttm_bo_vm_reserve(bo, vmf);
+	ret = ttm_bo_vm_reserve(bo, vmf, NULL);
 	if (ret)
 		return ret;
 
@@ -1108,7 +1108,7 @@ static vm_fault_t vm_fault_ttm(struct vm_fault *vmf)
 
 	if (drm_dev_enter(dev, &idx)) {
 		ret = ttm_bo_vm_fault_reserved(vmf, vmf->vma->vm_page_prot,
-					       TTM_BO_VM_NUM_PREFAULT);
+					       TTM_BO_VM_NUM_PREFAULT, NULL);
 		drm_dev_exit(idx);
 	} else {
 		ret = ttm_bo_vm_dummy_page(vmf, vmf->vma->vm_page_prot);
drivers/gpu/drm/nouveau/nouveau_gem.c +2 -2
index 5a887d67dc0e..bc6901955508 100644
@@ -46,7 +46,7 @@ static vm_fault_t nouveau_ttm_fault(struct vm_fault *vmf)
 	pgprot_t prot;
 	vm_fault_t ret;
 
-	ret = ttm_bo_vm_reserve(bo, vmf);
+	ret = ttm_bo_vm_reserve(bo, vmf, NULL);
 	if (ret)
 		return ret;
 
@@ -56,7 +56,7 @@ static vm_fault_t nouveau_ttm_fault(struct vm_fault *vmf)
 
 	nouveau_bo_del_io_reserve_lru(bo);
 	prot = vm_get_page_prot(vma->vm_flags);
-	ret = ttm_bo_vm_fault_reserved(vmf, prot, TTM_BO_VM_NUM_PREFAULT);
+	ret = ttm_bo_vm_fault_reserved(vmf, prot, TTM_BO_VM_NUM_PREFAULT, NULL);
 	nouveau_bo_add_io_reserve_lru(bo);
 	if (ret == VM_FAULT_RETRY && !(vmf->flags & FAULT_FLAG_RETRY_NOWAIT))
 		return ret;
drivers/gpu/drm/radeon/radeon_gem.c +2 -2
index 2ef201a072f1..f29761b7ca97 100644
@@ -54,7 +54,7 @@ static vm_fault_t radeon_gem_fault(struct vm_fault *vmf)
 
 	down_read(&rdev->pm.mclk_lock);
 
-	ret = ttm_bo_vm_reserve(bo, vmf);
+	ret = ttm_bo_vm_reserve(bo, vmf, NULL);
 	if (ret)
 		goto unlock_mclk;
 
@@ -63,7 +63,7 @@ static vm_fault_t radeon_gem_fault(struct vm_fault *vmf)
 		goto unlock_resv;
 
 	ret = ttm_bo_vm_fault_reserved(vmf, vmf->vma->vm_page_prot,
-				       TTM_BO_VM_NUM_PREFAULT);
+				       TTM_BO_VM_NUM_PREFAULT, NULL);
 	if (ret == VM_FAULT_RETRY && !(vmf->flags & FAULT_FLAG_RETRY_NOWAIT))
 		goto unlock_mclk;
 
drivers/gpu/drm/ttm/ttm_bo_vm.c +67 -34

183 lines not on this page · raw message

drivers/gpu/drm/vmwgfx/vmwgfx_page_dirty.c +3 -3
index 74ff2812d66a..fc275afd000c 100644
@@ -388,7 +388,7 @@ vm_fault_t vmw_bo_vm_mkwrite(struct vm_fault *vmf)
 	 */
 	save_flags = vmf->flags;
 	vmf->flags &= ~FAULT_FLAG_ALLOW_RETRY;
-	ret = ttm_bo_vm_reserve(bo, vmf);
+	ret = ttm_bo_vm_reserve(bo, vmf, NULL);
 	vmf->flags = save_flags;
 	if (ret)
 		return ret;
@@ -423,7 +423,7 @@ vm_fault_t vmw_bo_vm_fault(struct vm_fault *vmf)
 	pgprot_t prot;
 	vm_fault_t ret;
 
-	ret = ttm_bo_vm_reserve(bo, vmf);
+	ret = ttm_bo_vm_reserve(bo, vmf, NULL);
 	if (ret)
 		return ret;
 
@@ -457,7 +457,7 @@ vm_fault_t vmw_bo_vm_fault(struct vm_fault *vmf)
 	else
 		prot = vm_get_page_prot(vma->vm_flags);
 
-	ret = ttm_bo_vm_fault_reserved(vmf, prot, num_prefault);
+	ret = ttm_bo_vm_fault_reserved(vmf, prot, num_prefault, NULL);
 	if (ret == VM_FAULT_RETRY && !(vmf->flags & FAULT_FLAG_RETRY_NOWAIT))
 		return ret;
 
drivers/gpu/drm/xe/xe_bo.c +3 -2
index 9a0ca2cab7b6..3c56858e0751 100644
@@ -1223,7 +1223,7 @@ static vm_fault_t xe_gem_fault(struct vm_fault *vmf)
 	if (needs_rpm)
 		xe_pm_runtime_get(xe);
 
-	ret = ttm_bo_vm_reserve(tbo, vmf);
+	ret = ttm_bo_vm_reserve(tbo, vmf, NULL);
 	if (ret)
 		goto out;
 
@@ -1231,7 +1231,8 @@ static vm_fault_t xe_gem_fault(struct vm_fault *vmf)
 		trace_xe_bo_cpu_fault(bo);
 
 		ret = ttm_bo_vm_fault_reserved(vmf, vmf->vma->vm_page_prot,
-					       TTM_BO_VM_NUM_PREFAULT);
+					       TTM_BO_VM_NUM_PREFAULT,
+					       NULL);
 		drm_dev_exit(idx);
 	} else {
 		ret = ttm_bo_vm_dummy_page(vmf, vmf->vma->vm_page_prot);
include/drm/ttm/ttm_bo.h +4 -2
index 0839f870b818..b10c1d2b5d4f 100644
@@ -427,10 +427,12 @@ int ttm_bo_evict_first(struct ttm_device *bdev,
 		       struct ttm_resource_manager *man,
 		       struct ttm_operation_ctx *ctx);
 vm_fault_t ttm_bo_vm_reserve(struct ttm_buffer_object *bo,
-			     struct vm_fault *vmf);
+			     struct vm_fault *vmf,
+			     struct drm_exec *exec);
 vm_fault_t ttm_bo_vm_fault_reserved(struct vm_fault *vmf,
 				    pgprot_t prot,
-				    pgoff_t num_prefault);
+				    pgoff_t num_prefault,
+				    struct drm_exec *exec);
 vm_fault_t ttm_bo_vm_fault(struct vm_fault *vmf);
 void ttm_bo_vm_open(struct vm_area_struct *vma);
 void ttm_bo_vm_close(struct vm_area_struct *vma);
Signature · 1 line
2.44.0
author maintainer
#3 lore raw

PATCH 3/21 drm/ttm: Use LRU hitches

In reply to Thomas Hellström

Have iterators insert themselves into the list they are iterating over using hitch list nodes. Since only the iterator owner can remove these list nodes from the list, it's safe to unlock the list and when continuing, use them as a starting point. Due to the way LRU bumping works in TTM, newly added items will not be missed, and bumped items will be iterated over a second time before reaching the end of the list.

The exception is list with bulk move sublists. When bumping a sublist, a hitch that is part of that sublist will also be moved and we might miss items if restarting from it. This will be addressed in a later patch.

Changes in previous series:
- Updated ttm_resource_cursor_fini() documentation. v2:
- Don't reorder ttm_resource_manager_first() and _next(). (Christian König).
- Use list_add instead of list_move
(Christian König)
v3:
- Split into two patches, one cleanup, one new functionality (Christian König)
- use ttm_resource_cursor_fini_locked() instead of open-coding (Matthew Brost)

Cc Christian König <[email protected]>
Cc Somalapuram Amaranath <[email protected]>
---
 drivers/gpu/drm/ttm/ttm_bo.c       |  1 +
 drivers/gpu/drm/ttm/ttm_device.c   |  9 +++--
 drivers/gpu/drm/ttm/ttm_resource.c | 56 +++++++++++++++++++++++++-----
 include/drm/ttm/ttm_resource.h     |  9 +++--
 4 files changed, 62 insertions(+), 13 deletions(-)
drivers/gpu/drm/ttm/ttm_bo.c +1 -0
index 6396dece0db1..43eda720657f 100644
@@ -621,6 +621,7 @@ int ttm_mem_evict_first(struct ttm_device *bdev,
 		if (locked)
 			dma_resv_unlock(res->bo->base.resv);
 	}
+	ttm_resource_cursor_fini_locked(&cursor);
 
 	if (!bo) {
 		if (busy_bo && !ttm_bo_get_unless_zero(busy_bo))
drivers/gpu/drm/ttm/ttm_device.c +7 -2
index 09411978a13a..f9e9b1ec8c8a 100644
@@ -170,12 +170,17 @@ int ttm_device_swapout(struct ttm_device *bdev, struct ttm_operation_ctx *ctx,
 			num_pages = PFN_UP(bo->base.size);
 			ret = ttm_bo_swapout(bo, ctx, gfp_flags);
 			/* ttm_bo_swapout has dropped the lru_lock */
-			if (!ret)
+			if (!ret) {
+				ttm_resource_cursor_fini(&cursor);
 				return num_pages;
-			if (ret != -EBUSY)
+			}
+			if (ret != -EBUSY) {
+				ttm_resource_cursor_fini(&cursor);
 				return ret;
+			}
 		}
 	}
+	ttm_resource_cursor_fini_locked(&cursor);
 	spin_unlock(&bdev->lru_lock);
 	return 0;
 }
drivers/gpu/drm/ttm/ttm_resource.c +47 -9

97 lines not on this page · raw message

include/drm/ttm/ttm_resource.h +7 -2
index 7d81fd5b5b83..8fac781f641e 100644
@@ -273,17 +273,22 @@ ttm_lru_item_to_res(struct ttm_lru_item *item)
  * struct ttm_resource_cursor
  *
  * @man: The resource manager currently being iterated over.
- * @cur: The list head the cursor currently points to.
+ * @hitch: A hitch list node inserted before the next resource
+ * to iterate over.
  * @priority: the current priority
  *
  * Cursor to iterate over the resources in a manager.
  */
 struct ttm_resource_cursor {
 	struct ttm_resource_manager *man;
-	struct list_head *cur;
+	struct ttm_lru_item hitch;
 	unsigned int priority;
 };
 
+void ttm_resource_cursor_fini_locked(struct ttm_resource_cursor *cursor);
+
+void ttm_resource_cursor_fini(struct ttm_resource_cursor *cursor);
+
 /**
  * struct ttm_lru_bulk_move_pos
  *
Signature · 1 line
2.44.0
author maintainer
#4 lore raw

PATCH 4/21 drm/ttm, drm/amdgpu, drm/xe: Consider hitch moves within bulk sublist moves

In reply to Thomas Hellström

To address the problem with hitches moving when bulk move sublists are lru-bumped, register the list cursors with the ttm_lru_bulk_move structure when traversing its list, and when lru-bumping the list, move the cursor hitch to the tail. This also means it's mandatory for drivers to call ttm_lru_bulk_move_init() and ttm_lru_bulk_move_fini() when initializing and finalizing the bulk move structure, so add those calls to the amdgpu- and xe driver.

Compared to v1 this is slightly more code but less fragile and hopefully easier to understand.

Changes in previous series:
- Completely rework the functionality
- Avoid a NULL pointer dereference assigning manager->mem_type
- Remove some leftover code causing build problems v2:
- For hitch bulk tail moves, store the mem_type in the cursor instead of with the manager.

Cc Christian König <[email protected]>
Cc Somalapuram Amaranath <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c |  4 ++
 drivers/gpu/drm/ttm/ttm_resource.c     | 90 ++++++++++++++++++++++++++
 drivers/gpu/drm/xe/xe_vm.c             |  4 ++
 include/drm/ttm/ttm_resource.h         | 59 +++++++++++------
 4 files changed, 136 insertions(+), 21 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +4 -0
index 4e2391c83d7c..6293f3b54b4a 100644
@@ -2422,6 +2422,8 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm,
 	if (r)
 		return r;
 
+	ttm_lru_bulk_move_init(&vm->lru_bulk_move);
+
 	vm->is_compute_context = false;
 
 	vm->use_cpu_for_update = !!(adev->vm_manager.vm_update_mode &
@@ -2486,6 +2488,7 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm,
 error_free_delayed:
 	dma_fence_put(vm->last_tlb_flush);
 	dma_fence_put(vm->last_unlocked);
+	ttm_lru_bulk_move_fini(&adev->mman.bdev, &vm->lru_bulk_move);
 	amdgpu_vm_fini_entities(vm);
 
 	return r;
@@ -2642,6 +2645,7 @@ void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm)
 		}
 	}
 
+	ttm_lru_bulk_move_fini(&adev->mman.bdev, &vm->lru_bulk_move);
 }
 
 /**
drivers/gpu/drm/ttm/ttm_resource.c +90 -0

147 lines not on this page · raw message

drivers/gpu/drm/xe/xe_vm.c +4 -0
index c5b1694b292f..e2ec148c9c33 100644
@@ -1339,6 +1339,8 @@ struct xe_vm *xe_vm_create(struct xe_device *xe, u32 flags)
 
 	INIT_WORK(&vm->destroy_work, vm_destroy_work_func);
 
+	ttm_lru_bulk_move_init(&vm->lru_bulk_move);
+
 	INIT_LIST_HEAD(&vm->preempt.exec_queues);
 	vm->preempt.min_run_period_ms = 10;	/* FIXME: Wire up to uAPI */
 
@@ -1456,6 +1458,7 @@ struct xe_vm *xe_vm_create(struct xe_device *xe, u32 flags)
 	mutex_destroy(&vm->snap_mutex);
 	for_each_tile(tile, xe, id)
 		xe_range_fence_tree_fini(&vm->rftree[id]);
+	ttm_lru_bulk_move_fini(&xe->ttm, &vm->lru_bulk_move);
 	kfree(vm);
 	if (!(flags & XE_VM_FLAG_MIGRATION))
 		xe_pm_runtime_put(xe);
@@ -1599,6 +1602,7 @@ static void vm_destroy_work_func(struct work_struct *w)
 		XE_WARN_ON(vm->pt_root[id]);
 
 	trace_xe_vm_free(vm);
+	ttm_lru_bulk_move_fini(&xe->ttm, &vm->lru_bulk_move);
 	kfree(vm);
 }
 
include/drm/ttm/ttm_resource.h +38 -21

92 lines not on this page · raw message

Signature · 1 line
2.44.0
author maintainer
#15 lore raw

PATCH 15/21 drm/exec: Add a snapshot capability.

In reply to Thomas Hellström
---
 drivers/gpu/drm/drm_exec.c | 38 +++++++++++++++++++++++++++++++++++++-
 include/drm/drm_exec.h     | 13 ++++++++++++-
 2 files changed, 49 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_exec.c +37 -1
index ec8c245e33d1..934f60e75744 100644
@@ -57,6 +57,7 @@ static void drm_exec_unlock_all(struct drm_exec *exec)
 	struct drm_gem_object *obj;
 	unsigned long index;
 
+	WARN_ON(exec->snap);
 	drm_exec_for_each_locked_object_reverse(exec, index, obj) {
 		dma_resv_unlock(obj->resv);
 		drm_gem_object_put(obj);
@@ -289,7 +290,6 @@ int drm_exec_lock_obj(struct drm_exec *exec, struct drm_gem_object *obj)
 		goto error_unlock;
 
 	return 0;
-
 error_unlock:
 	dma_resv_unlock(obj->resv);
 	return ret;
@@ -383,5 +383,41 @@ int drm_exec_prepare_array(struct drm_exec *exec,
 }
 EXPORT_SYMBOL(drm_exec_prepare_array);
 
+void drm_exec_restore(struct drm_exec *exec, struct drm_exec_snapshot *snap)
+{
+	struct drm_gem_object *obj;
+	unsigned int index;
+
+	exec->snap = snap->saved_snap;
+
+	drm_exec_for_each_locked_object_reverse(exec, index, obj) {
+		if (index + 1 == snap->num_locked)
+			break;
+
+		dma_resv_unlock(obj->resv);
+		drm_gem_object_put(obj);
+		exec->objects[index] = NULL;
+	}
+
+	exec->num_objects = snap->num_locked;
+	
+	if (!exec->prelocked)
+		exec->prelocked = snap->prelocked;
+	else
+		drm_gem_object_put(snap->prelocked);
+}
+EXPORT_SYMBOL(drm_exec_restore);
+
+void drm_exec_snapshot(struct drm_exec *exec, struct drm_exec_snapshot *snap)
+{
+	snap->num_locked = exec->num_objects;
+	snap->prelocked = exec->prelocked;
+	if (snap->prelocked)
+		drm_gem_object_get(snap->prelocked);
+	snap->saved_snap = exec->snap;
+	exec->snap = snap;	
+}
+EXPORT_SYMBOL(drm_exec_snapshot);
+
 MODULE_DESCRIPTION("DRM execution context");
 MODULE_LICENSE("Dual MIT/GPL");
include/drm/drm_exec.h +12 -1
index a37c851a178b..b82e4c8ead11 100644
@@ -19,7 +19,6 @@ struct drm_exec {
 	 * @flags: Flags to control locking behavior
 	 */
 	u32                     flags;
-
 	/**
 	 * @ticket: WW ticket used for acquiring locks
 	 */
@@ -49,6 +48,13 @@ struct drm_exec {
 	 * @prelocked: already locked GEM object due to contention
 	 */
 	struct drm_gem_object *prelocked;
+	struct drm_exec_snapshot *snap;
+};
+
+struct drm_exec_snapshot {
+	struct drm_exec_snapshot *saved_snap;
+	struct drm_gem_object *prelocked;
+	unsigned long num_locked;
 };
 
 int drm_exec_handle_contended(struct drm_exec *exec);
@@ -144,6 +150,8 @@ static inline bool drm_exec_is_contended(struct drm_exec *exec)
 	return !!exec->contended;
 }
 
+
+
 void drm_exec_init(struct drm_exec *exec, u32 flags, unsigned nr);
 void drm_exec_fini(struct drm_exec *exec);
 bool drm_exec_cleanup(struct drm_exec *exec);
@@ -156,5 +164,8 @@ int drm_exec_prepare_array(struct drm_exec *exec,
 			   struct drm_gem_object **objects,
 			   unsigned int num_objects,
 			   unsigned int num_fences);
+void drm_exec_snapshot(struct drm_exec *exec, struct drm_exec_snapshot *snap);
+void drm_exec_restore(struct drm_exec *exec, struct drm_exec_snapshot *snap);
+
 
 #endif
Signature · 1 line
2.44.0
author maintainer
#20 lore raw

PATCH 20/21 drm/ttm: Use drm_exec_trylock for bo initialization

In reply to Thomas Hellström

Buffer object initialization may be part of a drm_exec transaction. Rather than using dma_resv_trylock, use drm_exec_trylock_obj().

---
 drivers/gpu/drm/ttm/ttm_bo.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/gpu/drm/ttm/ttm_bo.c +10 -3
index 103a26e51792..44000c006126 100644
@@ -919,7 +919,10 @@ int ttm_bo_init_reserved(struct ttm_device *bdev, struct ttm_buffer_object *bo,
 	 * since otherwise lockdep will be angered in radeon.
 	 */
 	if (!resv)
-		WARN_ON(!dma_resv_trylock(bo->base.resv));
+		if (ctx->exec)
+			WARN_ON(drm_exec_trylock_obj(ctx->exec, &bo->base));
+		else
+			WARN_ON(!dma_resv_trylock(bo->base.resv));
 	else
 		dma_resv_assert_held(resv);
 
@@ -930,8 +933,12 @@ int ttm_bo_init_reserved(struct ttm_device *bdev, struct ttm_buffer_object *bo,
 	return 0;
 
 err_unlock:
-	if (!resv)
-		dma_resv_unlock(bo->base.resv);
+	if (!resv) {
+		if (ctx->exec)
+			drm_exec_unlock_obj(ctx->exec, &bo->base);
+		else
+			dma_resv_unlock(bo->base.resv);
+	}
 
 err_put:
 	ttm_bo_put(bo);
Signature · 1 line
2.44.0
author maintainer
#13 lore raw

PATCH 13/21 dma-buf/dma-resv: Introduce dma_resv_trylock_ctx()

In reply to Thomas Hellström

For the drm_exec_trylock() functionality, there is a need to be able to trylock a dma-resv object as part of a drm_exec transaction. Therefore expose a variant of dma_resv_trylock that also takes a struct ww_acquire_ctx parameter.

---
 include/linux/dma-resv.h | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)
include/linux/dma-resv.h +24 -1
index 8d0e34dad446..fceb31657379 100644
@@ -405,6 +405,29 @@ static inline int dma_resv_lock_slow_interruptible(struct dma_resv *obj,
 	return ww_mutex_lock_slow_interruptible(&obj->lock, ctx);
 }
 
+
+
+/**
+ * dma_resv_trylock_ctx - trylock the reservation object
+ * @obj: the reservation object
+ * @ctx: The ww acquire context or NULL.
+ *
+ * Tries to lock the reservation object for exclusive access and modification.
+ * Note, that the lock is only against other writers, readers will run
+ * concurrently with a writer under RCU. The seqlock is used to notify readers
+ * if they overlap with a writer. The context parameter ensures that other
+ * ww transactions can perform deadlock backoff if necessary, and that
+ * subsequent attempts to dma_resv_lock() @obj for @ctx will return
+ * -EALREADY.
+ *
+ * Returns true if the lock was acquired, false otherwise.
+ */
+static inline bool __must_check
+dma_resv_trylock_ctx(struct dma_resv *obj, struct ww_acquire_ctx *ctx)
+{
+	return ww_mutex_trylock(&obj->lock, ctx);
+}
+
 /**
  * dma_resv_trylock - trylock the reservation object
  * @obj: the reservation object
@@ -421,7 +444,7 @@ static inline int dma_resv_lock_slow_interruptible(struct dma_resv *obj,
  */
 static inline bool __must_check dma_resv_trylock(struct dma_resv *obj)
 {
-	return ww_mutex_trylock(&obj->lock, NULL);
+	return dma_resv_trylock_ctx(obj, NULL);
 }
 
 /**
Signature · 1 line
2.44.0
author maintainer
#14 lore raw

PATCH 14/21 drm/exec: drm_exec_trylock()

In reply to Thomas Hellström
---
 drivers/gpu/drm/drm_exec.c | 38 ++++++++++++++++++++++++++++++++++++++
 include/drm/drm_exec.h     |  1 +
 2 files changed, 39 insertions(+)
drivers/gpu/drm/drm_exec.c +38 -0
index 2a28cbccaec7..ec8c245e33d1 100644
@@ -207,6 +207,44 @@ int drm_exec_handle_contended(struct drm_exec *exec)
 }
 EXPORT_SYMBOL(drm_exec_handle_contended);
 
+/**
+ * drm_exec_lock_obj - lock a GEM object for use
+ * @exec: the drm_exec object with the state
+ * @obj: the GEM object to lock
+ *
+ * Lock a GEM object for use and grab a reference to it.
+ *
+ * Returns: -EDEADLK if a contention is detected, -EALREADY when object is
+ * already locked (can be suppressed by setting the DRM_EXEC_IGNORE_DUPLICATES
+ * flag), -ENOMEM when memory allocation failed and zero for success.
+ */
+int drm_exec_trylock_obj(struct drm_exec *exec, struct drm_gem_object *obj)
+{
+	int ret;
+
+	might_alloc(GFP_KERNEL);
+
+	if (exec->prelocked == obj) {
+		drm_gem_object_put(exec->prelocked);
+		exec->prelocked = NULL;
+		return 0;
+	}
+
+	if (!dma_resv_trylock_ctx(obj->resv, &exec->ticket)) {
+		if (dma_resv_locking_ctx(obj->resv) == &exec->ticket)
+			return (exec->flags & DRM_EXEC_IGNORE_DUPLICATES) ? 0 : -EALREADY;
+		else
+			return -EBUSY;
+	}
+
+	ret = drm_exec_obj_locked(exec, obj);
+	if (ret)
+		dma_resv_unlock(obj->resv);
+
+	return ret;
+}
+EXPORT_SYMBOL(drm_exec_trylock_obj);
+
 /**
  * drm_exec_lock_obj - lock a GEM object for use
  * @exec: the drm_exec object with the state
include/drm/drm_exec.h +1 -0
index a3490794ef35..a37c851a178b 100644
@@ -148,6 +148,7 @@ void drm_exec_init(struct drm_exec *exec, u32 flags, unsigned nr);
 void drm_exec_fini(struct drm_exec *exec);
 bool drm_exec_cleanup(struct drm_exec *exec);
 int drm_exec_lock_obj(struct drm_exec *exec, struct drm_gem_object *obj);
+int drm_exec_trylock_obj(struct drm_exec *exec, struct drm_gem_object *obj);
 void drm_exec_unlock_obj(struct drm_exec *exec, struct drm_gem_object *obj);
 int drm_exec_prepare_obj(struct drm_exec *exec, struct drm_gem_object *obj,
 			 unsigned int num_fences);
Signature · 1 line
2.44.0
author maintainer
#21 lore raw

PATCH 21/21 drm/xe: Initial support for drm exec locking during validate.

In reply to Thomas Hellström
---
 drivers/gpu/drm/xe/display/xe_fb_pin.c | 2 +-
 drivers/gpu/drm/xe/tests/xe_bo.c       | 6 +++---
 drivers/gpu/drm/xe/tests/xe_dma_buf.c  | 4 ++--
 drivers/gpu/drm/xe/tests/xe_migrate.c  | 2 +-
 drivers/gpu/drm/xe/xe_bo.c             | 8 +++++---
 drivers/gpu/drm/xe/xe_bo.h             | 4 +++-
 drivers/gpu/drm/xe/xe_dma_buf.c        | 2 +-
 drivers/gpu/drm/xe/xe_ggtt.c           | 2 +-
 drivers/gpu/drm/xe/xe_gt_pagefault.c   | 2 +-
 drivers/gpu/drm/xe/xe_vm.c             | 4 ++--
 10 files changed, 20 insertions(+), 16 deletions(-)
drivers/gpu/drm/xe/display/xe_fb_pin.c +1 -1
index 36e15c4961c1..85f37dd7ecb1 100644
@@ -289,7 +289,7 @@ static struct i915_vma *__xe_pin_fb_vma(const struct intel_framebuffer *fb,
 	if (IS_DGFX(xe))
 		ret = xe_bo_migrate(bo, XE_PL_VRAM0);
 	else
-		ret = xe_bo_validate(bo, NULL, true);
+		ret = xe_bo_validate(bo, NULL, true, NULL);
 	if (!ret)
 		ttm_bo_pin(&bo->ttm);
 	ttm_bo_unreserve(&bo->ttm);
drivers/gpu/drm/xe/tests/xe_bo.c +3 -3
index 7576d362020f..410579f75a39 100644
@@ -30,7 +30,7 @@ static int ccs_test_migrate(struct xe_tile *tile, struct xe_bo *bo,
 	u32 offset;
 
 	/* Move bo to VRAM if not already there. */
-	ret = xe_bo_validate(bo, NULL, false);
+	ret = xe_bo_validate(bo, NULL, false, NULL);
 	if (ret) {
 		KUNIT_FAIL(test, "Failed to validate bo.\n");
 		return ret;
@@ -276,7 +276,7 @@ static int evict_test_run_tile(struct xe_device *xe, struct xe_tile *tile, struc
 		if (i) {
 			down_read(&vm->lock);
 			xe_vm_lock(vm, false);
-			err = xe_bo_validate(bo, bo->vm, false);
+			err = xe_bo_validate(bo, bo->vm, false, NULL);
 			xe_vm_unlock(vm);
 			up_read(&vm->lock);
 			if (err) {
@@ -285,7 +285,7 @@ static int evict_test_run_tile(struct xe_device *xe, struct xe_tile *tile, struc
 				goto cleanup_all;
 			}
 			xe_bo_lock(external, false);
-			err = xe_bo_validate(external, NULL, false);
+			err = xe_bo_validate(external, NULL, false, NULL);
 			xe_bo_unlock(external);
 			if (err) {
 				KUNIT_FAIL(test, "external bo valid err=%pe\n",
drivers/gpu/drm/xe/tests/xe_dma_buf.c +2 -2
index e7f9b531c465..ef88b4dd184c 100644
@@ -81,7 +81,7 @@ static void check_residency(struct kunit *test, struct xe_bo *exported,
 	}
 
 	/* Re-validate the importer. This should move also exporter in. */
-	ret = xe_bo_validate(imported, NULL, false);
+	ret = xe_bo_validate(imported, NULL, false, NULL);
 	if (ret) {
 		if (ret != -EINTR && ret != -ERESTARTSYS)
 			KUNIT_FAIL(test, "Validating importer failed with err=%d.\n",
@@ -157,7 +157,7 @@ static void xe_test_dmabuf_import_same_driver(struct xe_device *xe)
 
 			/* Is everything where we expect it to be? */
 			xe_bo_lock(import_bo, false);
-			err = xe_bo_validate(import_bo, NULL, false);
+			err = xe_bo_validate(import_bo, NULL, false, NULL);
 
 			/* Pinning in VRAM is not allowed. */
 			if (!is_dynamic(params) &&
drivers/gpu/drm/xe/tests/xe_migrate.c +1 -1
index b6e7f80c3774..0feb99d3ef7d 100644
@@ -90,7 +90,7 @@ static void test_copy(struct xe_migrate *m, struct xe_bo *bo,
 		return;
 	}
 
-	err = xe_bo_validate(remote, NULL, false);
+	err = xe_bo_validate(remote, NULL, false, NULL);
 	if (err) {
 		KUNIT_FAIL(test, "Failed to validate system bo for %s: %i\n",
 			   str, err);
drivers/gpu/drm/xe/xe_bo.c +5 -3
index 27d7d36401b5..f33120f3a829 100644
@@ -1755,7 +1755,7 @@ int xe_bo_pin_external(struct xe_bo *bo)
 	xe_assert(xe, xe_bo_is_user(bo));
 
 	if (!xe_bo_is_pinned(bo)) {
-		err = xe_bo_validate(bo, NULL, false);
+		err = xe_bo_validate(bo, NULL, false, NULL);
 		if (err)
 			return err;
 
@@ -1801,7 +1801,7 @@ int xe_bo_pin(struct xe_bo *bo)
 	/* We only expect at most 1 pin */
 	xe_assert(xe, !xe_bo_is_pinned(bo));
 
-	err = xe_bo_validate(bo, NULL, false);
+	err = xe_bo_validate(bo, NULL, false, NULL);
 	if (err)
 		return err;
 
@@ -1917,11 +1917,13 @@ void xe_bo_unpin(struct xe_bo *bo)
  * Return: 0 on success, negative error code on failure. May return
  * -EINTR or -ERESTARTSYS if internal waits are interrupted by a signal.
  */
-int xe_bo_validate(struct xe_bo *bo, struct xe_vm *vm, bool allow_res_evict)
+int xe_bo_validate(struct xe_bo *bo, struct xe_vm *vm, bool allow_res_evict,
+		   struct drm_exec *exec)
 {
 	struct ttm_operation_ctx ctx = {
 		.interruptible = true,
 		.no_wait_gpu = false,
+		.exec = exec,
 	};
 
 	if (vm) {
drivers/gpu/drm/xe/xe_bo.h +3 -1
index 220e71086e65..a6ddaff8ce74 100644
@@ -62,6 +62,7 @@
 
 #define XE_BO_PROPS_INVALID	(-1)
 
+struct drm_exec;
 struct sg_table;
 struct xe_ttm_lru_walk;
 
@@ -164,7 +165,8 @@ int xe_bo_pin_external(struct xe_bo *bo);
 int xe_bo_pin(struct xe_bo *bo);
 void xe_bo_unpin_external(struct xe_bo *bo);
 void xe_bo_unpin(struct xe_bo *bo);
-int xe_bo_validate(struct xe_bo *bo, struct xe_vm *vm, bool allow_res_evict);
+int xe_bo_validate(struct xe_bo *bo, struct xe_vm *vm, bool allow_res_evict,
+		   struct drm_exec *exec);
 
 static inline bool xe_bo_is_pinned(struct xe_bo *bo)
 {
drivers/gpu/drm/xe/xe_dma_buf.c +1 -1
index 68f309f5e981..ce84aa70cca8 100644
@@ -102,7 +102,7 @@ static struct sg_table *xe_dma_buf_map(struct dma_buf_attachment *attach,
 		if (!attach->peer2peer)
 			r = xe_bo_migrate(bo, XE_PL_TT);
 		else
-			r = xe_bo_validate(bo, NULL, false);
+			r = xe_bo_validate(bo, NULL, false, NULL);
 		if (r)
 			return ERR_PTR(r);
 	}
drivers/gpu/drm/xe/xe_ggtt.c +1 -1
index 0d541f55b4fc..ba9b2c3236ab 100644
@@ -400,7 +400,7 @@ static int __xe_ggtt_insert_bo_at(struct xe_ggtt *ggtt, struct xe_bo *bo,
 		return 0;
 	}
 
-	err = xe_bo_validate(bo, NULL, false);
+	err = xe_bo_validate(bo, NULL, false, NULL);
 	if (err)
 		return err;
 
drivers/gpu/drm/xe/xe_gt_pagefault.c +1 -1
index 20ec1ab1b52d..3971bf567f78 100644
@@ -117,7 +117,7 @@ static int xe_pf_begin(struct drm_exec *exec, struct xe_vma *vma,
 			return err;
 	} else if (bo) {
 		/* Create backing store if needed */
-		err = xe_bo_validate(bo, vm, true);
+		err = xe_bo_validate(bo, vm, true, NULL);
 		if (err)
 			return err;
 	}
drivers/gpu/drm/xe/xe_vm.c +2 -2
index 335524e803e7..ea2308ff76c4 100644
@@ -380,7 +380,7 @@ static int xe_gpuvm_validate(struct drm_gpuvm_bo *vm_bo, struct drm_exec *exec)
 		list_move_tail(&gpuva_to_vma(gpuva)->combined_links.rebind,
 			       &vm->rebind_list);
 
-	ret = xe_bo_validate(gem_to_xe_bo(vm_bo->obj), vm, false);
+	ret = xe_bo_validate(gem_to_xe_bo(vm_bo->obj), vm, false, exec);
 	if (ret)
 		return ret;
 
@@ -2698,7 +2698,7 @@ static int vma_lock_and_validate(struct drm_exec *exec, struct xe_vma *vma,
 		if (!bo->vm)
 			err = drm_exec_lock_obj(exec, &bo->ttm.base);
 		if (!err && validate)
-			err = xe_bo_validate(bo, xe_vma_vm(vma), true);
+			err = xe_bo_validate(bo, xe_vma_vm(vma), true, exec);
 	}
 
 	return err;
Signature · 1 line
2.44.0
#22 lore raw

✓ CI.Patch_applied: success for xe bo shrinker and exhaustive eviction

In reply to Thomas Hellström
== Series Details ==

== Series Details ==

Series: xe bo shrinker and exhaustive eviction
URL : https://patchwork.freedesktop.org/series/133643/
State : success

== Summary ==

=== Applying kernel patches on branch 'drm-tip' with base: ===
Base commit: 081474425a80 drm-tip: 2024y-05m-15d-08h-11m-21s UTC integration manifest === git am output follows ===
.git/rebase-apply/patch:123: trailing whitespace.

warning: 1 line adds whitespace errors.
.git/rebase-apply/patch:144: trailing whitespace.

warning: 1 line adds whitespace errors.
.git/rebase-apply/patch:139: trailing whitespace.

.git/rebase-apply/patch:165: trailing whitespace.

	} else {	

.git/rebase-apply/patch:174: trailing whitespace.

.git/rebase-apply/patch:180: trailing whitespace.

.git/rebase-apply/patch:222: trailing whitespace.

	} else {	

warning: squelched 4 whitespace errors
warning: 9 lines add whitespace errors.
.git/rebase-apply/patch:47: trailing whitespace.

.git/rebase-apply/patch:62: trailing whitespace.

	exec->snap = snap;	

warning: 2 lines add whitespace errors.
.git/rebase-apply/patch:51: trailing whitespace.

warning: 1 line adds whitespace errors.
.git/rebase-apply/patch:267: trailing whitespace.

warning: 1 line adds whitespace errors.
Applying: drm/ttm: Allow TTM LRU list nodes of different types
Applying: drm/ttm: Slightly clean up LRU list iteration
Applying: drm/ttm: Use LRU hitches
Applying: drm/ttm, drm/amdgpu, drm/xe: Consider hitch moves within bulk sublist moves
Applying: drm/exec: Rework contended locking
Applying: drm/ttm: Provide a generic LRU walker helper
Applying: drm/ttm: Use restartable LRU and sleeping locks for swapping.
Applying: drm/ttm: sleeping evict lock.
Applying: drm/ttm: Add a virtual base class for graphics memory backup
Applying: drm/ttm/pool: Provide a helper to shrink pages.
Applying: drm/ttm: Use fault-injection to test error paths
Applying: drm/ttm, drm/xe: Add a shrinker for xe bos
Applying: dma-buf/dma-resv: Introduce dma_resv_trylock_ctx()
Applying: drm/exec: drm_exec_trylock()
Applying: drm/exec: Add a snapshot capability.
Applying: drm/exec: Introduce an evict mode
Applying: drm/ttm: Support drm_exec locking for eviction and swapping
Applying: drm/ttm: Convert ttm vm to using drm_exec.
Applying: drm/xe: Use drm_exec for fault locking
Applying: drm/ttm: Use drm_exec_trylock for bo initialization
Applying: drm/xe: Initial support for drm exec locking during validate.

#23 lore raw

✗ CI.checkpatch: warning for xe bo shrinker and exhaustive eviction

In reply to Thomas Hellström
== Series Details ==

== Series Details ==

Series: xe bo shrinker and exhaustive eviction
URL : https://patchwork.freedesktop.org/series/133643/
State : warning

== Summary ==

+ KERNEL=/kernel
+ git clone https://gitlab.freedesktop.org/drm/maintainer-tools mt Cloning into 'mt'...
warning: redirecting to https://gitlab.freedesktop.org/drm/maintainer-tools.git/
+ git -C mt rev-list -n1 origin/master 57b97a66dd129aea93991dc66cd10477f7a05cf8
+ cd /kernel
+ git config --global --add safe.directory /kernel
+ git log -n1
commit 68e09f69bcf4a607a7d92b0d28582e443c164b0a

Author: Thomas Hellström <[email protected]>
Date:   Wed May 15 10:14:49 2024 +0200

drm/xe: Initial support for drm exec locking during validate.

+ /mt/dim checkpatch 081474425a80ae4c77e1bd839f69d349624acfcb drm-intel 1949070804d4 drm/ttm: Allow TTM LRU list nodes of different types ec3db6fb6649 drm/ttm: Slightly clean up LRU list iteration
226ddbff0f9f drm/ttm: Use LRU hitches
0751b3d9408e drm/ttm, drm/amdgpu, drm/xe: Consider hitch moves within bulk sublist moves 76ec0bdf6db4 drm/exec: Rework contended locking
-:10: WARNING:COMMIT_MESSAGE: Missing commit description - Add an appropriate one

-:436: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'exec' - possible side-effects? #436: FILE: include/drm/drm_exec.h:122:
+#define drm_exec_retry_on_contention(exec, _ret) \
+ ({ \
+ int __ret = (_ret); \
+ \
+ if (unlikely(drm_exec_is_contended(exec))) { \
+ WARN_ON(__ret != -EDEADLK); \
+ __ret = drm_exec_handle_contended(exec); \
+ if (!__ret) \
+ goto *__drm_exec_retry_ptr; \
+ } \
+ __ret; \
+ })

-:436: WARNING:MACRO_WITH_FLOW_CONTROL: Macros with flow control statements should be avoided #436: FILE: include/drm/drm_exec.h:122:
+#define drm_exec_retry_on_contention(exec, _ret) \
+ ({ \
+ int __ret = (_ret); \
+ \
+ if (unlikely(drm_exec_is_contended(exec))) { \
+ WARN_ON(__ret != -EDEADLK); \
+ __ret = drm_exec_handle_contended(exec); \
+ if (!__ret) \
+ goto *__drm_exec_retry_ptr; \
+ } \
+ __ret; \
+ })

total: 0 errors, 2 warnings, 1 checks, 356 lines checked 250a5913b056 drm/ttm: Provide a generic LRU walker helper
-:128: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #128: FILE: drivers/gpu/drm/ttm/ttm_bo_util.c:867:
+long ttm_lru_walk_for_evict(struct ttm_lru_walk *walk, struct ttm_device *bdev,
+ struct ttm_resource_manager *man, long target)

-:141: ERROR:TRAILING_WHITESPACE: trailing whitespace #141: FILE: drivers/gpu/drm/ttm/ttm_bo_util.c:880:
+^I^I$

total: 1 errors, 0 warnings, 1 checks, 203 lines checked fcb474397125 drm/ttm: Use restartable LRU and sleeping locks for swapping. -:10: WARNING:COMMIT_MESSAGE: Missing commit description - Add an appropriate one

-:21: CHECK:LINE_SPACING: Please don't use multiple blank lines #21: FILE: drivers/gpu/drm/ttm/ttm_bo.c:1121:

+

-:148: ERROR:TRAILING_WHITESPACE: trailing whitespace #148: FILE: drivers/gpu/drm/ttm/ttm_bo.c:1232:
+^I$

total: 1 errors, 1 warnings, 1 checks, 187 lines checked 8585d9d5d568 drm/ttm: sleeping evict lock.
-:10: WARNING:COMMIT_MESSAGE: Missing commit description - Add an appropriate one

-:142: ERROR:TRAILING_WHITESPACE: trailing whitespace #142: FILE: drivers/gpu/drm/ttm/ttm_bo.c:441:
+^I$

-:168: ERROR:TRAILING_WHITESPACE: trailing whitespace #168: FILE: drivers/gpu/drm/ttm/ttm_bo.c:460:
+^I} else {^I$

-:177: ERROR:TRAILING_WHITESPACE: trailing whitespace #177: FILE: drivers/gpu/drm/ttm/ttm_bo.c:468:
+^I$

-:183: ERROR:TRAILING_WHITESPACE: trailing whitespace #183: FILE: drivers/gpu/drm/ttm/ttm_bo.c:474:
+^I^I$

-:225: ERROR:TRAILING_WHITESPACE: trailing whitespace #225: FILE: drivers/gpu/drm/ttm/ttm_bo.c:496:
+^I} else {^I$

-:244: ERROR:TRAILING_WHITESPACE: trailing whitespace #244: FILE: drivers/gpu/drm/ttm/ttm_bo.c:507:
+^Iif (lret == 0) $

-:251: ERROR:TRAILING_WHITESPACE: trailing whitespace #251: FILE: drivers/gpu/drm/ttm/ttm_bo.c:514:
+^I$

-:384: ERROR:TRAILING_WHITESPACE: trailing whitespace #384: FILE: drivers/gpu/drm/ttm/ttm_bo.c:683:
+^I^I^I^Ireturn ret;^I^I$

-:461: ERROR:TRAILING_WHITESPACE: trailing whitespace #461: FILE: drivers/gpu/drm/ttm/ttm_resource.c:516:
+^I$

total: 9 errors, 1 warnings, 0 checks, 448 lines checked
e67a160714e8 drm/ttm: Add a virtual base class for graphics memory backup Traceback (most recent call last):
File "scripts/spdxcheck.py", line 6, in <module>
from ply import lex, yacc
ModuleNotFoundError: No module named 'ply'
Traceback (most recent call last):
File "scripts/spdxcheck.py", line 6, in <module>
from ply import lex, yacc
ModuleNotFoundError: No module named 'ply'
-:41: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #41:
new file mode 100644

total: 0 errors, 1 warnings, 0 checks, 281 lines checked
1e5a33ca03e1 drm/ttm/pool: Provide a helper to shrink pages.
148e233cd195 drm/ttm: Use fault-injection to test error paths
-:27: WARNING:CONFIG_DESCRIPTION: please write a help paragraph that fully describes the config symbol #27: FILE: drivers/gpu/drm/Kconfig:261:
+config DRM_TTM_BACKUP_FAULT_INJECT
+ bool "Enable fault injection during TTM backup"
+ depends on DRM_TTM
+ default n
+ help
+ Inject recoverable failures during TTM backup and recovery of
+ backed-up objects. For DRM driver developers only.
+
+ If in doubt, choose N.
+

total: 0 errors, 1 warnings, 0 checks, 51 lines checked
f8a7b96a43cf drm/ttm, drm/xe: Add a shrinker for xe bos
Traceback (most recent call last):
File "scripts/spdxcheck.py", line 6, in <module>
from ply import lex, yacc
ModuleNotFoundError: No module named 'ply'
Traceback (most recent call last):
File "scripts/spdxcheck.py", line 6, in <module>
from ply import lex, yacc
ModuleNotFoundError: No module named 'ply'
-:616: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #616:
new file mode 100644

total: 0 errors, 1 warnings, 0 checks, 781 lines checked a4c0e1140cf1 dma-buf/dma-resv: Introduce dma_resv_trylock_ctx() -:24: CHECK:LINE_SPACING: Please don't use multiple blank lines #24: FILE: include/linux/dma-resv.h:408:

+

total: 0 errors, 0 warnings, 1 checks, 37 lines checked
3bc22a0e858d drm/exec: drm_exec_trylock()
-:10: WARNING:COMMIT_MESSAGE: Missing commit description - Add an appropriate one

total: 0 errors, 1 warnings, 0 checks, 51 lines checked
0ae484121d18 drm/exec: Add a snapshot capability.
-:10: WARNING:COMMIT_MESSAGE: Missing commit description - Add an appropriate one

-:52: ERROR:TRAILING_WHITESPACE: trailing whitespace #52: FILE: drivers/gpu/drm/drm_exec.c:403:
+^I$

-:67: ERROR:TRAILING_WHITESPACE: trailing whitespace #67: FILE: drivers/gpu/drm/drm_exec.c:418:
+^Iexec->snap = snap;^I$

-:103: CHECK:LINE_SPACING: Please don't use multiple blank lines #103: FILE: include/drm/drm_exec.h:153:

+

total: 2 errors, 1 warnings, 1 checks, 91 lines checked 5b809fce6c70 drm/exec: Introduce an evict mode -:72: CHECK:SPACING: No space is necessary after a cast #72: FILE: drivers/gpu/drm/drm_exec.c:150:
+ return (unsigned long) resv / __alignof__(typeof(*resv));

-:107: CHECK:SPACING: No space is necessary after a cast #107: FILE: drivers/gpu/drm/drm_exec.c:197:
+ (void) xa_store(&exec->resv_set, drm_exec_resv_to_key(obj->resv),

total: 0 errors, 0 warnings, 2 checks, 177 lines checked 9149eb40e039 drm/ttm: Support drm_exec locking for eviction and swapping -:8: WARNING:COMMIT_MESSAGE: Missing commit description - Add an appropriate one

-:51: ERROR:TRAILING_WHITESPACE: trailing whitespace #51: FILE: drivers/gpu/drm/ttm/ttm_bo.c:779:
+ $

-:51: WARNING:LEADING_SPACE: please, no spaces at the start of a line #51: FILE: drivers/gpu/drm/ttm/ttm_bo.c:779:
+ $

-:186: ERROR:CODE_INDENT: code indent should use tabs where possible #186: FILE: drivers/gpu/drm/ttm/ttm_bo_util.c:926:
+^I^I^I lret = ttm_lru_walk_execlock(walk, bo);$

-:236: ERROR:MISSING_SIGN_OFF: Missing Signed-off-by: line(s)

total: 3 errors, 2 warnings, 0 checks, 202 lines checked d0efc8ac555a drm/ttm: Convert ttm vm to using drm_exec.
-:10: WARNING:COMMIT_MESSAGE: Missing commit description - Add an appropriate one

-:266: ERROR:TRAILING_WHITESPACE: trailing whitespace #266: FILE: drivers/gpu/drm/ttm/ttm_bo_vm.c:354:
+^I$

total: 1 errors, 1 warnings, 0 checks, 302 lines checked 8358cfdb1fc6 drm/xe: Use drm_exec for fault locking
-:10: WARNING:COMMIT_MESSAGE: Missing commit description - Add an appropriate one

total: 0 errors, 1 warnings, 0 checks, 60 lines checked
a2761e1cb02c drm/ttm: Use drm_exec_trylock for bo initialization 68e09f69bcf4 drm/xe: Initial support for drm exec locking during validate. -:10: WARNING:COMMIT_MESSAGE: Missing commit description - Add an appropriate one

total: 0 errors, 1 warnings, 0 checks, 142 lines checked

#24 lore raw

✓ CI.KUnit: success for xe bo shrinker and exhaustive eviction

In reply to Thomas Hellström
== Series Details ==

== Series Details ==

Series: xe bo shrinker and exhaustive eviction
URL : https://patchwork.freedesktop.org/series/133643/
State : success

== Summary ==

+ trap cleanup EXIT
+ /kernel/tools/testing/kunit/kunit.py run --kunitconfig /kernel/drivers/gpu/drm/xe/.kunitconfig [08:21:19] Configuring KUnit Kernel ...
Generating .config ...
Populating config with:

$ make ARCH=um O=.kunit olddefconfig
[08:21:23] Building KUnit Kernel ...
Populating config with:
$ make ARCH=um O=.kunit olddefconfig
Building with:
$ make ARCH=um O=.kunit --jobs=48
../arch/x86/um/user-offsets.c:17:6: warning: no previous prototype for ‘foo’ [-Wmissing-prototypes]
   17 | void foo(void)
      |      ^~~
In file included from ../arch/um/kernel/asm-offsets.c:1:
../arch/x86/um/shared/sysdep/kernel-offsets.h:9:6: warning: no previous prototype for ‘foo’ [-Wmissing-prototypes]
    9 | void foo(void)
      |      ^~~
../arch/x86/um/bugs_64.c:9:6: warning: no previous prototype for ‘arch_check_bugs’ [-Wmissing-prototypes]
    9 | void arch_check_bugs(void)
      |      ^~~~~~~~~~~~~~~
../arch/x86/um/bugs_64.c:13:6: warning: no previous prototype for ‘arch_examine_signal’ [-Wmissing-prototypes]
   13 | void arch_examine_signal(int sig, struct uml_pt_regs *regs)
      |      ^~~~~~~~~~~~~~~~~~~
../arch/x86/um/fault.c:18:5: warning: no previous prototype for ‘arch_fixup’ [-Wmissing-prototypes]
   18 | int arch_fixup(unsigned long address, struct uml_pt_regs *regs)
      |     ^~~~~~~~~~
../arch/x86/um/os-Linux/mcontext.c:7:6: warning: no previous prototype for ‘get_regs_from_mc’ [-Wmissing-prototypes]
    7 | void get_regs_from_mc(struct uml_pt_regs *regs, mcontext_t *mc)
      |      ^~~~~~~~~~~~~~~~
../arch/x86/um/vdso/um_vdso.c:16:5: warning: no previous prototype for ‘__vdso_clock_gettime’ [-Wmissing-prototypes]
   16 | int __vdso_clock_gettime(clockid_t clock, struct __kernel_old_timespec *ts)
      |     ^~~~~~~~~~~~~~~~~~~~
../arch/x86/um/vdso/um_vdso.c:30:5: warning: no previous prototype for ‘__vdso_gettimeofday’ [-Wmissing-prototypes]
   30 | int __vdso_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz)
      |     ^~~~~~~~~~~~~~~~~~~
../arch/x86/um/vdso/um_vdso.c:44:21: warning: no previous prototype for ‘__vdso_time’ [-Wmissing-prototypes]
   44 | __kernel_old_time_t __vdso_time(__kernel_old_time_t *t)
      |                     ^~~~~~~~~~~
../arch/x86/um/vdso/um_vdso.c:57:1: warning: no previous prototype for ‘__vdso_getcpu’ [-Wmissing-prototypes]
   57 | __vdso_getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *unused)
      | ^~~~~~~~~~~~~
../arch/x86/um/os-Linux/registers.c:146:15: warning: no previous prototype for ‘get_thread_reg’ [-Wmissing-prototypes]
  146 | unsigned long get_thread_reg(int reg, jmp_buf *buf)
      |               ^~~~~~~~~~~~~~
../arch/um/os-Linux/skas/process.c:107:6: warning: no previous prototype for ‘wait_stub_done’ [-Wmissing-prototypes]
  107 | void wait_stub_done(int pid)
      |      ^~~~~~~~~~~~~~
../arch/um/os-Linux/skas/process.c:683:6: warning: no previous prototype for ‘__switch_mm’ [-Wmissing-prototypes]
  683 | void __switch_mm(struct mm_id *mm_idp)
      |      ^~~~~~~~~~~
../arch/um/kernel/skas/mmu.c:17:5: warning: no previous prototype for ‘init_new_context’ [-Wmissing-prototypes]
   17 | int init_new_context(struct task_struct *task, struct mm_struct *mm)
      |     ^~~~~~~~~~~~~~~~
../arch/um/kernel/skas/mmu.c:60:6: warning: no previous prototype for ‘destroy_context’ [-Wmissing-prototypes]
   60 | void destroy_context(struct mm_struct *mm)
      |      ^~~~~~~~~~~~~~~
../arch/um/kernel/skas/process.c:36:12: warning: no previous prototype for ‘start_uml’ [-Wmissing-prototypes]
   36 | int __init start_uml(void)
      |            ^~~~~~~~~
../arch/um/os-Linux/main.c:187:7: warning: no previous prototype for ‘__wrap_malloc’ [-Wmissing-prototypes]
  187 | void *__wrap_malloc(int size)
      |       ^~~~~~~~~~~~~
../arch/um/os-Linux/main.c:208:7: warning: no previous prototype for ‘__wrap_calloc’ [-Wmissing-prototypes]
  208 | void *__wrap_calloc(int n, int size)
      |       ^~~~~~~~~~~~~
../arch/um/os-Linux/main.c:222:6: warning: no previous prototype for ‘__wrap_free’ [-Wmissing-prototypes]
  222 | void __wrap_free(void *ptr)
      |      ^~~~~~~~~~~
../arch/um/os-Linux/mem.c:28:6: warning: no previous prototype for ‘kasan_map_memory’ [-Wmissing-prototypes]
   28 | void kasan_map_memory(void *start, size_t len)
      |      ^~~~~~~~~~~~~~~~
../arch/um/os-Linux/mem.c:212:13: warning: no previous prototype for ‘check_tmpexec’ [-Wmissing-prototypes]
  212 | void __init check_tmpexec(void)
      |             ^~~~~~~~~~~~~
../arch/x86/um/ptrace_64.c:111:5: warning: no previous prototype for ‘poke_user’ [-Wmissing-prototypes]
  111 | int poke_user(struct task_struct *child, long addr, long data)
      |     ^~~~~~~~~
../arch/x86/um/ptrace_64.c:171:5: warning: no previous prototype for ‘peek_user’ [-Wmissing-prototypes]
  171 | int peek_user(struct task_struct *child, long addr, long data)
      |     ^~~~~~~~~
../arch/um/os-Linux/signal.c:75:6: warning: no previous prototype for ‘sig_handler’ [-Wmissing-prototypes]
   75 | void sig_handler(int sig, struct siginfo *si, mcontext_t *mc)
      |      ^~~~~~~~~~~
../arch/um/os-Linux/signal.c:111:6: warning: no previous prototype for ‘timer_alarm_handler’ [-Wmissing-prototypes]
  111 | void timer_alarm_handler(int sig, struct siginfo *unused_si, mcontext_t *mc)
      |      ^~~~~~~~~~~~~~~~~~~
../arch/um/os-Linux/start_up.c:301:12: warning: no previous prototype for ‘parse_iomem’ [-Wmissing-prototypes]
  301 | int __init parse_iomem(char *str, int *add)
      |            ^~~~~~~~~~~
../arch/x86/um/signal.c:560:6: warning: no previous prototype for ‘sys_rt_sigreturn’ [-Wmissing-prototypes]
  560 | long sys_rt_sigreturn(void)
      |      ^~~~~~~~~~~~~~~~
../arch/x86/um/syscalls_64.c:48:6: warning: no previous prototype for ‘arch_switch_to’ [-Wmissing-prototypes]
   48 | void arch_switch_to(struct task_struct *to)
      |      ^~~~~~~~~~~~~~
../arch/um/kernel/mem.c:202:8: warning: no previous prototype for ‘pgd_alloc’ [-Wmissing-prototypes]
  202 | pgd_t *pgd_alloc(struct mm_struct *mm)
      |        ^~~~~~~~~
../arch/um/kernel/mem.c:215:7: warning: no previous prototype for ‘uml_kmalloc’ [-Wmissing-prototypes]
  215 | void *uml_kmalloc(int size, int flags)
      |       ^~~~~~~~~~~
../arch/um/kernel/process.c:51:5: warning: no previous prototype for ‘pid_to_processor_id’ [-Wmissing-prototypes]
   51 | int pid_to_processor_id(int pid)
      |     ^~~~~~~~~~~~~~~~~~~
../arch/um/kernel/process.c:87:7: warning: no previous prototype for ‘__switch_to’ [-Wmissing-prototypes]
   87 | void *__switch_to(struct task_struct *from, struct task_struct *to)
      |       ^~~~~~~~~~~
../arch/um/kernel/process.c:140:6: warning: no previous prototype for ‘fork_handler’ [-Wmissing-prototypes]
  140 | void fork_handler(void)
      |      ^~~~~~~~~~~~
../arch/um/kernel/process.c:217:6: warning: no previous prototype for ‘arch_cpu_idle’ [-Wmissing-prototypes]
  217 | void arch_cpu_idle(void)
      |      ^~~~~~~~~~~~~
../arch/um/kernel/process.c:253:5: warning: no previous prototype for ‘copy_to_user_proc’ [-Wmissing-prototypes]
  253 | int copy_to_user_proc(void __user *to, void *from, int size)
      |     ^~~~~~~~~~~~~~~~~
../arch/um/kernel/process.c:263:5: warning: no previous prototype for ‘clear_user_proc’ [-Wmissing-prototypes]
  263 | int clear_user_proc(void __user *buf, int size)
      |     ^~~~~~~~~~~~~~~
../arch/um/kernel/process.c:271:6: warning: no previous prototype for ‘set_using_sysemu’ [-Wmissing-prototypes]
  271 | void set_using_sysemu(int value)
      |      ^~~~~~~~~~~~~~~~
../arch/um/kernel/process.c:278:5: warning: no previous prototype for ‘get_using_sysemu’ [-Wmissing-prototypes]
  278 | int get_using_sysemu(void)
      |     ^~~~~~~~~~~~~~~~
../arch/um/kernel/process.c:316:12: warning: no previous prototype for ‘make_proc_sysemu’ [-Wmissing-prototypes]
  316 | int __init make_proc_sysemu(void)
      |            ^~~~~~~~~~~~~~~~
../arch/um/kernel/process.c:348:15: warning: no previous prototype for ‘arch_align_stack’ [-Wmissing-prototypes]
  348 | unsigned long arch_align_stack(unsigned long sp)
      |               ^~~~~~~~~~~~~~~~
../arch/um/kernel/reboot.c:45:6: warning: no previous prototype for ‘machine_restart’ [-Wmissing-prototypes]
   45 | void machine_restart(char * __unused)
      |      ^~~~~~~~~~~~~~~
../arch/um/kernel/reboot.c:51:6: warning: no previous prototype for ‘machine_power_off’ [-Wmissing-prototypes]
   51 | void machine_power_off(void)
      |      ^~~~~~~~~~~~~~~~~
../arch/um/kernel/reboot.c:57:6: warning: no previous prototype for ‘machine_halt’ [-Wmissing-prototypes]
   57 | void machine_halt(void)
      |      ^~~~~~~~~~~~
../arch/um/kernel/tlb.c:579:6: warning: no previous prototype for ‘flush_tlb_mm_range’ [-Wmissing-prototypes]
  579 | void flush_tlb_mm_range(struct mm_struct *mm, unsigned long start,
      |      ^~~~~~~~~~~~~~~~~~
../arch/um/kernel/tlb.c:594:6: warning: no previous prototype for ‘force_flush_all’ [-Wmissing-prototypes]
  594 | void force_flush_all(void)
      |      ^~~~~~~~~~~~~~~
../arch/um/kernel/um_arch.c:408:19: warning: no previous prototype for ‘read_initrd’ [-Wmissing-prototypes]
  408 | int __init __weak read_initrd(void)
      |                   ^~~~~~~~~~~
../arch/um/kernel/um_arch.c:461:7: warning: no previous prototype for ‘text_poke’ [-Wmissing-prototypes]
  461 | void *text_poke(void *addr, const void *opcode, size_t len)
      |       ^~~~~~~~~
../arch/um/kernel/um_arch.c:473:6: warning: no previous prototype for ‘text_poke_sync’ [-Wmissing-prototypes]
  473 | void text_poke_sync(void)
      |      ^~~~~~~~~~~~~~
../arch/um/kernel/kmsg_dump.c:60:12: warning: no previous prototype for ‘kmsg_dumper_stdout_init’ [-Wmissing-prototypes]
   60 | int __init kmsg_dumper_stdout_init(void)
      |            ^~~~~~~~~~~~~~~~~~~~~~~
../lib/iomap.c:156:5: warning: no previous prototype for ‘ioread64_lo_hi’ [-Wmissing-prototypes]
  156 | u64 ioread64_lo_hi(const void __iomem *addr)
      |     ^~~~~~~~~~~~~~
../lib/iomap.c:163:5: warning: no previous prototype for ‘ioread64_hi_lo’ [-Wmissing-prototypes]
  163 | u64 ioread64_hi_lo(const void __iomem *addr)
      |     ^~~~~~~~~~~~~~
../lib/iomap.c:170:5: warning: no previous prototype for ‘ioread64be_lo_hi’ [-Wmissing-prototypes]
  170 | u64 ioread64be_lo_hi(const void __iomem *addr)
      |     ^~~~~~~~~~~~~~~~
../lib/iomap.c:178:5: warning: no previous prototype for ‘ioread64be_hi_lo’ [-Wmissing-prototypes]
  178 | u64 ioread64be_hi_lo(const void __iomem *addr)
      |     ^~~~~~~~~~~~~~~~
../lib/iomap.c:264:6: warning: no previous prototype for ‘iowrite64_lo_hi’ [-Wmissing-prototypes]
  264 | void iowrite64_lo_hi(u64 val, void __iomem *addr)
      |      ^~~~~~~~~~~~~~~
../lib/iomap.c:272:6: warning: no previous prototype for ‘iowrite64_hi_lo’ [-Wmissing-prototypes]
  272 | void iowrite64_hi_lo(u64 val, void __iomem *addr)
      |      ^~~~~~~~~~~~~~~
../lib/iomap.c:280:6: warning: no previous prototype for ‘iowrite64be_lo_hi’ [-Wmissing-prototypes]
  280 | void iowrite64be_lo_hi(u64 val, void __iomem *addr)
      |      ^~~~~~~~~~~~~~~~~
../lib/iomap.c:288:6: warning: no previous prototype for ‘iowrite64be_hi_lo’ [-Wmissing-prototypes]
  288 | void iowrite64be_hi_lo(u64 val, void __iomem *addr)
      |      ^~~~~~~~~~~~~~~~~
stty: 'standard input': Inappropriate ioctl for device

[08:21:49] Starting KUnit Kernel (1/1)...
[08:21:49] ============================================================ Running tests with:

$ .kunit/linux kunit.enable=1 mem=1G console=tty kunit_shutdown=halt
[08:21:49] =================== guc_dbm (7 subtests) ===================
[08:21:49] [PASSED] test_empty
[08:21:49] [PASSED] test_default
[08:21:49] ======================== test_size  ========================
[08:21:49] [PASSED] 4
[08:21:49] [PASSED] 8
[08:21:49] [PASSED] 32
[08:21:49] [PASSED] 256
[08:21:49] ==================== [PASSED] test_size ====================
[08:21:49] ======================= test_reuse  ========================
[08:21:49] [PASSED] 4
[08:21:49] [PASSED] 8
[08:21:49] [PASSED] 32
[08:21:49] [PASSED] 256
[08:21:49] =================== [PASSED] test_reuse ====================
[08:21:49] =================== test_range_overlap  ====================
[08:21:49] [PASSED] 4
[08:21:49] [PASSED] 8
[08:21:49] [PASSED] 32
[08:21:49] [PASSED] 256
[08:21:49] =============== [PASSED] test_range_overlap ================
[08:21:49] =================== test_range_compact  ====================
[08:21:49] [PASSED] 4
[08:21:49] [PASSED] 8
[08:21:49] [PASSED] 32
[08:21:49] [PASSED] 256
[08:21:49] =============== [PASSED] test_range_compact ================
[08:21:49] ==================== test_range_spare  =====================
[08:21:49] [PASSED] 4
[08:21:49] [PASSED] 8
[08:21:49] [PASSED] 32
[08:21:49] [PASSED] 256
[08:21:49] ================ [PASSED] test_range_spare =================
[08:21:49] ===================== [PASSED] guc_dbm =====================
[08:21:49] =================== guc_idm (6 subtests) ===================
[08:21:49] [PASSED] bad_init
[08:21:49] [PASSED] no_init
[08:21:49] [PASSED] init_fini
[08:21:49] [PASSED] check_used
[08:21:49] [PASSED] check_quota
[08:21:49] [PASSED] check_all
[08:21:49] ===================== [PASSED] guc_idm =====================
[08:21:49] ================== no_relay (3 subtests) ===================
[08:21:49] [PASSED] xe_drops_guc2pf_if_not_ready
[08:21:49] [PASSED] xe_drops_guc2vf_if_not_ready
[08:21:49] [PASSED] xe_rejects_send_if_not_ready
[08:21:49] ==================== [PASSED] no_relay =====================
[08:21:49] ================== pf_relay (14 subtests) ==================
[08:21:49] [PASSED] pf_rejects_guc2pf_too_short
[08:21:49] [PASSED] pf_rejects_guc2pf_too_long
[08:21:49] [PASSED] pf_rejects_guc2pf_no_payload
[08:21:49] [PASSED] pf_fails_no_payload
[08:21:49] [PASSED] pf_fails_bad_origin
[08:21:49] [PASSED] pf_fails_bad_type
[08:21:49] [PASSED] pf_txn_reports_error
[08:21:49] [PASSED] pf_txn_sends_pf2guc
[08:21:49] [PASSED] pf_sends_pf2guc
[08:21:49] [SKIPPED] pf_loopback_nop
[08:21:49] [SKIPPED] pf_loopback_echo
[08:21:49] [SKIPPED] pf_loopback_fail
[08:21:49] [SKIPPED] pf_loopback_busy
[08:21:49] [SKIPPED] pf_loopback_retry
[08:21:49] ==================== [PASSED] pf_relay =====================
[08:21:49] ================== vf_relay (3 subtests) ===================
[08:21:49] [PASSED] vf_rejects_guc2vf_too_short
[08:21:49] [PASSED] vf_rejects_guc2vf_too_long
[08:21:49] [PASSED] vf_rejects_guc2vf_no_payload
[08:21:49] ==================== [PASSED] vf_relay =====================
[08:21:49] ================= pf_service (11 subtests) =================
[08:21:49] [PASSED] pf_negotiate_any
[08:21:49] [PASSED] pf_negotiate_base_match
[08:21:49] [PASSED] pf_negotiate_base_newer
[08:21:49] [PASSED] pf_negotiate_base_next
[08:21:49] [SKIPPED] pf_negotiate_base_older
[08:21:49] [PASSED] pf_negotiate_base_prev
[08:21:49] [PASSED] pf_negotiate_latest_match
[08:21:49] [PASSED] pf_negotiate_latest_newer
[08:21:49] [PASSED] pf_negotiate_latest_next
[08:21:49] [SKIPPED] pf_negotiate_latest_older
[08:21:49] [SKIPPED] pf_negotiate_latest_prev
[08:21:49] =================== [PASSED] pf_service ====================
[08:21:49] ===================== lmtt (1 subtest) =====================
[08:21:49] ======================== test_ops  =========================
[08:21:49] [PASSED] 2-level
[08:21:49] [PASSED] multi-level
[08:21:49] ==================== [PASSED] test_ops =====================
[08:21:49] ====================== [PASSED] lmtt =======================
[08:21:49] ==================== xe_bo (3 subtests) ====================
[08:21:49] [SKIPPED] xe_ccs_migrate_kunit
[08:21:49] [SKIPPED] xe_bo_evict_kunit
[08:21:49] [SKIPPED] xe_bo_shrink_kunit
[08:21:49] ===================== [SKIPPED] xe_bo ======================
[08:21:49] ================== xe_dma_buf (1 subtest) ==================
[08:21:49] [SKIPPED] xe_dma_buf_kunit
[08:21:49] =================== [SKIPPED] xe_dma_buf ===================
[08:21:49] ================== xe_migrate (1 subtest) ==================
[08:21:49] [SKIPPED] xe_migrate_sanity_kunit
[08:21:49] =================== [SKIPPED] xe_migrate ===================
[08:21:49] =================== xe_mocs (2 subtests) ===================
[08:21:49] [SKIPPED] xe_live_mocs_kernel_kunit
[08:21:49] [SKIPPED] xe_live_mocs_reset_kunit
[08:21:49] ==================== [SKIPPED] xe_mocs =====================
[08:21:49] ==================== args (11 subtests) ====================
[08:21:49] [PASSED] count_args_test
[08:21:49] [PASSED] call_args_example
[08:21:49] [PASSED] call_args_test
[08:21:49] [PASSED] drop_first_arg_example
[08:21:49] [PASSED] drop_first_arg_test
[08:21:49] [PASSED] first_arg_example
[08:21:49] [PASSED] first_arg_test
[08:21:49] [PASSED] last_arg_example
[08:21:49] [PASSED] last_arg_test
[08:21:49] [PASSED] pick_arg_example
[08:21:49] [PASSED] sep_comma_example
[08:21:49] ====================== [PASSED] args =======================
[08:21:49] =================== xe_pci (2 subtests) ====================
[08:21:49] [PASSED] xe_gmdid_graphics_ip
[08:21:49] [PASSED] xe_gmdid_media_ip
[08:21:49] ===================== [PASSED] xe_pci ======================
[08:21:49] ==================== xe_rtp (1 subtest) ====================
[08:21:49] ================== xe_rtp_process_tests  ===================
[08:21:49] [PASSED] coalesce-same-reg
[08:21:49] [PASSED] no-match-no-add
[08:21:49] [PASSED] no-match-no-add-multiple-rules
[08:21:49] [PASSED] two-regs-two-entries
[08:21:49] [PASSED] clr-one-set-other
[08:21:49] [PASSED] set-field
[08:21:49] [PASSED] conflict-duplicate
[08:21:49] [PASSED] conflict-not-disjoint
[08:21:49] [PASSED] conflict-reg-type
[08:21:49] ============== [PASSED] xe_rtp_process_tests ===============
[08:21:49] ===================== [PASSED] xe_rtp ======================
[08:21:49] ==================== xe_wa (1 subtest) =====================
[08:21:49] ======================== xe_wa_gt  =========================
[08:21:49] [PASSED] TIGERLAKE (B0)
[08:21:49] [PASSED] DG1 (A0)
[08:21:49] [PASSED] DG1 (B0)
[08:21:49] [PASSED] ALDERLAKE_S (A0)
[08:21:49] [PASSED] ALDERLAKE_S (B0)
[08:21:49] [PASSED] ALDERLAKE_S (C0)
[08:21:49] [PASSED] ALDERLAKE_S (D0)
[08:21:49] [PASSED] ALDERLAKE_P (A0)
[08:21:49] [PASSED] ALDERLAKE_P (B0)
[08:21:49] [PASSED] ALDERLAKE_P (C0)
[08:21:49] [PASSED] ALDERLAKE_S_RPLS (D0)
[08:21:49] [PASSED] ALDERLAKE_P_RPLU (E0)
[08:21:49] [PASSED] DG2_G10 (C0)
[08:21:49] [PASSED] DG2_G11 (B1)
[08:21:49] [PASSED] DG2_G12 (A1)
[08:21:49] [PASSED] METEORLAKE (g:A0, m:A0)
[08:21:49] [PASSED] METEORLAKE (g:A0, m:A0)
[08:21:49] [PASSED] METEORLAKE (g:A0, m:A0)
[08:21:49] [PASSED] LUNARLAKE (g:A0, m:A0)
[08:21:49] [PASSED] LUNARLAKE (g:B0, m:A0)
[08:21:49] ==================== [PASSED] xe_wa_gt =====================
[08:21:49] ====================== [PASSED] xe_wa ======================
[08:21:49] ============================================================
[08:21:49] Testing complete. Ran 110 tests: passed: 95, skipped: 15
[08:21:49] Elapsed time: 29.859s total, 4.274s configuring, 25.366s building, 0.194s running

+ /kernel/tools/testing/kunit/kunit.py run --kunitconfig /kernel/drivers/gpu/drm/tests/.kunitconfig [08:21:49] Configuring KUnit Kernel ...
Regenerating .config ...
Populating config with:

$ make ARCH=um O=.kunit olddefconfig
[08:21:51] Building KUnit Kernel ...
Populating config with:
$ make ARCH=um O=.kunit olddefconfig
Building with:
$ make ARCH=um O=.kunit --jobs=48
In file included from ../arch/um/kernel/asm-offsets.c:1:
../arch/x86/um/shared/sysdep/kernel-offsets.h:9:6: warning: no previous prototype for ‘foo’ [-Wmissing-prototypes]
    9 | void foo(void)
      |      ^~~
../arch/x86/um/syscalls_64.c:48:6: warning: no previous prototype for ‘arch_switch_to’ [-Wmissing-prototypes]
   48 | void arch_switch_to(struct task_struct *to)
      |      ^~~~~~~~~~~~~~
../arch/x86/um/ptrace_64.c:111:5: warning: no previous prototype for ‘poke_user’ [-Wmissing-prototypes]
  111 | int poke_user(struct task_struct *child, long addr, long data)
      |     ^~~~~~~~~
../arch/x86/um/ptrace_64.c:171:5: warning: no previous prototype for ‘peek_user’ [-Wmissing-prototypes]
  171 | int peek_user(struct task_struct *child, long addr, long data)
      |     ^~~~~~~~~
../arch/x86/um/signal.c:560:6: warning: no previous prototype for ‘sys_rt_sigreturn’ [-Wmissing-prototypes]
  560 | long sys_rt_sigreturn(void)
      |      ^~~~~~~~~~~~~~~~
../arch/um/kernel/mem.c:202:8: warning: no previous prototype for ‘pgd_alloc’ [-Wmissing-prototypes]
  202 | pgd_t *pgd_alloc(struct mm_struct *mm)
      |        ^~~~~~~~~
../arch/um/kernel/mem.c:215:7: warning: no previous prototype for ‘uml_kmalloc’ [-Wmissing-prototypes]
  215 | void *uml_kmalloc(int size, int flags)
      |       ^~~~~~~~~~~
../arch/um/kernel/process.c:51:5: warning: no previous prototype for ‘pid_to_processor_id’ [-Wmissing-prototypes]
   51 | int pid_to_processor_id(int pid)
      |     ^~~~~~~~~~~~~~~~~~~
../arch/um/kernel/process.c:87:7: warning: no previous prototype for ‘__switch_to’ [-Wmissing-prototypes]
   87 | void *__switch_to(struct task_struct *from, struct task_struct *to)
      |       ^~~~~~~~~~~
../arch/um/kernel/process.c:140:6: warning: no previous prototype for ‘fork_handler’ [-Wmissing-prototypes]
  140 | void fork_handler(void)
      |      ^~~~~~~~~~~~
../arch/um/kernel/process.c:217:6: warning: no previous prototype for ‘arch_cpu_idle’ [-Wmissing-prototypes]
  217 | void arch_cpu_idle(void)
      |      ^~~~~~~~~~~~~
../arch/um/kernel/process.c:253:5: warning: no previous prototype for ‘copy_to_user_proc’ [-Wmissing-prototypes]
  253 | int copy_to_user_proc(void __user *to, void *from, int size)
      |     ^~~~~~~~~~~~~~~~~
../arch/um/kernel/process.c:263:5: warning: no previous prototype for ‘clear_user_proc’ [-Wmissing-prototypes]
  263 | int clear_user_proc(void __user *buf, int size)
      |     ^~~~~~~~~~~~~~~
../arch/um/kernel/process.c:271:6: warning: no previous prototype for ‘set_using_sysemu’ [-Wmissing-prototypes]
  271 | void set_using_sysemu(int value)
      |      ^~~~~~~~~~~~~~~~
../arch/um/kernel/process.c:278:5: warning: no previous prototype for ‘get_using_sysemu’ [-Wmissing-prototypes]
  278 | int get_using_sysemu(void)
      |     ^~~~~~~~~~~~~~~~
../arch/um/kernel/process.c:316:12: warning: no previous prototype for ‘make_proc_sysemu’ [-Wmissing-prototypes]
  316 | int __init make_proc_sysemu(void)
      |            ^~~~~~~~~~~~~~~~
../arch/um/kernel/process.c:348:15: warning: no previous prototype for ‘arch_align_stack’ [-Wmissing-prototypes]
  348 | unsigned long arch_align_stack(unsigned long sp)
      |               ^~~~~~~~~~~~~~~~
../arch/um/kernel/reboot.c:45:6: warning: no previous prototype for ‘machine_restart’ [-Wmissing-prototypes]
   45 | void machine_restart(char * __unused)
      |      ^~~~~~~~~~~~~~~
../arch/um/kernel/reboot.c:51:6: warning: no previous prototype for ‘machine_power_off’ [-Wmissing-prototypes]
   51 | void machine_power_off(void)
      |      ^~~~~~~~~~~~~~~~~
../arch/um/kernel/reboot.c:57:6: warning: no previous prototype for ‘machine_halt’ [-Wmissing-prototypes]
   57 | void machine_halt(void)
      |      ^~~~~~~~~~~~
../arch/um/kernel/tlb.c:579:6: warning: no previous prototype for ‘flush_tlb_mm_range’ [-Wmissing-prototypes]
  579 | void flush_tlb_mm_range(struct mm_struct *mm, unsigned long start,
      |      ^~~~~~~~~~~~~~~~~~
../arch/um/kernel/tlb.c:594:6: warning: no previous prototype for ‘force_flush_all’ [-Wmissing-prototypes]
  594 | void force_flush_all(void)
      |      ^~~~~~~~~~~~~~~
../arch/um/kernel/um_arch.c:408:19: warning: no previous prototype for ‘read_initrd’ [-Wmissing-prototypes]
  408 | int __init __weak read_initrd(void)
      |                   ^~~~~~~~~~~
../arch/um/kernel/um_arch.c:461:7: warning: no previous prototype for ‘text_poke’ [-Wmissing-prototypes]
  461 | void *text_poke(void *addr, const void *opcode, size_t len)
      |       ^~~~~~~~~
../arch/um/kernel/um_arch.c:473:6: warning: no previous prototype for ‘text_poke_sync’ [-Wmissing-prototypes]
  473 | void text_poke_sync(void)
      |      ^~~~~~~~~~~~~~
../arch/um/kernel/kmsg_dump.c:60:12: warning: no previous prototype for ‘kmsg_dumper_stdout_init’ [-Wmissing-prototypes]
   60 | int __init kmsg_dumper_stdout_init(void)
      |            ^~~~~~~~~~~~~~~~~~~~~~~
../arch/um/kernel/skas/process.c:36:12: warning: no previous prototype for ‘start_uml’ [-Wmissing-prototypes]
   36 | int __init start_uml(void)
      |            ^~~~~~~~~
../arch/um/kernel/skas/mmu.c:17:5: warning: no previous prototype for ‘init_new_context’ [-Wmissing-prototypes]
   17 | int init_new_context(struct task_struct *task, struct mm_struct *mm)
      |     ^~~~~~~~~~~~~~~~
../arch/um/kernel/skas/mmu.c:60:6: warning: no previous prototype for ‘destroy_context’ [-Wmissing-prototypes]
   60 | void destroy_context(struct mm_struct *mm)
      |      ^~~~~~~~~~~~~~~
../lib/iomap.c:156:5: warning: no previous prototype for ‘ioread64_lo_hi’ [-Wmissing-prototypes]
  156 | u64 ioread64_lo_hi(const void __iomem *addr)
      |     ^~~~~~~~~~~~~~
../lib/iomap.c:163:5: warning: no previous prototype for ‘ioread64_hi_lo’ [-Wmissing-prototypes]
  163 | u64 ioread64_hi_lo(const void __iomem *addr)
      |     ^~~~~~~~~~~~~~
../lib/iomap.c:170:5: warning: no previous prototype for ‘ioread64be_lo_hi’ [-Wmissing-prototypes]
  170 | u64 ioread64be_lo_hi(const void __iomem *addr)
      |     ^~~~~~~~~~~~~~~~
../lib/iomap.c:178:5: warning: no previous prototype for ‘ioread64be_hi_lo’ [-Wmissing-prototypes]
  178 | u64 ioread64be_hi_lo(const void __iomem *addr)
      |     ^~~~~~~~~~~~~~~~
../lib/iomap.c:264:6: warning: no previous prototype for ‘iowrite64_lo_hi’ [-Wmissing-prototypes]
  264 | void iowrite64_lo_hi(u64 val, void __iomem *addr)
      |      ^~~~~~~~~~~~~~~
../lib/iomap.c:272:6: warning: no previous prototype for ‘iowrite64_hi_lo’ [-Wmissing-prototypes]
  272 | void iowrite64_hi_lo(u64 val, void __iomem *addr)
      |      ^~~~~~~~~~~~~~~
../lib/iomap.c:280:6: warning: no previous prototype for ‘iowrite64be_lo_hi’ [-Wmissing-prototypes]
  280 | void iowrite64be_lo_hi(u64 val, void __iomem *addr)
      |      ^~~~~~~~~~~~~~~~~
../lib/iomap.c:288:6: warning: no previous prototype for ‘iowrite64be_hi_lo’ [-Wmissing-prototypes]
  288 | void iowrite64be_hi_lo(u64 val, void __iomem *addr)
      |      ^~~~~~~~~~~~~~~~~

[08:22:13] Starting KUnit Kernel (1/1)...
[08:22:13] ============================================================ Running tests with:

$ .kunit/linux kunit.enable=1 mem=1G console=tty kunit_shutdown=halt
[08:22:13] ============ drm_test_pick_cmdline (2 subtests) ============
[08:22:13] [PASSED] drm_test_pick_cmdline_res_1920_1080_60
[08:22:13] =============== drm_test_pick_cmdline_named  ===============
[08:22:13] [PASSED] NTSC
[08:22:13] [PASSED] NTSC-J
[08:22:13] [PASSED] PAL
[08:22:13] [PASSED] PAL-M
[08:22:13] =========== [PASSED] drm_test_pick_cmdline_named ===========
[08:22:13] ============== [PASSED] drm_test_pick_cmdline ==============
[08:22:13] ================== drm_buddy (7 subtests) ==================
[08:22:13] [PASSED] drm_test_buddy_alloc_limit
[08:22:13] [PASSED] drm_test_buddy_alloc_optimistic
[08:22:13] [PASSED] drm_test_buddy_alloc_pessimistic
[08:22:13] [PASSED] drm_test_buddy_alloc_pathological
[08:22:13] [PASSED] drm_test_buddy_alloc_contiguous
[08:22:13] [PASSED] drm_test_buddy_alloc_clear
[08:22:13] [PASSED] drm_test_buddy_alloc_range_bias
[08:22:13] ==================== [PASSED] drm_buddy ====================
[08:22:13] ============= drm_cmdline_parser (40 subtests) =============
[08:22:13] [PASSED] drm_test_cmdline_force_d_only
[08:22:13] [PASSED] drm_test_cmdline_force_D_only_dvi
[08:22:13] [PASSED] drm_test_cmdline_force_D_only_hdmi
[08:22:13] [PASSED] drm_test_cmdline_force_D_only_not_digital
[08:22:13] [PASSED] drm_test_cmdline_force_e_only
[08:22:13] [PASSED] drm_test_cmdline_res
[08:22:13] [PASSED] drm_test_cmdline_res_vesa
[08:22:13] [PASSED] drm_test_cmdline_res_vesa_rblank
[08:22:13] [PASSED] drm_test_cmdline_res_rblank
[08:22:13] [PASSED] drm_test_cmdline_res_bpp
[08:22:13] [PASSED] drm_test_cmdline_res_refresh
[08:22:13] [PASSED] drm_test_cmdline_res_bpp_refresh
[08:22:13] [PASSED] drm_test_cmdline_res_bpp_refresh_interlaced
[08:22:13] [PASSED] drm_test_cmdline_res_bpp_refresh_margins
[08:22:13] [PASSED] drm_test_cmdline_res_bpp_refresh_force_off
[08:22:13] [PASSED] drm_test_cmdline_res_bpp_refresh_force_on
[08:22:13] [PASSED] drm_test_cmdline_res_bpp_refresh_force_on_analog
[08:22:13] [PASSED] drm_test_cmdline_res_bpp_refresh_force_on_digital
[08:22:13] [PASSED] drm_test_cmdline_res_bpp_refresh_interlaced_margins_force_on
[08:22:13] [PASSED] drm_test_cmdline_res_margins_force_on
[08:22:13] [PASSED] drm_test_cmdline_res_vesa_margins
[08:22:13] [PASSED] drm_test_cmdline_name
[08:22:13] [PASSED] drm_test_cmdline_name_bpp
[08:22:13] [PASSED] drm_test_cmdline_name_option
[08:22:13] [PASSED] drm_test_cmdline_name_bpp_option
[08:22:13] [PASSED] drm_test_cmdline_rotate_0
[08:22:13] [PASSED] drm_test_cmdline_rotate_90
[08:22:13] [PASSED] drm_test_cmdline_rotate_180
[08:22:13] [PASSED] drm_test_cmdline_rotate_270
[08:22:13] [PASSED] drm_test_cmdline_hmirror
[08:22:13] [PASSED] drm_test_cmdline_vmirror
[08:22:13] [PASSED] drm_test_cmdline_margin_options
[08:22:13] [PASSED] drm_test_cmdline_multiple_options
[08:22:13] [PASSED] drm_test_cmdline_bpp_extra_and_option
[08:22:13] [PASSED] drm_test_cmdline_extra_and_option
[08:22:13] [PASSED] drm_test_cmdline_freestanding_options
[08:22:13] [PASSED] drm_test_cmdline_freestanding_force_e_and_options
[08:22:13] [PASSED] drm_test_cmdline_panel_orientation
[08:22:13] ================ drm_test_cmdline_invalid  =================
[08:22:13] [PASSED] margin_only
[08:22:13] [PASSED] interlace_only
[08:22:13] [PASSED] res_missing_x
[08:22:13] [PASSED] res_missing_y
[08:22:13] [PASSED] res_bad_y
[08:22:13] [PASSED] res_missing_y_bpp
[08:22:13] [PASSED] res_bad_bpp
[08:22:13] [PASSED] res_bad_refresh
[08:22:13] [PASSED] res_bpp_refresh_force_on_off
[08:22:13] [PASSED] res_invalid_mode
[08:22:13] [PASSED] res_bpp_wrong_place_mode
[08:22:13] [PASSED] name_bpp_refresh
[08:22:13] [PASSED] name_refresh
[08:22:13] [PASSED] name_refresh_wrong_mode
[08:22:13] [PASSED] name_refresh_invalid_mode
[08:22:13] [PASSED] rotate_multiple
[08:22:13] [PASSED] rotate_invalid_val
[08:22:13] [PASSED] rotate_truncated
[08:22:13] [PASSED] invalid_option
[08:22:13] [PASSED] invalid_tv_option
[08:22:13] [PASSED] truncated_tv_option
[08:22:13] ============ [PASSED] drm_test_cmdline_invalid =============
[08:22:13] =============== drm_test_cmdline_tv_options  ===============
[08:22:13] [PASSED] NTSC
[08:22:13] [PASSED] NTSC_443
[08:22:13] [PASSED] NTSC_J
[08:22:13] [PASSED] PAL
[08:22:13] [PASSED] PAL_M
[08:22:13] [PASSED] PAL_N
[08:22:13] [PASSED] SECAM
[08:22:13] =========== [PASSED] drm_test_cmdline_tv_options ===========
[08:22:13] =============== [PASSED] drm_cmdline_parser ================
[08:22:13] ============= drmm_connector_init (3 subtests) =============
[08:22:13] [PASSED] drm_test_drmm_connector_init
[08:22:13] [PASSED] drm_test_drmm_connector_init_null_ddc
[08:22:13] ========= drm_test_drmm_connector_init_type_valid  =========
[08:22:13] [PASSED] Unknown
[08:22:13] [PASSED] VGA
[08:22:13] [PASSED] DVI-I
[08:22:13] [PASSED] DVI-D
[08:22:13] [PASSED] DVI-A
[08:22:13] [PASSED] Composite
[08:22:13] [PASSED] SVIDEO
[08:22:13] [PASSED] LVDS
[08:22:13] [PASSED] Component
[08:22:13] [PASSED] DIN
[08:22:13] [PASSED] DP
[08:22:13] [PASSED] HDMI-A
[08:22:13] [PASSED] HDMI-B
[08:22:13] [PASSED] TV
[08:22:13] [PASSED] eDP
[08:22:13] [PASSED] Virtual
[08:22:13] [PASSED] DSI
[08:22:13] [PASSED] DPI
[08:22:13] [PASSED] Writeback
[08:22:13] [PASSED] SPI
[08:22:13] [PASSED] USB
[08:22:13] ===== [PASSED] drm_test_drmm_connector_init_type_valid =====
[08:22:13] =============== [PASSED] drmm_connector_init ===============
[08:22:13] ========== drm_get_tv_mode_from_name (2 subtests) ==========
[08:22:13] ========== drm_test_get_tv_mode_from_name_valid  ===========
[08:22:13] [PASSED] NTSC
[08:22:13] [PASSED] NTSC-443
[08:22:13] [PASSED] NTSC-J
[08:22:13] [PASSED] PAL
[08:22:13] [PASSED] PAL-M
[08:22:13] [PASSED] PAL-N
[08:22:13] [PASSED] SECAM
[08:22:13] ====== [PASSED] drm_test_get_tv_mode_from_name_valid =======
[08:22:13] [PASSED] drm_test_get_tv_mode_from_name_truncated
[08:22:13] ============ [PASSED] drm_get_tv_mode_from_name ============
[08:22:13] ============= drm_damage_helper (21 subtests) ==============
[08:22:13] [PASSED] drm_test_damage_iter_no_damage
[08:22:13] [PASSED] drm_test_damage_iter_no_damage_fractional_src
[08:22:13] [PASSED] drm_test_damage_iter_no_damage_src_moved
[08:22:13] [PASSED] drm_test_damage_iter_no_damage_fractional_src_moved
[08:22:13] [PASSED] drm_test_damage_iter_no_damage_not_visible
[08:22:13] [PASSED] drm_test_damage_iter_no_damage_no_crtc
[08:22:13] [PASSED] drm_test_damage_iter_no_damage_no_fb
[08:22:13] [PASSED] drm_test_damage_iter_simple_damage
[08:22:13] [PASSED] drm_test_damage_iter_single_damage
[08:22:13] [PASSED] drm_test_damage_iter_single_damage_intersect_src
[08:22:13] [PASSED] drm_test_damage_iter_single_damage_outside_src
[08:22:13] [PASSED] drm_test_damage_iter_single_damage_fractional_src
[08:22:13] [PASSED] drm_test_damage_iter_single_damage_intersect_fractional_src
[08:22:13] [PASSED] drm_test_damage_iter_single_damage_outside_fractional_src
[08:22:13] [PASSED] drm_test_damage_iter_single_damage_src_moved
[08:22:13] [PASSED] drm_test_damage_iter_single_damage_fractional_src_moved
[08:22:13] [PASSED] drm_test_damage_iter_damage
[08:22:13] [PASSED] drm_test_damage_iter_damage_one_intersect
[08:22:13] [PASSED] drm_test_damage_iter_damage_one_outside
[08:22:13] [PASSED] drm_test_damage_iter_damage_src_moved
[08:22:13] [PASSED] drm_test_damage_iter_damage_not_visible
[08:22:13] ================ [PASSED] drm_damage_helper ================
[08:22:13] ============== drm_dp_mst_helper (3 subtests) ==============
[08:22:13] ============== drm_test_dp_mst_calc_pbn_mode  ==============
[08:22:13] [PASSED] Clock 154000 BPP 30 DSC disabled
[08:22:13] [PASSED] Clock 234000 BPP 30 DSC disabled
[08:22:13] [PASSED] Clock 297000 BPP 24 DSC disabled
[08:22:13] [PASSED] Clock 332880 BPP 24 DSC enabled
[08:22:13] [PASSED] Clock 324540 BPP 24 DSC enabled
[08:22:13] ========== [PASSED] drm_test_dp_mst_calc_pbn_mode ==========
[08:22:13] ============== drm_test_dp_mst_calc_pbn_div  ===============
[08:22:13] [PASSED] Link rate 2000000 lane count 4
[08:22:13] [PASSED] Link rate 2000000 lane count 2
[08:22:13] [PASSED] Link rate 2000000 lane count 1
[08:22:13] [PASSED] Link rate 1350000 lane count 4
[08:22:13] [PASSED] Link rate 1350000 lane count 2
[08:22:13] [PASSED] Link rate 1350000 lane count 1
[08:22:13] [PASSED] Link rate 1000000 lane count 4
[08:22:13] [PASSED] Link rate 1000000 lane count 2
[08:22:13] [PASSED] Link rate 1000000 lane count 1
[08:22:13] [PASSED] Link rate 810000 lane count 4
[08:22:13] [PASSED] Link rate 810000 lane count 2
[08:22:13] [PASSED] Link rate 810000 lane count 1
[08:22:13] [PASSED] Link rate 540000 lane count 4
[08:22:13] [PASSED] Link rate 540000 lane count 2
[08:22:13] [PASSED] Link rate 540000 lane count 1
[08:22:13] [PASSED] Link rate 270000 lane count 4
[08:22:13] [PASSED] Link rate 270000 lane count 2
[08:22:13] [PASSED] Link rate 270000 lane count 1
[08:22:13] [PASSED] Link rate 162000 lane count 4
[08:22:13] [PASSED] Link rate 162000 lane count 2
[08:22:13] [PASSED] Link rate 162000 lane count 1
[08:22:13] ========== [PASSED] drm_test_dp_mst_calc_pbn_div ===========
[08:22:13] ========= drm_test_dp_mst_sideband_msg_req_decode  =========
[08:22:13] [PASSED] DP_ENUM_PATH_RESOURCES with port number
[08:22:13] [PASSED] DP_POWER_UP_PHY with port number
[08:22:13] [PASSED] DP_POWER_DOWN_PHY with port number
[08:22:13] [PASSED] DP_ALLOCATE_PAYLOAD with SDP stream sinks
[08:22:13] [PASSED] DP_ALLOCATE_PAYLOAD with port number
[08:22:13] [PASSED] DP_ALLOCATE_PAYLOAD with VCPI
[08:22:13] [PASSED] DP_ALLOCATE_PAYLOAD with PBN
[08:22:13] [PASSED] DP_QUERY_PAYLOAD with port number
[08:22:13] [PASSED] DP_QUERY_PAYLOAD with VCPI
[08:22:13] [PASSED] DP_REMOTE_DPCD_READ with port number
[08:22:13] [PASSED] DP_REMOTE_DPCD_READ with DPCD address
[08:22:13] [PASSED] DP_REMOTE_DPCD_READ with max number of bytes
[08:22:13] [PASSED] DP_REMOTE_DPCD_WRITE with port number
[08:22:13] [PASSED] DP_REMOTE_DPCD_WRITE with DPCD address
[08:22:13] [PASSED] DP_REMOTE_DPCD_WRITE with data array
[08:22:13] [PASSED] DP_REMOTE_I2C_READ with port number
[08:22:13] [PASSED] DP_REMOTE_I2C_READ with I2C device ID
[08:22:13] [PASSED] DP_REMOTE_I2C_READ with transactions array
[08:22:13] [PASSED] DP_REMOTE_I2C_WRITE with port number
[08:22:13] [PASSED] DP_REMOTE_I2C_WRITE with I2C device ID
[08:22:13] [PASSED] DP_REMOTE_I2C_WRITE with data array
[08:22:13] [PASSED] DP_QUERY_STREAM_ENC_STATUS with stream ID
[08:22:13] [PASSED] DP_QUERY_STREAM_ENC_STATUS with client ID
[08:22:13] [PASSED] DP_QUERY_STREAM_ENC_STATUS with stream event
[08:22:13] [PASSED] DP_QUERY_STREAM_ENC_STATUS with valid stream event
[08:22:13] [PASSED] DP_QUERY_STREAM_ENC_STATUS with stream behavior
[08:22:13] [PASSED] DP_QUERY_STREAM_ENC_STATUS with a valid stream behavior
[08:22:13] ===== [PASSED] drm_test_dp_mst_sideband_msg_req_decode =====
[08:22:13] ================ [PASSED] drm_dp_mst_helper ================
[08:22:13] ================== drm_exec (7 subtests) ===================
[08:22:13] [PASSED] sanitycheck
[08:22:13] [PASSED] test_lock
[08:22:13] [PASSED] test_lock_unlock
[08:22:13] [PASSED] test_duplicates
[08:22:13] [PASSED] test_prepare
[08:22:13] [PASSED] test_prepare_array
[08:22:13] [PASSED] test_multiple_loops
[08:22:13] ==================== [PASSED] drm_exec =====================
[08:22:13] =========== drm_format_helper_test (17 subtests) ===========
[08:22:13] ============== drm_test_fb_xrgb8888_to_gray8  ==============
[08:22:13] [PASSED] single_pixel_source_buffer
[08:22:13] [PASSED] single_pixel_clip_rectangle
[08:22:13] [PASSED] well_known_colors
[08:22:13] [PASSED] destination_pitch
[08:22:13] ========== [PASSED] drm_test_fb_xrgb8888_to_gray8 ==========
[08:22:13] ============= drm_test_fb_xrgb8888_to_rgb332  ==============
[08:22:13] [PASSED] single_pixel_source_buffer
[08:22:13] [PASSED] single_pixel_clip_rectangle
[08:22:13] [PASSED] well_known_colors
[08:22:13] [PASSED] destination_pitch
[08:22:13] ========= [PASSED] drm_test_fb_xrgb8888_to_rgb332 ==========
[08:22:13] ============= drm_test_fb_xrgb8888_to_rgb565  ==============
[08:22:13] [PASSED] single_pixel_source_buffer
[08:22:13] [PASSED] single_pixel_clip_rectangle
[08:22:13] [PASSED] well_known_colors
[08:22:13] [PASSED] destination_pitch
[08:22:13] ========= [PASSED] drm_test_fb_xrgb8888_to_rgb565 ==========
[08:22:13] ============ drm_test_fb_xrgb8888_to_xrgb1555  =============
[08:22:13] [PASSED] single_pixel_source_buffer
[08:22:13] [PASSED] single_pixel_clip_rectangle
[08:22:13] [PASSED] well_known_colors
[08:22:13] [PASSED] destination_pitch
[08:22:13] ======== [PASSED] drm_test_fb_xrgb8888_to_xrgb1555 =========
[08:22:13] ============ drm_test_fb_xrgb8888_to_argb1555  =============
[08:22:13] [PASSED] single_pixel_source_buffer
[08:22:13] [PASSED] single_pixel_clip_rectangle
[08:22:13] [PASSED] well_known_colors
[08:22:13] [PASSED] destination_pitch
[08:22:13] ======== [PASSED] drm_test_fb_xrgb8888_to_argb1555 =========
[08:22:13] ============ drm_test_fb_xrgb8888_to_rgba5551  =============
[08:22:13] [PASSED] single_pixel_source_buffer
[08:22:13] [PASSED] single_pixel_clip_rectangle
[08:22:13] [PASSED] well_known_colors
[08:22:13] [PASSED] destination_pitch
[08:22:13] ======== [PASSED] drm_test_fb_xrgb8888_to_rgba5551 =========
[08:22:13] ============= drm_test_fb_xrgb8888_to_rgb888  ==============
[08:22:13] [PASSED] single_pixel_source_buffer
[08:22:13] [PASSED] single_pixel_clip_rectangle
[08:22:13] [PASSED] well_known_colors
[08:22:13] [PASSED] destination_pitch
[08:22:13] ========= [PASSED] drm_test_fb_xrgb8888_to_rgb888 ==========
[08:22:13] ============ drm_test_fb_xrgb8888_to_argb8888  =============
[08:22:13] [PASSED] single_pixel_source_buffer
[08:22:13] [PASSED] single_pixel_clip_rectangle
[08:22:13] [PASSED] well_known_colors
[08:22:13] [PASSED] destination_pitch
[08:22:13] ======== [PASSED] drm_test_fb_xrgb8888_to_argb8888 =========
[08:22:13] =========== drm_test_fb_xrgb8888_to_xrgb2101010  ===========
[08:22:13] [PASSED] single_pixel_source_buffer
[08:22:13] [PASSED] single_pixel_clip_rectangle
[08:22:13] [PASSED] well_known_colors
[08:22:13] [PASSED] destination_pitch
[08:22:13] ======= [PASSED] drm_test_fb_xrgb8888_to_xrgb2101010 =======
[08:22:13] =========== drm_test_fb_xrgb8888_to_argb2101010  ===========
[08:22:13] [PASSED] single_pixel_source_buffer
[08:22:13] [PASSED] single_pixel_clip_rectangle
[08:22:13] [PASSED] well_known_colors
[08:22:13] [PASSED] destination_pitch
[08:22:13] ======= [PASSED] drm_test_fb_xrgb8888_to_argb2101010 =======
[08:22:13] ============== drm_test_fb_xrgb8888_to_mono  ===============
[08:22:13] [PASSED] single_pixel_source_buffer
[08:22:13] [PASSED] single_pixel_clip_rectangle
[08:22:13] [PASSED] well_known_colors
[08:22:13] [PASSED] destination_pitch
[08:22:13] ========== [PASSED] drm_test_fb_xrgb8888_to_mono ===========
[08:22:13] ==================== drm_test_fb_swab  =====================
[08:22:13] [PASSED] single_pixel_source_buffer
[08:22:13] [PASSED] single_pixel_clip_rectangle
[08:22:13] [PASSED] well_known_colors
[08:22:13] [PASSED] destination_pitch
[08:22:13] ================ [PASSED] drm_test_fb_swab =================
[08:22:13] ============ drm_test_fb_xrgb8888_to_xbgr8888  =============
[08:22:13] [PASSED] single_pixel_source_buffer
[08:22:13] [PASSED] single_pixel_clip_rectangle
[08:22:13] [PASSED] well_known_colors
[08:22:13] [PASSED] destination_pitch
[08:22:13] ======== [PASSED] drm_test_fb_xrgb8888_to_xbgr8888 =========
[08:22:13] ============ drm_test_fb_xrgb8888_to_abgr8888  =============
[08:22:13] [PASSED] single_pixel_source_buffer
[08:22:13] [PASSED] single_pixel_clip_rectangle
[08:22:13] [PASSED] well_known_colors
[08:22:13] [PASSED] destination_pitch
[08:22:13] ======== [PASSED] drm_test_fb_xrgb8888_to_abgr8888 =========
[08:22:13] ================= drm_test_fb_clip_offset  =================
[08:22:13] [PASSED] pass through
[08:22:13] [PASSED] horizontal offset
[08:22:13] [PASSED] vertical offset
[08:22:13] [PASSED] horizontal and vertical offset
[08:22:13] [PASSED] horizontal offset (custom pitch)
[08:22:13] [PASSED] vertical offset (custom pitch)
[08:22:13] [PASSED] horizontal and vertical offset (custom pitch)
[08:22:13] ============= [PASSED] drm_test_fb_clip_offset =============
[08:22:13] ============== drm_test_fb_build_fourcc_list  ==============
[08:22:13] [PASSED] no native formats
[08:22:13] [PASSED] XRGB8888 as native format
[08:22:13] [PASSED] remove duplicates
[08:22:13] [PASSED] convert alpha formats
[08:22:13] [PASSED] random formats
[08:22:13] ========== [PASSED] drm_test_fb_build_fourcc_list ==========
[08:22:13] =================== drm_test_fb_memcpy  ====================
[08:22:13] [PASSED] single_pixel_source_buffer: XR24 little-endian (0x34325258)
[08:22:13] [PASSED] single_pixel_source_buffer: XRA8 little-endian (0x38415258)
[08:22:13] [PASSED] single_pixel_source_buffer: YU24 little-endian (0x34325559)
[08:22:13] [PASSED] single_pixel_clip_rectangle: XB24 little-endian (0x34324258)
[08:22:13] [PASSED] single_pixel_clip_rectangle: XRA8 little-endian (0x38415258)
[08:22:13] [PASSED] single_pixel_clip_rectangle: YU24 little-endian (0x34325559)
[08:22:13] [PASSED] well_known_colors: XB24 little-endian (0x34324258)
[08:22:13] [PASSED] well_known_colors: XRA8 little-endian (0x38415258)
[08:22:13] [PASSED] well_known_colors: YU24 little-endian (0x34325559)
[08:22:13] [PASSED] destination_pitch: XB24 little-endian (0x34324258)
[08:22:13] [PASSED] destination_pitch: XRA8 little-endian (0x38415258)
[08:22:13] [PASSED] destination_pitch: YU24 little-endian (0x34325559)
[08:22:13] =============== [PASSED] drm_test_fb_memcpy ================
[08:22:13] ============= [PASSED] drm_format_helper_test ==============
[08:22:13] ================= drm_format (18 subtests) =================
[08:22:13] [PASSED] drm_test_format_block_width_invalid
[08:22:13] [PASSED] drm_test_format_block_width_one_plane
[08:22:13] [PASSED] drm_test_format_block_width_two_plane
[08:22:13] [PASSED] drm_test_format_block_width_three_plane
[08:22:13] [PASSED] drm_test_format_block_width_tiled
[08:22:13] [PASSED] drm_test_format_block_height_invalid
[08:22:13] [PASSED] drm_test_format_block_height_one_plane
[08:22:13] [PASSED] drm_test_format_block_height_two_plane
[08:22:13] [PASSED] drm_test_format_block_height_three_plane
[08:22:13] [PASSED] drm_test_format_block_height_tiled
[08:22:13] [PASSED] drm_test_format_min_pitch_invalid
[08:22:13] [PASSED] drm_test_format_min_pitch_one_plane_8bpp
[08:22:13] [PASSED] drm_test_format_min_pitch_one_plane_16bpp
[08:22:13] [PASSED] drm_test_format_min_pitch_one_plane_24bpp
[08:22:13] [PASSED] drm_test_format_min_pitch_one_plane_32bpp
[08:22:13] [PASSED] drm_test_format_min_pitch_two_plane
[08:22:13] [PASSED] drm_test_format_min_pitch_three_plane_8bpp
[08:22:13] [PASSED] drm_test_format_min_pitch_tiled
[08:22:13] =================== [PASSED] drm_format ====================
[08:22:13] =============== drm_framebuffer (1 subtest) ================
[08:22:13] =============== drm_test_framebuffer_create  ===============
[08:22:13] [PASSED] ABGR8888 normal sizes
[08:22:13] [PASSED] ABGR8888 max sizes
[08:22:13] [PASSED] ABGR8888 pitch greater than min required
[08:22:13] [PASSED] ABGR8888 pitch less than min required
[08:22:13] [PASSED] ABGR8888 Invalid width
[08:22:13] [PASSED] ABGR8888 Invalid buffer handle
[08:22:13] [PASSED] No pixel format
[08:22:13] [PASSED] ABGR8888 Width 0
[08:22:13] [PASSED] ABGR8888 Height 0
[08:22:13] [PASSED] ABGR8888 Out of bound height * pitch combination
[08:22:13] [PASSED] ABGR8888 Large buffer offset
[08:22:13] [PASSED] ABGR8888 Set DRM_MODE_FB_MODIFIERS without modifiers
[08:22:13] [PASSED] ABGR8888 Valid buffer modifier
[08:22:13] [PASSED] ABGR8888 Invalid buffer modifier(DRM_FORMAT_MOD_SAMSUNG_64_32_TILE)
[08:22:13] [PASSED] ABGR8888 Extra pitches without DRM_MODE_FB_MODIFIERS
[08:22:13] [PASSED] ABGR8888 Extra pitches with DRM_MODE_FB_MODIFIERS
[08:22:13] [PASSED] NV12 Normal sizes
[08:22:13] [PASSED] NV12 Max sizes
[08:22:13] [PASSED] NV12 Invalid pitch
[08:22:13] [PASSED] NV12 Invalid modifier/missing DRM_MODE_FB_MODIFIERS flag
[08:22:13] [PASSED] NV12 different  modifier per-plane
[08:22:13] [PASSED] NV12 with DRM_FORMAT_MOD_SAMSUNG_64_32_TILE
[08:22:13] [PASSED] NV12 Valid modifiers without DRM_MODE_FB_MODIFIERS
[08:22:13] [PASSED] NV12 Modifier for inexistent plane
[08:22:13] [PASSED] NV12 Handle for inexistent plane
[08:22:13] [PASSED] NV12 Handle for inexistent plane without DRM_MODE_FB_MODIFIERS
[08:22:13] [PASSED] YVU420 DRM_MODE_FB_MODIFIERS set without modifier
[08:22:13] [PASSED] YVU420 Normal sizes
[08:22:13] [PASSED] YVU420 Max sizes
[08:22:13] [PASSED] YVU420 Invalid pitch
[08:22:13] [PASSED] YVU420 Different pitches
[08:22:13] [PASSED] YVU420 Different buffer offsets/pitches
[08:22:13] [PASSED] YVU420 Modifier set just for plane 0, without DRM_MODE_FB_MODIFIERS
[08:22:13] [PASSED] YVU420 Modifier set just for planes 0, 1, without DRM_MODE_FB_MODIFIERS
[08:22:13] [PASSED] YVU420 Modifier set just for plane 0, 1, with DRM_MODE_FB_MODIFIERS
[08:22:13] [PASSED] YVU420 Valid modifier
[08:22:13] [PASSED] YVU420 Different modifiers per plane
[08:22:13] [PASSED] YVU420 Modifier for inexistent plane
[08:22:13] [PASSED] X0L2 Normal sizes
[08:22:13] [PASSED] X0L2 Max sizes
[08:22:13] [PASSED] X0L2 Invalid pitch
[08:22:13] [PASSED] X0L2 Pitch greater than minimum required
[08:22:13] [PASSED] X0L2 Handle for inexistent plane
[08:22:13] [PASSED] X0L2 Offset for inexistent plane, without DRM_MODE_FB_MODIFIERS set
[08:22:13] [PASSED] X0L2 Modifier without DRM_MODE_FB_MODIFIERS set
[08:22:13] [PASSED] X0L2 Valid modifier
[08:22:13] [PASSED] X0L2 Modifier for inexistent plane
[08:22:13] =========== [PASSED] drm_test_framebuffer_create ===========
[08:22:13] ================= [PASSED] drm_framebuffer =================
[08:22:13] ================ drm_gem_shmem (8 subtests) ================
[08:22:13] [PASSED] drm_gem_shmem_test_obj_create
[08:22:13] [PASSED] drm_gem_shmem_test_obj_create_private
[08:22:13] [PASSED] drm_gem_shmem_test_pin_pages
[08:22:13] [PASSED] drm_gem_shmem_test_vmap
[08:22:13] [PASSED] drm_gem_shmem_test_get_pages_sgt
[08:22:13] [PASSED] drm_gem_shmem_test_get_sg_table
[08:22:13] [PASSED] drm_gem_shmem_test_madvise
[08:22:13] [PASSED] drm_gem_shmem_test_purge
[08:22:13] ================== [PASSED] drm_gem_shmem ==================
[08:22:13] ================= drm_managed (2 subtests) =================
[08:22:13] [PASSED] drm_test_managed_release_action
[08:22:13] [PASSED] drm_test_managed_run_action
[08:22:13] =================== [PASSED] drm_managed ===================
[08:22:13] =================== drm_mm (6 subtests) ====================
[08:22:13] [PASSED] drm_test_mm_init
[08:22:13] [PASSED] drm_test_mm_debug
[08:22:13] [PASSED] drm_test_mm_align32
[08:22:13] [PASSED] drm_test_mm_align64
[08:22:13] [PASSED] drm_test_mm_lowest
[08:22:13] [PASSED] drm_test_mm_highest
[08:22:13] ===================== [PASSED] drm_mm ======================
[08:22:13] ============= drm_modes_analog_tv (4 subtests) =============
[08:22:13] [PASSED] drm_test_modes_analog_tv_ntsc_480i
[08:22:13] [PASSED] drm_test_modes_analog_tv_ntsc_480i_inlined
[08:22:13] [PASSED] drm_test_modes_analog_tv_pal_576i
[08:22:13] [PASSED] drm_test_modes_analog_tv_pal_576i_inlined
[08:22:13] =============== [PASSED] drm_modes_analog_tv ===============
[08:22:13] ============== drm_plane_helper (2 subtests) ===============
[08:22:13] =============== drm_test_check_plane_state  ================
[08:22:13] [PASSED] clipping_simple
[08:22:13] [PASSED] clipping_rotate_reflect
[08:22:13] [PASSED] positioning_simple
[08:22:13] [PASSED] upscaling
[08:22:13] [PASSED] downscaling
[08:22:13] [PASSED] rounding1
[08:22:13] [PASSED] rounding2
[08:22:13] [PASSED] rounding3
[08:22:13] [PASSED] rounding4
[08:22:13] =========== [PASSED] drm_test_check_plane_state ============
[08:22:13] =========== drm_test_check_invalid_plane_state  ============
[08:22:13] [PASSED] positioning_invalid
[08:22:13] [PASSED] upscaling_invalid
[08:22:13] [PASSED] downscaling_invalid
[08:22:13] ======= [PASSED] drm_test_check_invalid_plane_state ========
[08:22:13] ================ [PASSED] drm_plane_helper =================
[08:22:13] ====== drm_connector_helper_tv_get_modes (1 subtest) =======
[08:22:13] ====== drm_test_connector_helper_tv_get_modes_check  =======
[08:22:13] [PASSED] None
[08:22:13] [PASSED] PAL
[08:22:13] [PASSED] NTSC
[08:22:13] [PASSED] Both, NTSC Default
[08:22:13] [PASSED] Both, PAL Default
[08:22:13] [PASSED] Both, NTSC Default, with PAL on command-line
[08:22:13] [PASSED] Both, PAL Default, with NTSC on command-line
[08:22:13] == [PASSED] drm_test_connector_helper_tv_get_modes_check ===
[08:22:13] ======== [PASSED] drm_connector_helper_tv_get_modes ========
[08:22:13] ================== drm_rect (9 subtests) ===================
[08:22:13] [PASSED] drm_test_rect_clip_scaled_div_by_zero
[08:22:13] [PASSED] drm_test_rect_clip_scaled_not_clipped
[08:22:13] [PASSED] drm_test_rect_clip_scaled_clipped
stty: 'standard input': Inappropriate ioctl for device
[08:22:13] [PASSED] drm_test_rect_clip_scaled_signed_vs_unsigned
[08:22:13] ================= drm_test_rect_intersect  =================
[08:22:13] [PASSED] top-left x bottom-right: 2x2+1+1 x 2x2+0+0
[08:22:13] [PASSED] top-right x bottom-left: 2x2+0+0 x 2x2+1-1
[08:22:13] [PASSED] bottom-left x top-right: 2x2+1-1 x 2x2+0+0
[08:22:13] [PASSED] bottom-right x top-left: 2x2+0+0 x 2x2+1+1
[08:22:13] [PASSED] right x left: 2x1+0+0 x 3x1+1+0
[08:22:13] [PASSED] left x right: 3x1+1+0 x 2x1+0+0
[08:22:13] [PASSED] up x bottom: 1x2+0+0 x 1x3+0-1
[08:22:13] [PASSED] bottom x up: 1x3+0-1 x 1x2+0+0
[08:22:13] [PASSED] touching corner: 1x1+0+0 x 2x2+1+1
[08:22:13] [PASSED] touching side: 1x1+0+0 x 1x1+1+0
[08:22:13] [PASSED] equal rects: 2x2+0+0 x 2x2+0+0
[08:22:13] [PASSED] inside another: 2x2+0+0 x 1x1+1+1
[08:22:13] [PASSED] far away: 1x1+0+0 x 1x1+3+6
[08:22:13] [PASSED] points intersecting: 0x0+5+10 x 0x0+5+10
[08:22:13] [PASSED] points not intersecting: 0x0+0+0 x 0x0+5+10
[08:22:13] ============= [PASSED] drm_test_rect_intersect =============
[08:22:13] ================ drm_test_rect_calc_hscale  ================
[08:22:13] [PASSED] normal use
[08:22:13] [PASSED] out of max range
[08:22:13] [PASSED] out of min range
[08:22:13] [PASSED] zero dst
[08:22:13] [PASSED] negative src
[08:22:13] [PASSED] negative dst
[08:22:13] ============ [PASSED] drm_test_rect_calc_hscale ============
[08:22:13] ================ drm_test_rect_calc_vscale  ================
[08:22:13] [PASSED] normal use
[08:22:13] [PASSED] out of max range
[08:22:13] [PASSED] out of min range
[08:22:13] [PASSED] zero dst
[08:22:13] [PASSED] negative src
[08:22:13] [PASSED] negative dst
[08:22:13] ============ [PASSED] drm_test_rect_calc_vscale ============
[08:22:13] ================== drm_test_rect_rotate  ===================
[08:22:13] [PASSED] reflect-x
[08:22:13] [PASSED] reflect-y
[08:22:13] [PASSED] rotate-0
[08:22:13] [PASSED] rotate-90
[08:22:13] [PASSED] rotate-180
[08:22:13] [PASSED] rotate-270
[08:22:13] ============== [PASSED] drm_test_rect_rotate ===============
[08:22:13] ================ drm_test_rect_rotate_inv  =================
[08:22:13] [PASSED] reflect-x
[08:22:13] [PASSED] reflect-y
[08:22:13] [PASSED] rotate-0
[08:22:13] [PASSED] rotate-90
[08:22:13] [PASSED] rotate-180
[08:22:13] [PASSED] rotate-270
[08:22:13] ============ [PASSED] drm_test_rect_rotate_inv =============
[08:22:13] ==================== [PASSED] drm_rect =====================
[08:22:13] ============================================================
[08:22:13] Testing complete. Ran 417 tests: passed: 417
[08:22:13] Elapsed time: 23.726s total, 1.716s configuring, 21.838s building, 0.151s running

+ cleanup
++ stat -c %u:%g /kernel
+ chown -R 1003:1003 /kernel

#25 lore raw

✓ CI.Patch_applied: success for xe bo shrinker and exhaustive eviction (rev2)

In reply to Thomas Hellström
== Series Details ==

== Series Details ==

Series: xe bo shrinker and exhaustive eviction (rev2)
URL : https://patchwork.freedesktop.org/series/133643/
State : success

== Summary ==

=== Applying kernel patches on branch 'drm-tip' with base: ===
Base commit: d98c9eae8405 drm-tip: 2024y-05m-15d-12h-51m-18s UTC integration manifest === git am output follows ===
.git/rebase-apply/patch:123: trailing whitespace.

warning: 1 line adds whitespace errors.
.git/rebase-apply/patch:144: trailing whitespace.

warning: 1 line adds whitespace errors.
.git/rebase-apply/patch:139: trailing whitespace.

.git/rebase-apply/patch:165: trailing whitespace.

	} else {	

.git/rebase-apply/patch:174: trailing whitespace.

.git/rebase-apply/patch:180: trailing whitespace.

.git/rebase-apply/patch:222: trailing whitespace.

	} else {	

warning: squelched 4 whitespace errors
warning: 9 lines add whitespace errors.
.git/rebase-apply/patch:47: trailing whitespace.

.git/rebase-apply/patch:62: trailing whitespace.

	exec->snap = snap;	

warning: 2 lines add whitespace errors.
.git/rebase-apply/patch:51: trailing whitespace.

warning: 1 line adds whitespace errors.
.git/rebase-apply/patch:267: trailing whitespace.

warning: 1 line adds whitespace errors.
Applying: drm/ttm: Allow TTM LRU list nodes of different types
Applying: drm/ttm: Slightly clean up LRU list iteration
Applying: drm/ttm: Use LRU hitches
Applying: drm/ttm, drm/amdgpu, drm/xe: Consider hitch moves within bulk sublist moves
Applying: drm/exec: Rework contended locking
Applying: drm/ttm: Provide a generic LRU walker helper
Applying: drm/ttm: Use restartable LRU and sleeping locks for swapping.
Applying: drm/ttm: sleeping evict lock.
Applying: drm/ttm: Add a virtual base class for graphics memory backup
Applying: drm/ttm/pool: Provide a helper to shrink pages.
Applying: drm/ttm: Use fault-injection to test error paths
Applying: drm/ttm, drm/xe: Add a shrinker for xe bos
Applying: dma-buf/dma-resv: Introduce dma_resv_trylock_ctx()
Applying: drm/exec: drm_exec_trylock()
Applying: drm/exec: Add a snapshot capability.
Applying: drm/exec: Introduce an evict mode
Applying: drm/ttm: Support drm_exec locking for eviction and swapping
Applying: drm/ttm: Convert ttm vm to using drm_exec.
Applying: drm/xe: Use drm_exec for fault locking
Applying: drm/ttm: Use drm_exec_trylock for bo initialization
Applying: drm/xe: Initial support for drm exec locking during validate.

#26 lore raw

✗ CI.checkpatch: warning for xe bo shrinker and exhaustive eviction (rev2)

In reply to Thomas Hellström
== Series Details ==

== Series Details ==

Series: xe bo shrinker and exhaustive eviction (rev2)
URL : https://patchwork.freedesktop.org/series/133643/
State : warning

== Summary ==

+ KERNEL=/kernel
+ git clone https://gitlab.freedesktop.org/drm/maintainer-tools mt Cloning into 'mt'...
warning: redirecting to https://gitlab.freedesktop.org/drm/maintainer-tools.git/
+ git -C mt rev-list -n1 origin/master 57b97a66dd129aea93991dc66cd10477f7a05cf8
+ cd /kernel
+ git config --global --add safe.directory /kernel
+ git log -n1
commit 816bd048bcc3def8f7f86e6e511dd9b73267d7ae

Author: Thomas Hellström <[email protected]>
Date:   Wed May 15 10:14:49 2024 +0200

drm/xe: Initial support for drm exec locking during validate.

+ /mt/dim checkpatch d98c9eae84056cb2d86293c145234017681f09f4 drm-intel b53fc38fd1a3 drm/ttm: Allow TTM LRU list nodes of different types b976b7e553b8 drm/ttm: Slightly clean up LRU list iteration
bd87efb68891 drm/ttm: Use LRU hitches
6f6a0f5276ac drm/ttm, drm/amdgpu, drm/xe: Consider hitch moves within bulk sublist moves 785e3b5fe252 drm/exec: Rework contended locking
-:10: WARNING:COMMIT_MESSAGE: Missing commit description - Add an appropriate one

-:436: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'exec' - possible side-effects? #436: FILE: include/drm/drm_exec.h:122:
+#define drm_exec_retry_on_contention(exec, _ret) \
+ ({ \
+ int __ret = (_ret); \
+ \
+ if (unlikely(drm_exec_is_contended(exec))) { \
+ WARN_ON(__ret != -EDEADLK); \
+ __ret = drm_exec_handle_contended(exec); \
+ if (!__ret) \
+ goto *__drm_exec_retry_ptr; \
+ } \
+ __ret; \
+ })

-:436: WARNING:MACRO_WITH_FLOW_CONTROL: Macros with flow control statements should be avoided #436: FILE: include/drm/drm_exec.h:122:
+#define drm_exec_retry_on_contention(exec, _ret) \
+ ({ \
+ int __ret = (_ret); \
+ \
+ if (unlikely(drm_exec_is_contended(exec))) { \
+ WARN_ON(__ret != -EDEADLK); \
+ __ret = drm_exec_handle_contended(exec); \
+ if (!__ret) \
+ goto *__drm_exec_retry_ptr; \
+ } \
+ __ret; \
+ })

total: 0 errors, 2 warnings, 1 checks, 356 lines checked 40dba2cbbaad drm/ttm: Provide a generic LRU walker helper
-:128: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #128: FILE: drivers/gpu/drm/ttm/ttm_bo_util.c:867:
+long ttm_lru_walk_for_evict(struct ttm_lru_walk *walk, struct ttm_device *bdev,
+ struct ttm_resource_manager *man, long target)

-:141: ERROR:TRAILING_WHITESPACE: trailing whitespace #141: FILE: drivers/gpu/drm/ttm/ttm_bo_util.c:880:
+^I^I$

total: 1 errors, 0 warnings, 1 checks, 203 lines checked 8a9857d1267d drm/ttm: Use restartable LRU and sleeping locks for swapping. -:10: WARNING:COMMIT_MESSAGE: Missing commit description - Add an appropriate one

-:21: CHECK:LINE_SPACING: Please don't use multiple blank lines #21: FILE: drivers/gpu/drm/ttm/ttm_bo.c:1121:

+

-:148: ERROR:TRAILING_WHITESPACE: trailing whitespace #148: FILE: drivers/gpu/drm/ttm/ttm_bo.c:1232:
+^I$

total: 1 errors, 1 warnings, 1 checks, 187 lines checked c115d4a9c336 drm/ttm: sleeping evict lock.
-:10: WARNING:COMMIT_MESSAGE: Missing commit description - Add an appropriate one

-:142: ERROR:TRAILING_WHITESPACE: trailing whitespace #142: FILE: drivers/gpu/drm/ttm/ttm_bo.c:441:
+^I$

-:168: ERROR:TRAILING_WHITESPACE: trailing whitespace #168: FILE: drivers/gpu/drm/ttm/ttm_bo.c:460:
+^I} else {^I$

-:177: ERROR:TRAILING_WHITESPACE: trailing whitespace #177: FILE: drivers/gpu/drm/ttm/ttm_bo.c:468:
+^I$

-:183: ERROR:TRAILING_WHITESPACE: trailing whitespace #183: FILE: drivers/gpu/drm/ttm/ttm_bo.c:474:
+^I^I$

-:225: ERROR:TRAILING_WHITESPACE: trailing whitespace #225: FILE: drivers/gpu/drm/ttm/ttm_bo.c:496:
+^I} else {^I$

-:244: ERROR:TRAILING_WHITESPACE: trailing whitespace #244: FILE: drivers/gpu/drm/ttm/ttm_bo.c:507:
+^Iif (lret == 0) $

-:251: ERROR:TRAILING_WHITESPACE: trailing whitespace #251: FILE: drivers/gpu/drm/ttm/ttm_bo.c:514:
+^I$

-:384: ERROR:TRAILING_WHITESPACE: trailing whitespace #384: FILE: drivers/gpu/drm/ttm/ttm_bo.c:683:
+^I^I^I^Ireturn ret;^I^I$

-:461: ERROR:TRAILING_WHITESPACE: trailing whitespace #461: FILE: drivers/gpu/drm/ttm/ttm_resource.c:516:
+^I$

total: 9 errors, 1 warnings, 0 checks, 448 lines checked
25ab02e4b174 drm/ttm: Add a virtual base class for graphics memory backup Traceback (most recent call last):
File "scripts/spdxcheck.py", line 6, in <module>
from ply import lex, yacc
ModuleNotFoundError: No module named 'ply'
Traceback (most recent call last):
File "scripts/spdxcheck.py", line 6, in <module>
from ply import lex, yacc
ModuleNotFoundError: No module named 'ply'
-:41: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #41:
new file mode 100644

total: 0 errors, 1 warnings, 0 checks, 281 lines checked
0ba8a60aad0b drm/ttm/pool: Provide a helper to shrink pages.
3e030e48aa27 drm/ttm: Use fault-injection to test error paths
-:27: WARNING:CONFIG_DESCRIPTION: please write a help paragraph that fully describes the config symbol #27: FILE: drivers/gpu/drm/Kconfig:261:
+config DRM_TTM_BACKUP_FAULT_INJECT
+ bool "Enable fault injection during TTM backup"
+ depends on DRM_TTM
+ default n
+ help
+ Inject recoverable failures during TTM backup and recovery of
+ backed-up objects. For DRM driver developers only.
+
+ If in doubt, choose N.
+

total: 0 errors, 1 warnings, 0 checks, 51 lines checked
ea19135e331f drm/ttm, drm/xe: Add a shrinker for xe bos
Traceback (most recent call last):
File "scripts/spdxcheck.py", line 6, in <module>
from ply import lex, yacc
ModuleNotFoundError: No module named 'ply'
Traceback (most recent call last):
File "scripts/spdxcheck.py", line 6, in <module>
from ply import lex, yacc
ModuleNotFoundError: No module named 'ply'
-:616: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #616:
new file mode 100644

total: 0 errors, 1 warnings, 0 checks, 781 lines checked 1b8d3569e682 dma-buf/dma-resv: Introduce dma_resv_trylock_ctx() -:24: CHECK:LINE_SPACING: Please don't use multiple blank lines #24: FILE: include/linux/dma-resv.h:408:

+

total: 0 errors, 0 warnings, 1 checks, 37 lines checked
23caf5ab23b0 drm/exec: drm_exec_trylock()
-:10: WARNING:COMMIT_MESSAGE: Missing commit description - Add an appropriate one

total: 0 errors, 1 warnings, 0 checks, 51 lines checked
f13a9f0b8aba drm/exec: Add a snapshot capability.
-:10: WARNING:COMMIT_MESSAGE: Missing commit description - Add an appropriate one

-:52: ERROR:TRAILING_WHITESPACE: trailing whitespace #52: FILE: drivers/gpu/drm/drm_exec.c:403:
+^I$

-:67: ERROR:TRAILING_WHITESPACE: trailing whitespace #67: FILE: drivers/gpu/drm/drm_exec.c:418:
+^Iexec->snap = snap;^I$

-:103: CHECK:LINE_SPACING: Please don't use multiple blank lines #103: FILE: include/drm/drm_exec.h:153:

+

total: 2 errors, 1 warnings, 1 checks, 91 lines checked 5b400f926ea2 drm/exec: Introduce an evict mode -:72: CHECK:SPACING: No space is necessary after a cast #72: FILE: drivers/gpu/drm/drm_exec.c:150:
+ return (unsigned long) resv / __alignof__(typeof(*resv));

-:107: CHECK:SPACING: No space is necessary after a cast #107: FILE: drivers/gpu/drm/drm_exec.c:197:
+ (void) xa_store(&exec->resv_set, drm_exec_resv_to_key(obj->resv),

total: 0 errors, 0 warnings, 2 checks, 177 lines checked 607317448e8e drm/ttm: Support drm_exec locking for eviction and swapping -:8: WARNING:COMMIT_MESSAGE: Missing commit description - Add an appropriate one

-:51: ERROR:TRAILING_WHITESPACE: trailing whitespace #51: FILE: drivers/gpu/drm/ttm/ttm_bo.c:779:
+ $

-:51: WARNING:LEADING_SPACE: please, no spaces at the start of a line #51: FILE: drivers/gpu/drm/ttm/ttm_bo.c:779:
+ $

-:186: ERROR:CODE_INDENT: code indent should use tabs where possible #186: FILE: drivers/gpu/drm/ttm/ttm_bo_util.c:926:
+^I^I^I lret = ttm_lru_walk_execlock(walk, bo);$

-:236: ERROR:MISSING_SIGN_OFF: Missing Signed-off-by: line(s)

total: 3 errors, 2 warnings, 0 checks, 202 lines checked 9a76699c1e77 drm/ttm: Convert ttm vm to using drm_exec.
-:10: WARNING:COMMIT_MESSAGE: Missing commit description - Add an appropriate one

-:266: ERROR:TRAILING_WHITESPACE: trailing whitespace #266: FILE: drivers/gpu/drm/ttm/ttm_bo_vm.c:354:
+^I$

total: 1 errors, 1 warnings, 0 checks, 302 lines checked 8109386bdd69 drm/xe: Use drm_exec for fault locking
-:10: WARNING:COMMIT_MESSAGE: Missing commit description - Add an appropriate one

total: 0 errors, 1 warnings, 0 checks, 60 lines checked
eec6f163cfa6 drm/ttm: Use drm_exec_trylock for bo initialization 816bd048bcc3 drm/xe: Initial support for drm exec locking during validate. -:10: WARNING:COMMIT_MESSAGE: Missing commit description - Add an appropriate one

total: 0 errors, 1 warnings, 0 checks, 142 lines checked

#27 lore raw

✓ CI.KUnit: success for xe bo shrinker and exhaustive eviction (rev2)

In reply to Thomas Hellström
== Series Details ==

== Series Details ==

Series: xe bo shrinker and exhaustive eviction (rev2)
URL : https://patchwork.freedesktop.org/series/133643/
State : success

== Summary ==

+ trap cleanup EXIT
+ /kernel/tools/testing/kunit/kunit.py run --kunitconfig /kernel/drivers/gpu/drm/xe/.kunitconfig [14:54:15] Configuring KUnit Kernel ...
Generating .config ...
Populating config with:

$ make ARCH=um O=.kunit olddefconfig
[14:54:20] Building KUnit Kernel ...
Populating config with:
$ make ARCH=um O=.kunit olddefconfig
Building with:
$ make ARCH=um O=.kunit --jobs=48
../arch/x86/um/user-offsets.c:17:6: warning: no previous prototype for ‘foo’ [-Wmissing-prototypes]
   17 | void foo(void)
      |      ^~~
In file included from ../arch/um/kernel/asm-offsets.c:1:
../arch/x86/um/shared/sysdep/kernel-offsets.h:9:6: warning: no previous prototype for ‘foo’ [-Wmissing-prototypes]
    9 | void foo(void)
      |      ^~~
../arch/x86/um/bugs_64.c:9:6: warning: no previous prototype for ‘arch_check_bugs’ [-Wmissing-prototypes]
    9 | void arch_check_bugs(void)
      |      ^~~~~~~~~~~~~~~
../arch/x86/um/bugs_64.c:13:6: warning: no previous prototype for ‘arch_examine_signal’ [-Wmissing-prototypes]
   13 | void arch_examine_signal(int sig, struct uml_pt_regs *regs)
      |      ^~~~~~~~~~~~~~~~~~~
../arch/x86/um/fault.c:18:5: warning: no previous prototype for ‘arch_fixup’ [-Wmissing-prototypes]
   18 | int arch_fixup(unsigned long address, struct uml_pt_regs *regs)
      |     ^~~~~~~~~~
../arch/x86/um/os-Linux/registers.c:146:15: warning: no previous prototype for ‘get_thread_reg’ [-Wmissing-prototypes]
  146 | unsigned long get_thread_reg(int reg, jmp_buf *buf)
      |               ^~~~~~~~~~~~~~
../arch/x86/um/vdso/um_vdso.c:16:5: warning: no previous prototype for ‘__vdso_clock_gettime’ [-Wmissing-prototypes]
   16 | int __vdso_clock_gettime(clockid_t clock, struct __kernel_old_timespec *ts)
      |     ^~~~~~~~~~~~~~~~~~~~
../arch/x86/um/vdso/um_vdso.c:30:5: warning: no previous prototype for ‘__vdso_gettimeofday’ [-Wmissing-prototypes]
   30 | int __vdso_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz)
      |     ^~~~~~~~~~~~~~~~~~~
../arch/x86/um/vdso/um_vdso.c:44:21: warning: no previous prototype for ‘__vdso_time’ [-Wmissing-prototypes]
   44 | __kernel_old_time_t __vdso_time(__kernel_old_time_t *t)
      |                     ^~~~~~~~~~~
../arch/x86/um/vdso/um_vdso.c:57:1: warning: no previous prototype for ‘__vdso_getcpu’ [-Wmissing-prototypes]
   57 | __vdso_getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *unused)
      | ^~~~~~~~~~~~~
../arch/x86/um/os-Linux/mcontext.c:7:6: warning: no previous prototype for ‘get_regs_from_mc’ [-Wmissing-prototypes]
    7 | void get_regs_from_mc(struct uml_pt_regs *regs, mcontext_t *mc)
      |      ^~~~~~~~~~~~~~~~
../arch/um/os-Linux/skas/process.c:107:6: warning: no previous prototype for ‘wait_stub_done’ [-Wmissing-prototypes]
  107 | void wait_stub_done(int pid)
      |      ^~~~~~~~~~~~~~
../arch/um/os-Linux/skas/process.c:683:6: warning: no previous prototype for ‘__switch_mm’ [-Wmissing-prototypes]
  683 | void __switch_mm(struct mm_id *mm_idp)
      |      ^~~~~~~~~~~
../arch/um/os-Linux/main.c:187:7: warning: no previous prototype for ‘__wrap_malloc’ [-Wmissing-prototypes]
  187 | void *__wrap_malloc(int size)
      |       ^~~~~~~~~~~~~
../arch/um/os-Linux/main.c:208:7: warning: no previous prototype for ‘__wrap_calloc’ [-Wmissing-prototypes]
  208 | void *__wrap_calloc(int n, int size)
      |       ^~~~~~~~~~~~~
../arch/um/os-Linux/main.c:222:6: warning: no previous prototype for ‘__wrap_free’ [-Wmissing-prototypes]
  222 | void __wrap_free(void *ptr)
      |      ^~~~~~~~~~~
../arch/x86/um/ptrace_64.c:111:5: warning: no previous prototype for ‘poke_user’ [-Wmissing-prototypes]
  111 | int poke_user(struct task_struct *child, long addr, long data)
      |     ^~~~~~~~~
../arch/x86/um/ptrace_64.c:171:5: warning: no previous prototype for ‘peek_user’ [-Wmissing-prototypes]
  171 | int peek_user(struct task_struct *child, long addr, long data)
      |     ^~~~~~~~~
../arch/um/kernel/skas/mmu.c:17:5: warning: no previous prototype for ‘init_new_context’ [-Wmissing-prototypes]
   17 | int init_new_context(struct task_struct *task, struct mm_struct *mm)
      |     ^~~~~~~~~~~~~~~~
../arch/um/kernel/skas/mmu.c:60:6: warning: no previous prototype for ‘destroy_context’ [-Wmissing-prototypes]
   60 | void destroy_context(struct mm_struct *mm)
      |      ^~~~~~~~~~~~~~~
../arch/um/os-Linux/mem.c:28:6: warning: no previous prototype for ‘kasan_map_memory’ [-Wmissing-prototypes]
   28 | void kasan_map_memory(void *start, size_t len)
      |      ^~~~~~~~~~~~~~~~
../arch/um/os-Linux/mem.c:212:13: warning: no previous prototype for ‘check_tmpexec’ [-Wmissing-prototypes]
  212 | void __init check_tmpexec(void)
      |             ^~~~~~~~~~~~~
../arch/um/os-Linux/signal.c:75:6: warning: no previous prototype for ‘sig_handler’ [-Wmissing-prototypes]
   75 | void sig_handler(int sig, struct siginfo *si, mcontext_t *mc)
      |      ^~~~~~~~~~~
../arch/um/os-Linux/signal.c:111:6: warning: no previous prototype for ‘timer_alarm_handler’ [-Wmissing-prototypes]
  111 | void timer_alarm_handler(int sig, struct siginfo *unused_si, mcontext_t *mc)
      |      ^~~~~~~~~~~~~~~~~~~
../arch/um/os-Linux/start_up.c:301:12: warning: no previous prototype for ‘parse_iomem’ [-Wmissing-prototypes]
  301 | int __init parse_iomem(char *str, int *add)
      |            ^~~~~~~~~~~
../arch/um/kernel/skas/process.c:36:12: warning: no previous prototype for ‘start_uml’ [-Wmissing-prototypes]
   36 | int __init start_uml(void)
      |            ^~~~~~~~~
../arch/x86/um/signal.c:560:6: warning: no previous prototype for ‘sys_rt_sigreturn’ [-Wmissing-prototypes]
  560 | long sys_rt_sigreturn(void)
      |      ^~~~~~~~~~~~~~~~
../arch/um/kernel/mem.c:202:8: warning: no previous prototype for ‘pgd_alloc’ [-Wmissing-prototypes]
  202 | pgd_t *pgd_alloc(struct mm_struct *mm)
      |        ^~~~~~~~~
../arch/um/kernel/mem.c:215:7: warning: no previous prototype for ‘uml_kmalloc’ [-Wmissing-prototypes]
  215 | void *uml_kmalloc(int size, int flags)
      |       ^~~~~~~~~~~
../arch/x86/um/syscalls_64.c:48:6: warning: no previous prototype for ‘arch_switch_to’ [-Wmissing-prototypes]
   48 | void arch_switch_to(struct task_struct *to)
      |      ^~~~~~~~~~~~~~
../arch/um/kernel/process.c:51:5: warning: no previous prototype for ‘pid_to_processor_id’ [-Wmissing-prototypes]
   51 | int pid_to_processor_id(int pid)
      |     ^~~~~~~~~~~~~~~~~~~
../arch/um/kernel/process.c:87:7: warning: no previous prototype for ‘__switch_to’ [-Wmissing-prototypes]
   87 | void *__switch_to(struct task_struct *from, struct task_struct *to)
      |       ^~~~~~~~~~~
../arch/um/kernel/process.c:140:6: warning: no previous prototype for ‘fork_handler’ [-Wmissing-prototypes]
  140 | void fork_handler(void)
      |      ^~~~~~~~~~~~
../arch/um/kernel/process.c:217:6: warning: no previous prototype for ‘arch_cpu_idle’ [-Wmissing-prototypes]
  217 | void arch_cpu_idle(void)
      |      ^~~~~~~~~~~~~
../arch/um/kernel/process.c:253:5: warning: no previous prototype for ‘copy_to_user_proc’ [-Wmissing-prototypes]
  253 | int copy_to_user_proc(void __user *to, void *from, int size)
      |     ^~~~~~~~~~~~~~~~~
../arch/um/kernel/process.c:263:5: warning: no previous prototype for ‘clear_user_proc’ [-Wmissing-prototypes]
  263 | int clear_user_proc(void __user *buf, int size)
      |     ^~~~~~~~~~~~~~~
../arch/um/kernel/process.c:271:6: warning: no previous prototype for ‘set_using_sysemu’ [-Wmissing-prototypes]
  271 | void set_using_sysemu(int value)
      |      ^~~~~~~~~~~~~~~~
../arch/um/kernel/process.c:278:5: warning: no previous prototype for ‘get_using_sysemu’ [-Wmissing-prototypes]
  278 | int get_using_sysemu(void)
      |     ^~~~~~~~~~~~~~~~
../arch/um/kernel/process.c:316:12: warning: no previous prototype for ‘make_proc_sysemu’ [-Wmissing-prototypes]
  316 | int __init make_proc_sysemu(void)
      |            ^~~~~~~~~~~~~~~~
../arch/um/kernel/process.c:348:15: warning: no previous prototype for ‘arch_align_stack’ [-Wmissing-prototypes]
  348 | unsigned long arch_align_stack(unsigned long sp)
      |               ^~~~~~~~~~~~~~~~
../arch/um/kernel/reboot.c:45:6: warning: no previous prototype for ‘machine_restart’ [-Wmissing-prototypes]
   45 | void machine_restart(char * __unused)
      |      ^~~~~~~~~~~~~~~
../arch/um/kernel/reboot.c:51:6: warning: no previous prototype for ‘machine_power_off’ [-Wmissing-prototypes]
   51 | void machine_power_off(void)
      |      ^~~~~~~~~~~~~~~~~
../arch/um/kernel/reboot.c:57:6: warning: no previous prototype for ‘machine_halt’ [-Wmissing-prototypes]
   57 | void machine_halt(void)
      |      ^~~~~~~~~~~~
../arch/um/kernel/tlb.c:579:6: warning: no previous prototype for ‘flush_tlb_mm_range’ [-Wmissing-prototypes]
  579 | void flush_tlb_mm_range(struct mm_struct *mm, unsigned long start,
      |      ^~~~~~~~~~~~~~~~~~
../arch/um/kernel/tlb.c:594:6: warning: no previous prototype for ‘force_flush_all’ [-Wmissing-prototypes]
  594 | void force_flush_all(void)
      |      ^~~~~~~~~~~~~~~
../arch/um/kernel/kmsg_dump.c:60:12: warning: no previous prototype for ‘kmsg_dumper_stdout_init’ [-Wmissing-prototypes]
   60 | int __init kmsg_dumper_stdout_init(void)
      |            ^~~~~~~~~~~~~~~~~~~~~~~
../arch/um/kernel/um_arch.c:408:19: warning: no previous prototype for ‘read_initrd’ [-Wmissing-prototypes]
  408 | int __init __weak read_initrd(void)
      |                   ^~~~~~~~~~~
../arch/um/kernel/um_arch.c:461:7: warning: no previous prototype for ‘text_poke’ [-Wmissing-prototypes]
  461 | void *text_poke(void *addr, const void *opcode, size_t len)
      |       ^~~~~~~~~
../arch/um/kernel/um_arch.c:473:6: warning: no previous prototype for ‘text_poke_sync’ [-Wmissing-prototypes]
  473 | void text_poke_sync(void)
      |      ^~~~~~~~~~~~~~
../lib/iomap.c:156:5: warning: no previous prototype for ‘ioread64_lo_hi’ [-Wmissing-prototypes]
  156 | u64 ioread64_lo_hi(const void __iomem *addr)
      |     ^~~~~~~~~~~~~~
../lib/iomap.c:163:5: warning: no previous prototype for ‘ioread64_hi_lo’ [-Wmissing-prototypes]
  163 | u64 ioread64_hi_lo(const void __iomem *addr)
      |     ^~~~~~~~~~~~~~
../lib/iomap.c:170:5: warning: no previous prototype for ‘ioread64be_lo_hi’ [-Wmissing-prototypes]
  170 | u64 ioread64be_lo_hi(const void __iomem *addr)
      |     ^~~~~~~~~~~~~~~~
../lib/iomap.c:178:5: warning: no previous prototype for ‘ioread64be_hi_lo’ [-Wmissing-prototypes]
  178 | u64 ioread64be_hi_lo(const void __iomem *addr)
      |     ^~~~~~~~~~~~~~~~
../lib/iomap.c:264:6: warning: no previous prototype for ‘iowrite64_lo_hi’ [-Wmissing-prototypes]
  264 | void iowrite64_lo_hi(u64 val, void __iomem *addr)
      |      ^~~~~~~~~~~~~~~
../lib/iomap.c:272:6: warning: no previous prototype for ‘iowrite64_hi_lo’ [-Wmissing-prototypes]
  272 | void iowrite64_hi_lo(u64 val, void __iomem *addr)
      |      ^~~~~~~~~~~~~~~
../lib/iomap.c:280:6: warning: no previous prototype for ‘iowrite64be_lo_hi’ [-Wmissing-prototypes]
  280 | void iowrite64be_lo_hi(u64 val, void __iomem *addr)
      |      ^~~~~~~~~~~~~~~~~
../lib/iomap.c:288:6: warning: no previous prototype for ‘iowrite64be_hi_lo’ [-Wmissing-prototypes]
  288 | void iowrite64be_hi_lo(u64 val, void __iomem *addr)
      |      ^~~~~~~~~~~~~~~~~
stty: 'standard input': Inappropriate ioctl for device

[14:54:45] Starting KUnit Kernel (1/1)...
[14:54:45] ============================================================ Running tests with:

$ .kunit/linux kunit.enable=1 mem=1G console=tty kunit_shutdown=halt
[14:54:45] =================== guc_dbm (7 subtests) ===================
[14:54:45] [PASSED] test_empty
[14:54:45] [PASSED] test_default
[14:54:45] ======================== test_size  ========================
[14:54:45] [PASSED] 4
[14:54:45] [PASSED] 8
[14:54:45] [PASSED] 32
[14:54:45] [PASSED] 256
[14:54:45] ==================== [PASSED] test_size ====================
[14:54:45] ======================= test_reuse  ========================
[14:54:45] [PASSED] 4
[14:54:45] [PASSED] 8
[14:54:45] [PASSED] 32
[14:54:45] [PASSED] 256
[14:54:45] =================== [PASSED] test_reuse ====================
[14:54:45] =================== test_range_overlap  ====================
[14:54:45] [PASSED] 4
[14:54:45] [PASSED] 8
[14:54:45] [PASSED] 32
[14:54:45] [PASSED] 256
[14:54:45] =============== [PASSED] test_range_overlap ================
[14:54:45] =================== test_range_compact  ====================
[14:54:45] [PASSED] 4
[14:54:45] [PASSED] 8
[14:54:45] [PASSED] 32
[14:54:45] [PASSED] 256
[14:54:45] =============== [PASSED] test_range_compact ================
[14:54:45] ==================== test_range_spare  =====================
[14:54:45] [PASSED] 4
[14:54:45] [PASSED] 8
[14:54:45] [PASSED] 32
[14:54:45] [PASSED] 256
[14:54:45] ================ [PASSED] test_range_spare =================
[14:54:45] ===================== [PASSED] guc_dbm =====================
[14:54:45] =================== guc_idm (6 subtests) ===================
[14:54:45] [PASSED] bad_init
[14:54:45] [PASSED] no_init
[14:54:45] [PASSED] init_fini
[14:54:45] [PASSED] check_used
[14:54:45] [PASSED] check_quota
[14:54:45] [PASSED] check_all
[14:54:45] ===================== [PASSED] guc_idm =====================
[14:54:45] ================== no_relay (3 subtests) ===================
[14:54:45] [PASSED] xe_drops_guc2pf_if_not_ready
[14:54:45] [PASSED] xe_drops_guc2vf_if_not_ready
[14:54:45] [PASSED] xe_rejects_send_if_not_ready
[14:54:45] ==================== [PASSED] no_relay =====================
[14:54:45] ================== pf_relay (14 subtests) ==================
[14:54:45] [PASSED] pf_rejects_guc2pf_too_short
[14:54:45] [PASSED] pf_rejects_guc2pf_too_long
[14:54:45] [PASSED] pf_rejects_guc2pf_no_payload
[14:54:45] [PASSED] pf_fails_no_payload
[14:54:45] [PASSED] pf_fails_bad_origin
[14:54:45] [PASSED] pf_fails_bad_type
[14:54:45] [PASSED] pf_txn_reports_error
[14:54:45] [PASSED] pf_txn_sends_pf2guc
[14:54:45] [PASSED] pf_sends_pf2guc
[14:54:45] [SKIPPED] pf_loopback_nop
[14:54:45] [SKIPPED] pf_loopback_echo
[14:54:45] [SKIPPED] pf_loopback_fail
[14:54:45] [SKIPPED] pf_loopback_busy
[14:54:45] [SKIPPED] pf_loopback_retry
[14:54:45] ==================== [PASSED] pf_relay =====================
[14:54:45] ================== vf_relay (3 subtests) ===================
[14:54:45] [PASSED] vf_rejects_guc2vf_too_short
[14:54:45] [PASSED] vf_rejects_guc2vf_too_long
[14:54:45] [PASSED] vf_rejects_guc2vf_no_payload
[14:54:45] ==================== [PASSED] vf_relay =====================
[14:54:45] ================= pf_service (11 subtests) =================
[14:54:45] [PASSED] pf_negotiate_any
[14:54:45] [PASSED] pf_negotiate_base_match
[14:54:45] [PASSED] pf_negotiate_base_newer
[14:54:45] [PASSED] pf_negotiate_base_next
[14:54:45] [SKIPPED] pf_negotiate_base_older
[14:54:45] [PASSED] pf_negotiate_base_prev
[14:54:45] [PASSED] pf_negotiate_latest_match
[14:54:45] [PASSED] pf_negotiate_latest_newer
[14:54:45] [PASSED] pf_negotiate_latest_next
[14:54:45] [SKIPPED] pf_negotiate_latest_older
[14:54:45] [SKIPPED] pf_negotiate_latest_prev
[14:54:45] =================== [PASSED] pf_service ====================
[14:54:45] ===================== lmtt (1 subtest) =====================
[14:54:45] ======================== test_ops  =========================
[14:54:45] [PASSED] 2-level
[14:54:45] [PASSED] multi-level
[14:54:45] ==================== [PASSED] test_ops =====================
[14:54:45] ====================== [PASSED] lmtt =======================
[14:54:45] ==================== xe_bo (3 subtests) ====================
[14:54:45] [SKIPPED] xe_ccs_migrate_kunit
[14:54:45] [SKIPPED] xe_bo_evict_kunit
[14:54:45] [SKIPPED] xe_bo_shrink_kunit
[14:54:45] ===================== [SKIPPED] xe_bo ======================
[14:54:45] ================== xe_dma_buf (1 subtest) ==================
[14:54:45] [SKIPPED] xe_dma_buf_kunit
[14:54:45] =================== [SKIPPED] xe_dma_buf ===================
[14:54:45] ================== xe_migrate (1 subtest) ==================
[14:54:45] [SKIPPED] xe_migrate_sanity_kunit
[14:54:45] =================== [SKIPPED] xe_migrate ===================
[14:54:45] =================== xe_mocs (2 subtests) ===================
[14:54:45] [SKIPPED] xe_live_mocs_kernel_kunit
[14:54:45] [SKIPPED] xe_live_mocs_reset_kunit
[14:54:45] ==================== [SKIPPED] xe_mocs =====================
[14:54:45] ==================== args (11 subtests) ====================
[14:54:45] [PASSED] count_args_test
[14:54:45] [PASSED] call_args_example
[14:54:45] [PASSED] call_args_test
[14:54:45] [PASSED] drop_first_arg_example
[14:54:45] [PASSED] drop_first_arg_test
[14:54:45] [PASSED] first_arg_example
[14:54:45] [PASSED] first_arg_test
[14:54:45] [PASSED] last_arg_example
[14:54:45] [PASSED] last_arg_test
[14:54:45] [PASSED] pick_arg_example
[14:54:45] [PASSED] sep_comma_example
[14:54:45] ====================== [PASSED] args =======================
[14:54:45] =================== xe_pci (2 subtests) ====================
[14:54:45] [PASSED] xe_gmdid_graphics_ip
[14:54:45] [PASSED] xe_gmdid_media_ip
[14:54:45] ===================== [PASSED] xe_pci ======================
[14:54:45] ==================== xe_rtp (1 subtest) ====================
[14:54:45] ================== xe_rtp_process_tests  ===================
[14:54:45] [PASSED] coalesce-same-reg
[14:54:45] [PASSED] no-match-no-add
[14:54:45] [PASSED] no-match-no-add-multiple-rules
[14:54:45] [PASSED] two-regs-two-entries
[14:54:45] [PASSED] clr-one-set-other
[14:54:45] [PASSED] set-field
[14:54:45] [PASSED] conflict-duplicate
[14:54:45] [PASSED] conflict-not-disjoint
[14:54:45] [PASSED] conflict-reg-type
[14:54:45] ============== [PASSED] xe_rtp_process_tests ===============
[14:54:45] ===================== [PASSED] xe_rtp ======================
[14:54:45] ==================== xe_wa (1 subtest) =====================
[14:54:45] ======================== xe_wa_gt  =========================
[14:54:45] [PASSED] TIGERLAKE (B0)
[14:54:45] [PASSED] DG1 (A0)
[14:54:45] [PASSED] DG1 (B0)
[14:54:45] [PASSED] ALDERLAKE_S (A0)
[14:54:45] [PASSED] ALDERLAKE_S (B0)
[14:54:45] [PASSED] ALDERLAKE_S (C0)
[14:54:45] [PASSED] ALDERLAKE_S (D0)
[14:54:45] [PASSED] ALDERLAKE_P (A0)
[14:54:45] [PASSED] ALDERLAKE_P (B0)
[14:54:45] [PASSED] ALDERLAKE_P (C0)
[14:54:45] [PASSED] ALDERLAKE_S_RPLS (D0)
[14:54:45] [PASSED] ALDERLAKE_P_RPLU (E0)
[14:54:45] [PASSED] DG2_G10 (C0)
[14:54:45] [PASSED] DG2_G11 (B1)
[14:54:45] [PASSED] DG2_G12 (A1)
[14:54:45] [PASSED] METEORLAKE (g:A0, m:A0)
[14:54:45] [PASSED] METEORLAKE (g:A0, m:A0)
[14:54:45] [PASSED] METEORLAKE (g:A0, m:A0)
[14:54:45] [PASSED] LUNARLAKE (g:A0, m:A0)
[14:54:45] [PASSED] LUNARLAKE (g:B0, m:A0)
[14:54:45] ==================== [PASSED] xe_wa_gt =====================
[14:54:45] ====================== [PASSED] xe_wa ======================
[14:54:45] ============================================================
[14:54:45] Testing complete. Ran 110 tests: passed: 95, skipped: 15
[14:54:45] Elapsed time: 29.661s total, 4.257s configuring, 25.133s building, 0.216s running

+ /kernel/tools/testing/kunit/kunit.py run --kunitconfig /kernel/drivers/gpu/drm/tests/.kunitconfig [14:54:45] Configuring KUnit Kernel ...
Regenerating .config ...
Populating config with:

$ make ARCH=um O=.kunit olddefconfig
[14:54:47] Building KUnit Kernel ...
Populating config with:
$ make ARCH=um O=.kunit olddefconfig
Building with:
$ make ARCH=um O=.kunit --jobs=48
In file included from ../arch/um/kernel/asm-offsets.c:1:
../arch/x86/um/shared/sysdep/kernel-offsets.h:9:6: warning: no previous prototype for ‘foo’ [-Wmissing-prototypes]
    9 | void foo(void)
      |      ^~~
../arch/x86/um/syscalls_64.c:48:6: warning: no previous prototype for ‘arch_switch_to’ [-Wmissing-prototypes]
   48 | void arch_switch_to(struct task_struct *to)
      |      ^~~~~~~~~~~~~~
../arch/x86/um/ptrace_64.c:111:5: warning: no previous prototype for ‘poke_user’ [-Wmissing-prototypes]
  111 | int poke_user(struct task_struct *child, long addr, long data)
      |     ^~~~~~~~~
../arch/x86/um/ptrace_64.c:171:5: warning: no previous prototype for ‘peek_user’ [-Wmissing-prototypes]
  171 | int peek_user(struct task_struct *child, long addr, long data)
      |     ^~~~~~~~~
../arch/um/kernel/mem.c:202:8: warning: no previous prototype for ‘pgd_alloc’ [-Wmissing-prototypes]
  202 | pgd_t *pgd_alloc(struct mm_struct *mm)
      |        ^~~~~~~~~
../arch/um/kernel/mem.c:215:7: warning: no previous prototype for ‘uml_kmalloc’ [-Wmissing-prototypes]
  215 | void *uml_kmalloc(int size, int flags)
      |       ^~~~~~~~~~~
../arch/x86/um/signal.c:560:6: warning: no previous prototype for ‘sys_rt_sigreturn’ [-Wmissing-prototypes]
  560 | long sys_rt_sigreturn(void)
      |      ^~~~~~~~~~~~~~~~
../arch/um/kernel/process.c:51:5: warning: no previous prototype for ‘pid_to_processor_id’ [-Wmissing-prototypes]
   51 | int pid_to_processor_id(int pid)
      |     ^~~~~~~~~~~~~~~~~~~
../arch/um/kernel/process.c:87:7: warning: no previous prototype for ‘__switch_to’ [-Wmissing-prototypes]
   87 | void *__switch_to(struct task_struct *from, struct task_struct *to)
      |       ^~~~~~~~~~~
../arch/um/kernel/process.c:140:6: warning: no previous prototype for ‘fork_handler’ [-Wmissing-prototypes]
  140 | void fork_handler(void)
      |      ^~~~~~~~~~~~
../arch/um/kernel/process.c:217:6: warning: no previous prototype for ‘arch_cpu_idle’ [-Wmissing-prototypes]
  217 | void arch_cpu_idle(void)
      |      ^~~~~~~~~~~~~
../arch/um/kernel/process.c:253:5: warning: no previous prototype for ‘copy_to_user_proc’ [-Wmissing-prototypes]
  253 | int copy_to_user_proc(void __user *to, void *from, int size)
      |     ^~~~~~~~~~~~~~~~~
../arch/um/kernel/process.c:263:5: warning: no previous prototype for ‘clear_user_proc’ [-Wmissing-prototypes]
  263 | int clear_user_proc(void __user *buf, int size)
      |     ^~~~~~~~~~~~~~~
../arch/um/kernel/process.c:271:6: warning: no previous prototype for ‘set_using_sysemu’ [-Wmissing-prototypes]
  271 | void set_using_sysemu(int value)
      |      ^~~~~~~~~~~~~~~~
../arch/um/kernel/process.c:278:5: warning: no previous prototype for ‘get_using_sysemu’ [-Wmissing-prototypes]
  278 | int get_using_sysemu(void)
      |     ^~~~~~~~~~~~~~~~
../arch/um/kernel/process.c:316:12: warning: no previous prototype for ‘make_proc_sysemu’ [-Wmissing-prototypes]
  316 | int __init make_proc_sysemu(void)
      |            ^~~~~~~~~~~~~~~~
../arch/um/kernel/process.c:348:15: warning: no previous prototype for ‘arch_align_stack’ [-Wmissing-prototypes]
  348 | unsigned long arch_align_stack(unsigned long sp)
      |               ^~~~~~~~~~~~~~~~
../arch/um/kernel/reboot.c:45:6: warning: no previous prototype for ‘machine_restart’ [-Wmissing-prototypes]
   45 | void machine_restart(char * __unused)
      |      ^~~~~~~~~~~~~~~
../arch/um/kernel/reboot.c:51:6: warning: no previous prototype for ‘machine_power_off’ [-Wmissing-prototypes]
   51 | void machine_power_off(void)
      |      ^~~~~~~~~~~~~~~~~
../arch/um/kernel/reboot.c:57:6: warning: no previous prototype for ‘machine_halt’ [-Wmissing-prototypes]
   57 | void machine_halt(void)
      |      ^~~~~~~~~~~~
../arch/um/kernel/tlb.c:579:6: warning: no previous prototype for ‘flush_tlb_mm_range’ [-Wmissing-prototypes]
  579 | void flush_tlb_mm_range(struct mm_struct *mm, unsigned long start,
      |      ^~~~~~~~~~~~~~~~~~
../arch/um/kernel/tlb.c:594:6: warning: no previous prototype for ‘force_flush_all’ [-Wmissing-prototypes]
  594 | void force_flush_all(void)
      |      ^~~~~~~~~~~~~~~
../arch/um/kernel/um_arch.c:408:19: warning: no previous prototype for ‘read_initrd’ [-Wmissing-prototypes]
  408 | int __init __weak read_initrd(void)
      |                   ^~~~~~~~~~~
../arch/um/kernel/um_arch.c:461:7: warning: no previous prototype for ‘text_poke’ [-Wmissing-prototypes]
  461 | void *text_poke(void *addr, const void *opcode, size_t len)
      |       ^~~~~~~~~
../arch/um/kernel/um_arch.c:473:6: warning: no previous prototype for ‘text_poke_sync’ [-Wmissing-prototypes]
  473 | void text_poke_sync(void)
      |      ^~~~~~~~~~~~~~
../arch/um/kernel/kmsg_dump.c:60:12: warning: no previous prototype for ‘kmsg_dumper_stdout_init’ [-Wmissing-prototypes]
   60 | int __init kmsg_dumper_stdout_init(void)
      |            ^~~~~~~~~~~~~~~~~~~~~~~
../arch/um/kernel/skas/process.c:36:12: warning: no previous prototype for ‘start_uml’ [-Wmissing-prototypes]
   36 | int __init start_uml(void)
      |            ^~~~~~~~~
../arch/um/kernel/skas/mmu.c:17:5: warning: no previous prototype for ‘init_new_context’ [-Wmissing-prototypes]
   17 | int init_new_context(struct task_struct *task, struct mm_struct *mm)
      |     ^~~~~~~~~~~~~~~~
../arch/um/kernel/skas/mmu.c:60:6: warning: no previous prototype for ‘destroy_context’ [-Wmissing-prototypes]
   60 | void destroy_context(struct mm_struct *mm)
      |      ^~~~~~~~~~~~~~~
../lib/iomap.c:156:5: warning: no previous prototype for ‘ioread64_lo_hi’ [-Wmissing-prototypes]
  156 | u64 ioread64_lo_hi(const void __iomem *addr)
      |     ^~~~~~~~~~~~~~
../lib/iomap.c:163:5: warning: no previous prototype for ‘ioread64_hi_lo’ [-Wmissing-prototypes]
  163 | u64 ioread64_hi_lo(const void __iomem *addr)
      |     ^~~~~~~~~~~~~~
../lib/iomap.c:170:5: warning: no previous prototype for ‘ioread64be_lo_hi’ [-Wmissing-prototypes]
  170 | u64 ioread64be_lo_hi(const void __iomem *addr)
      |     ^~~~~~~~~~~~~~~~
../lib/iomap.c:178:5: warning: no previous prototype for ‘ioread64be_hi_lo’ [-Wmissing-prototypes]
  178 | u64 ioread64be_hi_lo(const void __iomem *addr)
      |     ^~~~~~~~~~~~~~~~
../lib/iomap.c:264:6: warning: no previous prototype for ‘iowrite64_lo_hi’ [-Wmissing-prototypes]
  264 | void iowrite64_lo_hi(u64 val, void __iomem *addr)
      |      ^~~~~~~~~~~~~~~
../lib/iomap.c:272:6: warning: no previous prototype for ‘iowrite64_hi_lo’ [-Wmissing-prototypes]
  272 | void iowrite64_hi_lo(u64 val, void __iomem *addr)
      |      ^~~~~~~~~~~~~~~
../lib/iomap.c:280:6: warning: no previous prototype for ‘iowrite64be_lo_hi’ [-Wmissing-prototypes]
  280 | void iowrite64be_lo_hi(u64 val, void __iomem *addr)
      |      ^~~~~~~~~~~~~~~~~
../lib/iomap.c:288:6: warning: no previous prototype for ‘iowrite64be_hi_lo’ [-Wmissing-prototypes]
  288 | void iowrite64be_hi_lo(u64 val, void __iomem *addr)
      |      ^~~~~~~~~~~~~~~~~

[14:55:09] Starting KUnit Kernel (1/1)...
[14:55:09] ============================================================ Running tests with:

$ .kunit/linux kunit.enable=1 mem=1G console=tty kunit_shutdown=halt
[14:55:09] ============ drm_test_pick_cmdline (2 subtests) ============
[14:55:09] [PASSED] drm_test_pick_cmdline_res_1920_1080_60
[14:55:09] =============== drm_test_pick_cmdline_named  ===============
[14:55:09] [PASSED] NTSC
[14:55:09] [PASSED] NTSC-J
[14:55:09] [PASSED] PAL
[14:55:09] [PASSED] PAL-M
[14:55:09] =========== [PASSED] drm_test_pick_cmdline_named ===========
[14:55:09] ============== [PASSED] drm_test_pick_cmdline ==============
[14:55:09] ================== drm_buddy (7 subtests) ==================
[14:55:09] [PASSED] drm_test_buddy_alloc_limit
[14:55:09] [PASSED] drm_test_buddy_alloc_optimistic
[14:55:09] [PASSED] drm_test_buddy_alloc_pessimistic
[14:55:09] [PASSED] drm_test_buddy_alloc_pathological
[14:55:09] [PASSED] drm_test_buddy_alloc_contiguous
[14:55:09] [PASSED] drm_test_buddy_alloc_clear
[14:55:09] [PASSED] drm_test_buddy_alloc_range_bias
[14:55:09] ==================== [PASSED] drm_buddy ====================
[14:55:09] ============= drm_cmdline_parser (40 subtests) =============
[14:55:09] [PASSED] drm_test_cmdline_force_d_only
[14:55:09] [PASSED] drm_test_cmdline_force_D_only_dvi
[14:55:09] [PASSED] drm_test_cmdline_force_D_only_hdmi
[14:55:09] [PASSED] drm_test_cmdline_force_D_only_not_digital
[14:55:09] [PASSED] drm_test_cmdline_force_e_only
[14:55:09] [PASSED] drm_test_cmdline_res
[14:55:09] [PASSED] drm_test_cmdline_res_vesa
[14:55:09] [PASSED] drm_test_cmdline_res_vesa_rblank
[14:55:09] [PASSED] drm_test_cmdline_res_rblank
[14:55:09] [PASSED] drm_test_cmdline_res_bpp
[14:55:09] [PASSED] drm_test_cmdline_res_refresh
[14:55:09] [PASSED] drm_test_cmdline_res_bpp_refresh
[14:55:09] [PASSED] drm_test_cmdline_res_bpp_refresh_interlaced
[14:55:09] [PASSED] drm_test_cmdline_res_bpp_refresh_margins
[14:55:09] [PASSED] drm_test_cmdline_res_bpp_refresh_force_off
[14:55:09] [PASSED] drm_test_cmdline_res_bpp_refresh_force_on
[14:55:09] [PASSED] drm_test_cmdline_res_bpp_refresh_force_on_analog
[14:55:09] [PASSED] drm_test_cmdline_res_bpp_refresh_force_on_digital
[14:55:09] [PASSED] drm_test_cmdline_res_bpp_refresh_interlaced_margins_force_on
[14:55:09] [PASSED] drm_test_cmdline_res_margins_force_on
[14:55:09] [PASSED] drm_test_cmdline_res_vesa_margins
[14:55:09] [PASSED] drm_test_cmdline_name
[14:55:09] [PASSED] drm_test_cmdline_name_bpp
[14:55:09] [PASSED] drm_test_cmdline_name_option
[14:55:09] [PASSED] drm_test_cmdline_name_bpp_option
[14:55:09] [PASSED] drm_test_cmdline_rotate_0
[14:55:09] [PASSED] drm_test_cmdline_rotate_90
[14:55:09] [PASSED] drm_test_cmdline_rotate_180
[14:55:09] [PASSED] drm_test_cmdline_rotate_270
[14:55:09] [PASSED] drm_test_cmdline_hmirror
[14:55:09] [PASSED] drm_test_cmdline_vmirror
[14:55:09] [PASSED] drm_test_cmdline_margin_options
[14:55:09] [PASSED] drm_test_cmdline_multiple_options
[14:55:09] [PASSED] drm_test_cmdline_bpp_extra_and_option
[14:55:09] [PASSED] drm_test_cmdline_extra_and_option
[14:55:09] [PASSED] drm_test_cmdline_freestanding_options
[14:55:09] [PASSED] drm_test_cmdline_freestanding_force_e_and_options
[14:55:09] [PASSED] drm_test_cmdline_panel_orientation
[14:55:09] ================ drm_test_cmdline_invalid  =================
[14:55:09] [PASSED] margin_only
[14:55:09] [PASSED] interlace_only
[14:55:09] [PASSED] res_missing_x
[14:55:09] [PASSED] res_missing_y
[14:55:09] [PASSED] res_bad_y
[14:55:09] [PASSED] res_missing_y_bpp
[14:55:09] [PASSED] res_bad_bpp
[14:55:09] [PASSED] res_bad_refresh
[14:55:09] [PASSED] res_bpp_refresh_force_on_off
[14:55:09] [PASSED] res_invalid_mode
[14:55:09] [PASSED] res_bpp_wrong_place_mode
[14:55:09] [PASSED] name_bpp_refresh
[14:55:09] [PASSED] name_refresh
[14:55:09] [PASSED] name_refresh_wrong_mode
[14:55:09] [PASSED] name_refresh_invalid_mode
[14:55:09] [PASSED] rotate_multiple
[14:55:09] [PASSED] rotate_invalid_val
[14:55:09] [PASSED] rotate_truncated
[14:55:09] [PASSED] invalid_option
[14:55:09] [PASSED] invalid_tv_option
[14:55:09] [PASSED] truncated_tv_option
[14:55:09] ============ [PASSED] drm_test_cmdline_invalid =============
[14:55:09] =============== drm_test_cmdline_tv_options  ===============
[14:55:09] [PASSED] NTSC
[14:55:09] [PASSED] NTSC_443
[14:55:09] [PASSED] NTSC_J
[14:55:09] [PASSED] PAL
[14:55:09] [PASSED] PAL_M
[14:55:09] [PASSED] PAL_N
[14:55:09] [PASSED] SECAM
[14:55:09] =========== [PASSED] drm_test_cmdline_tv_options ===========
[14:55:09] =============== [PASSED] drm_cmdline_parser ================
[14:55:09] ============= drmm_connector_init (3 subtests) =============
[14:55:09] [PASSED] drm_test_drmm_connector_init
[14:55:09] [PASSED] drm_test_drmm_connector_init_null_ddc
[14:55:09] ========= drm_test_drmm_connector_init_type_valid  =========
[14:55:09] [PASSED] Unknown
[14:55:09] [PASSED] VGA
[14:55:09] [PASSED] DVI-I
[14:55:09] [PASSED] DVI-D
[14:55:09] [PASSED] DVI-A
[14:55:09] [PASSED] Composite
[14:55:09] [PASSED] SVIDEO
[14:55:09] [PASSED] LVDS
[14:55:09] [PASSED] Component
[14:55:09] [PASSED] DIN
[14:55:09] [PASSED] DP
[14:55:09] [PASSED] HDMI-A
[14:55:09] [PASSED] HDMI-B
[14:55:09] [PASSED] TV
[14:55:09] [PASSED] eDP
[14:55:09] [PASSED] Virtual
[14:55:09] [PASSED] DSI
[14:55:09] [PASSED] DPI
[14:55:09] [PASSED] Writeback
[14:55:09] [PASSED] SPI
[14:55:09] [PASSED] USB
[14:55:09] ===== [PASSED] drm_test_drmm_connector_init_type_valid =====
[14:55:09] =============== [PASSED] drmm_connector_init ===============
[14:55:09] ========== drm_get_tv_mode_from_name (2 subtests) ==========
[14:55:09] ========== drm_test_get_tv_mode_from_name_valid  ===========
[14:55:09] [PASSED] NTSC
[14:55:09] [PASSED] NTSC-443
[14:55:09] [PASSED] NTSC-J
[14:55:09] [PASSED] PAL
[14:55:09] [PASSED] PAL-M
[14:55:09] [PASSED] PAL-N
[14:55:09] [PASSED] SECAM
[14:55:09] ====== [PASSED] drm_test_get_tv_mode_from_name_valid =======
[14:55:09] [PASSED] drm_test_get_tv_mode_from_name_truncated
[14:55:09] ============ [PASSED] drm_get_tv_mode_from_name ============
[14:55:09] ============= drm_damage_helper (21 subtests) ==============
[14:55:09] [PASSED] drm_test_damage_iter_no_damage
[14:55:09] [PASSED] drm_test_damage_iter_no_damage_fractional_src
[14:55:09] [PASSED] drm_test_damage_iter_no_damage_src_moved
[14:55:09] [PASSED] drm_test_damage_iter_no_damage_fractional_src_moved
[14:55:09] [PASSED] drm_test_damage_iter_no_damage_not_visible
[14:55:09] [PASSED] drm_test_damage_iter_no_damage_no_crtc
[14:55:09] [PASSED] drm_test_damage_iter_no_damage_no_fb
[14:55:09] [PASSED] drm_test_damage_iter_simple_damage
[14:55:09] [PASSED] drm_test_damage_iter_single_damage
[14:55:09] [PASSED] drm_test_damage_iter_single_damage_intersect_src
[14:55:09] [PASSED] drm_test_damage_iter_single_damage_outside_src
[14:55:09] [PASSED] drm_test_damage_iter_single_damage_fractional_src
[14:55:09] [PASSED] drm_test_damage_iter_single_damage_intersect_fractional_src
[14:55:09] [PASSED] drm_test_damage_iter_single_damage_outside_fractional_src
[14:55:09] [PASSED] drm_test_damage_iter_single_damage_src_moved
[14:55:09] [PASSED] drm_test_damage_iter_single_damage_fractional_src_moved
[14:55:09] [PASSED] drm_test_damage_iter_damage
[14:55:09] [PASSED] drm_test_damage_iter_damage_one_intersect
[14:55:09] [PASSED] drm_test_damage_iter_damage_one_outside
[14:55:09] [PASSED] drm_test_damage_iter_damage_src_moved
[14:55:09] [PASSED] drm_test_damage_iter_damage_not_visible
[14:55:09] ================ [PASSED] drm_damage_helper ================
[14:55:09] ============== drm_dp_mst_helper (3 subtests) ==============
[14:55:09] ============== drm_test_dp_mst_calc_pbn_mode  ==============
[14:55:09] [PASSED] Clock 154000 BPP 30 DSC disabled
[14:55:09] [PASSED] Clock 234000 BPP 30 DSC disabled
[14:55:09] [PASSED] Clock 297000 BPP 24 DSC disabled
[14:55:09] [PASSED] Clock 332880 BPP 24 DSC enabled
[14:55:09] [PASSED] Clock 324540 BPP 24 DSC enabled
[14:55:09] ========== [PASSED] drm_test_dp_mst_calc_pbn_mode ==========
[14:55:09] ============== drm_test_dp_mst_calc_pbn_div  ===============
[14:55:09] [PASSED] Link rate 2000000 lane count 4
[14:55:09] [PASSED] Link rate 2000000 lane count 2
[14:55:09] [PASSED] Link rate 2000000 lane count 1
[14:55:09] [PASSED] Link rate 1350000 lane count 4
[14:55:09] [PASSED] Link rate 1350000 lane count 2
[14:55:09] [PASSED] Link rate 1350000 lane count 1
[14:55:09] [PASSED] Link rate 1000000 lane count 4
[14:55:09] [PASSED] Link rate 1000000 lane count 2
[14:55:09] [PASSED] Link rate 1000000 lane count 1
[14:55:09] [PASSED] Link rate 810000 lane count 4
[14:55:09] [PASSED] Link rate 810000 lane count 2
[14:55:09] [PASSED] Link rate 810000 lane count 1
[14:55:09] [PASSED] Link rate 540000 lane count 4
[14:55:09] [PASSED] Link rate 540000 lane count 2
[14:55:09] [PASSED] Link rate 540000 lane count 1
[14:55:09] [PASSED] Link rate 270000 lane count 4
[14:55:09] [PASSED] Link rate 270000 lane count 2
[14:55:09] [PASSED] Link rate 270000 lane count 1
[14:55:09] [PASSED] Link rate 162000 lane count 4
[14:55:09] [PASSED] Link rate 162000 lane count 2
[14:55:09] [PASSED] Link rate 162000 lane count 1
[14:55:09] ========== [PASSED] drm_test_dp_mst_calc_pbn_div ===========
[14:55:09] ========= drm_test_dp_mst_sideband_msg_req_decode  =========
[14:55:09] [PASSED] DP_ENUM_PATH_RESOURCES with port number
[14:55:09] [PASSED] DP_POWER_UP_PHY with port number
[14:55:09] [PASSED] DP_POWER_DOWN_PHY with port number
[14:55:09] [PASSED] DP_ALLOCATE_PAYLOAD with SDP stream sinks
[14:55:09] [PASSED] DP_ALLOCATE_PAYLOAD with port number
[14:55:09] [PASSED] DP_ALLOCATE_PAYLOAD with VCPI
[14:55:09] [PASSED] DP_ALLOCATE_PAYLOAD with PBN
[14:55:09] [PASSED] DP_QUERY_PAYLOAD with port number
[14:55:09] [PASSED] DP_QUERY_PAYLOAD with VCPI
[14:55:09] [PASSED] DP_REMOTE_DPCD_READ with port number
[14:55:09] [PASSED] DP_REMOTE_DPCD_READ with DPCD address
[14:55:09] [PASSED] DP_REMOTE_DPCD_READ with max number of bytes
[14:55:09] [PASSED] DP_REMOTE_DPCD_WRITE with port number
[14:55:09] [PASSED] DP_REMOTE_DPCD_WRITE with DPCD address
[14:55:09] [PASSED] DP_REMOTE_DPCD_WRITE with data array
[14:55:09] [PASSED] DP_REMOTE_I2C_READ with port number
[14:55:09] [PASSED] DP_REMOTE_I2C_READ with I2C device ID
[14:55:09] [PASSED] DP_REMOTE_I2C_READ with transactions array
[14:55:09] [PASSED] DP_REMOTE_I2C_WRITE with port number
[14:55:09] [PASSED] DP_REMOTE_I2C_WRITE with I2C device ID
[14:55:09] [PASSED] DP_REMOTE_I2C_WRITE with data array
[14:55:09] [PASSED] DP_QUERY_STREAM_ENC_STATUS with stream ID
[14:55:09] [PASSED] DP_QUERY_STREAM_ENC_STATUS with client ID
[14:55:09] [PASSED] DP_QUERY_STREAM_ENC_STATUS with stream event
[14:55:09] [PASSED] DP_QUERY_STREAM_ENC_STATUS with valid stream event
[14:55:09] [PASSED] DP_QUERY_STREAM_ENC_STATUS with stream behavior
[14:55:09] [PASSED] DP_QUERY_STREAM_ENC_STATUS with a valid stream behavior
[14:55:09] ===== [PASSED] drm_test_dp_mst_sideband_msg_req_decode =====
[14:55:09] ================ [PASSED] drm_dp_mst_helper ================
[14:55:09] ================== drm_exec (7 subtests) ===================
[14:55:09] [PASSED] sanitycheck
[14:55:09] [PASSED] test_lock
[14:55:09] [PASSED] test_lock_unlock
[14:55:09] [PASSED] test_duplicates
[14:55:09] [PASSED] test_prepare
[14:55:09] [PASSED] test_prepare_array
[14:55:09] [PASSED] test_multiple_loops
[14:55:09] ==================== [PASSED] drm_exec =====================
[14:55:09] =========== drm_format_helper_test (17 subtests) ===========
[14:55:09] ============== drm_test_fb_xrgb8888_to_gray8  ==============
[14:55:09] [PASSED] single_pixel_source_buffer
[14:55:09] [PASSED] single_pixel_clip_rectangle
[14:55:09] [PASSED] well_known_colors
[14:55:09] [PASSED] destination_pitch
[14:55:09] ========== [PASSED] drm_test_fb_xrgb8888_to_gray8 ==========
[14:55:09] ============= drm_test_fb_xrgb8888_to_rgb332  ==============
[14:55:09] [PASSED] single_pixel_source_buffer
[14:55:09] [PASSED] single_pixel_clip_rectangle
[14:55:09] [PASSED] well_known_colors
[14:55:09] [PASSED] destination_pitch
[14:55:09] ========= [PASSED] drm_test_fb_xrgb8888_to_rgb332 ==========
[14:55:09] ============= drm_test_fb_xrgb8888_to_rgb565  ==============
[14:55:09] [PASSED] single_pixel_source_buffer
[14:55:09] [PASSED] single_pixel_clip_rectangle
[14:55:09] [PASSED] well_known_colors
[14:55:09] [PASSED] destination_pitch
[14:55:09] ========= [PASSED] drm_test_fb_xrgb8888_to_rgb565 ==========
[14:55:09] ============ drm_test_fb_xrgb8888_to_xrgb1555  =============
[14:55:09] [PASSED] single_pixel_source_buffer
[14:55:09] [PASSED] single_pixel_clip_rectangle
[14:55:09] [PASSED] well_known_colors
[14:55:09] [PASSED] destination_pitch
[14:55:09] ======== [PASSED] drm_test_fb_xrgb8888_to_xrgb1555 =========
[14:55:09] ============ drm_test_fb_xrgb8888_to_argb1555  =============
[14:55:09] [PASSED] single_pixel_source_buffer
[14:55:09] [PASSED] single_pixel_clip_rectangle
[14:55:09] [PASSED] well_known_colors
[14:55:09] [PASSED] destination_pitch
[14:55:09] ======== [PASSED] drm_test_fb_xrgb8888_to_argb1555 =========
[14:55:09] ============ drm_test_fb_xrgb8888_to_rgba5551  =============
[14:55:09] [PASSED] single_pixel_source_buffer
[14:55:09] [PASSED] single_pixel_clip_rectangle
[14:55:09] [PASSED] well_known_colors
[14:55:09] [PASSED] destination_pitch
[14:55:09] ======== [PASSED] drm_test_fb_xrgb8888_to_rgba5551 =========
[14:55:09] ============= drm_test_fb_xrgb8888_to_rgb888  ==============
[14:55:09] [PASSED] single_pixel_source_buffer
[14:55:09] [PASSED] single_pixel_clip_rectangle
[14:55:09] [PASSED] well_known_colors
[14:55:09] [PASSED] destination_pitch
[14:55:09] ========= [PASSED] drm_test_fb_xrgb8888_to_rgb888 ==========
[14:55:09] ============ drm_test_fb_xrgb8888_to_argb8888  =============
[14:55:09] [PASSED] single_pixel_source_buffer
[14:55:09] [PASSED] single_pixel_clip_rectangle
[14:55:09] [PASSED] well_known_colors
[14:55:09] [PASSED] destination_pitch
[14:55:09] ======== [PASSED] drm_test_fb_xrgb8888_to_argb8888 =========
[14:55:09] =========== drm_test_fb_xrgb8888_to_xrgb2101010  ===========
[14:55:09] [PASSED] single_pixel_source_buffer
[14:55:09] [PASSED] single_pixel_clip_rectangle
[14:55:09] [PASSED] well_known_colors
[14:55:09] [PASSED] destination_pitch
[14:55:09] ======= [PASSED] drm_test_fb_xrgb8888_to_xrgb2101010 =======
[14:55:09] =========== drm_test_fb_xrgb8888_to_argb2101010  ===========
[14:55:09] [PASSED] single_pixel_source_buffer
[14:55:09] [PASSED] single_pixel_clip_rectangle
[14:55:09] [PASSED] well_known_colors
[14:55:09] [PASSED] destination_pitch
[14:55:09] ======= [PASSED] drm_test_fb_xrgb8888_to_argb2101010 =======
[14:55:09] ============== drm_test_fb_xrgb8888_to_mono  ===============
[14:55:09] [PASSED] single_pixel_source_buffer
[14:55:09] [PASSED] single_pixel_clip_rectangle
[14:55:09] [PASSED] well_known_colors
[14:55:09] [PASSED] destination_pitch
[14:55:09] ========== [PASSED] drm_test_fb_xrgb8888_to_mono ===========
[14:55:09] ==================== drm_test_fb_swab  =====================
[14:55:09] [PASSED] single_pixel_source_buffer
[14:55:09] [PASSED] single_pixel_clip_rectangle
[14:55:09] [PASSED] well_known_colors
[14:55:09] [PASSED] destination_pitch
[14:55:09] ================ [PASSED] drm_test_fb_swab =================
[14:55:09] ============ drm_test_fb_xrgb8888_to_xbgr8888  =============
[14:55:09] [PASSED] single_pixel_source_buffer
[14:55:09] [PASSED] single_pixel_clip_rectangle
[14:55:09] [PASSED] well_known_colors
[14:55:09] [PASSED] destination_pitch
[14:55:09] ======== [PASSED] drm_test_fb_xrgb8888_to_xbgr8888 =========
[14:55:09] ============ drm_test_fb_xrgb8888_to_abgr8888  =============
[14:55:09] [PASSED] single_pixel_source_buffer
[14:55:09] [PASSED] single_pixel_clip_rectangle
[14:55:09] [PASSED] well_known_colors
[14:55:09] [PASSED] destination_pitch
[14:55:09] ======== [PASSED] drm_test_fb_xrgb8888_to_abgr8888 =========
[14:55:09] ================= drm_test_fb_clip_offset  =================
[14:55:09] [PASSED] pass through
[14:55:09] [PASSED] horizontal offset
[14:55:09] [PASSED] vertical offset
[14:55:09] [PASSED] horizontal and vertical offset
[14:55:09] [PASSED] horizontal offset (custom pitch)
[14:55:09] [PASSED] vertical offset (custom pitch)
[14:55:09] [PASSED] horizontal and vertical offset (custom pitch)
[14:55:09] ============= [PASSED] drm_test_fb_clip_offset =============
[14:55:09] ============== drm_test_fb_build_fourcc_list  ==============
[14:55:09] [PASSED] no native formats
[14:55:09] [PASSED] XRGB8888 as native format
[14:55:09] [PASSED] remove duplicates
[14:55:09] [PASSED] convert alpha formats
[14:55:09] [PASSED] random formats
[14:55:09] ========== [PASSED] drm_test_fb_build_fourcc_list ==========
[14:55:09] =================== drm_test_fb_memcpy  ====================
[14:55:09] [PASSED] single_pixel_source_buffer: XR24 little-endian (0x34325258)
[14:55:09] [PASSED] single_pixel_source_buffer: XRA8 little-endian (0x38415258)
[14:55:09] [PASSED] single_pixel_source_buffer: YU24 little-endian (0x34325559)
[14:55:09] [PASSED] single_pixel_clip_rectangle: XB24 little-endian (0x34324258)
[14:55:09] [PASSED] single_pixel_clip_rectangle: XRA8 little-endian (0x38415258)
[14:55:09] [PASSED] single_pixel_clip_rectangle: YU24 little-endian (0x34325559)
[14:55:09] [PASSED] well_known_colors: XB24 little-endian (0x34324258)
[14:55:09] [PASSED] well_known_colors: XRA8 little-endian (0x38415258)
[14:55:09] [PASSED] well_known_colors: YU24 little-endian (0x34325559)
[14:55:09] [PASSED] destination_pitch: XB24 little-endian (0x34324258)
[14:55:09] [PASSED] destination_pitch: XRA8 little-endian (0x38415258)
[14:55:09] [PASSED] destination_pitch: YU24 little-endian (0x34325559)
[14:55:09] =============== [PASSED] drm_test_fb_memcpy ================
[14:55:09] ============= [PASSED] drm_format_helper_test ==============
[14:55:09] ================= drm_format (18 subtests) =================
[14:55:09] [PASSED] drm_test_format_block_width_invalid
[14:55:09] [PASSED] drm_test_format_block_width_one_plane
[14:55:09] [PASSED] drm_test_format_block_width_two_plane
[14:55:09] [PASSED] drm_test_format_block_width_three_plane
[14:55:09] [PASSED] drm_test_format_block_width_tiled
[14:55:09] [PASSED] drm_test_format_block_height_invalid
[14:55:09] [PASSED] drm_test_format_block_height_one_plane
[14:55:09] [PASSED] drm_test_format_block_height_two_plane
[14:55:09] [PASSED] drm_test_format_block_height_three_plane
[14:55:09] [PASSED] drm_test_format_block_height_tiled
[14:55:09] [PASSED] drm_test_format_min_pitch_invalid
[14:55:09] [PASSED] drm_test_format_min_pitch_one_plane_8bpp
[14:55:09] [PASSED] drm_test_format_min_pitch_one_plane_16bpp
[14:55:09] [PASSED] drm_test_format_min_pitch_one_plane_24bpp
[14:55:09] [PASSED] drm_test_format_min_pitch_one_plane_32bpp
[14:55:09] [PASSED] drm_test_format_min_pitch_two_plane
[14:55:09] [PASSED] drm_test_format_min_pitch_three_plane_8bpp
[14:55:09] [PASSED] drm_test_format_min_pitch_tiled
[14:55:09] =================== [PASSED] drm_format ====================
[14:55:09] =============== drm_framebuffer (1 subtest) ================
[14:55:09] =============== drm_test_framebuffer_create  ===============
[14:55:09] [PASSED] ABGR8888 normal sizes
[14:55:09] [PASSED] ABGR8888 max sizes
[14:55:09] [PASSED] ABGR8888 pitch greater than min required
[14:55:09] [PASSED] ABGR8888 pitch less than min required
[14:55:09] [PASSED] ABGR8888 Invalid width
[14:55:09] [PASSED] ABGR8888 Invalid buffer handle
[14:55:09] [PASSED] No pixel format
[14:55:09] [PASSED] ABGR8888 Width 0
[14:55:09] [PASSED] ABGR8888 Height 0
[14:55:09] [PASSED] ABGR8888 Out of bound height * pitch combination
[14:55:09] [PASSED] ABGR8888 Large buffer offset
[14:55:09] [PASSED] ABGR8888 Set DRM_MODE_FB_MODIFIERS without modifiers
[14:55:09] [PASSED] ABGR8888 Valid buffer modifier
[14:55:09] [PASSED] ABGR8888 Invalid buffer modifier(DRM_FORMAT_MOD_SAMSUNG_64_32_TILE)
[14:55:09] [PASSED] ABGR8888 Extra pitches without DRM_MODE_FB_MODIFIERS
[14:55:09] [PASSED] ABGR8888 Extra pitches with DRM_MODE_FB_MODIFIERS
[14:55:09] [PASSED] NV12 Normal sizes
[14:55:09] [PASSED] NV12 Max sizes
[14:55:09] [PASSED] NV12 Invalid pitch
[14:55:09] [PASSED] NV12 Invalid modifier/missing DRM_MODE_FB_MODIFIERS flag
[14:55:09] [PASSED] NV12 different  modifier per-plane
[14:55:09] [PASSED] NV12 with DRM_FORMAT_MOD_SAMSUNG_64_32_TILE
[14:55:09] [PASSED] NV12 Valid modifiers without DRM_MODE_FB_MODIFIERS
[14:55:09] [PASSED] NV12 Modifier for inexistent plane
[14:55:09] [PASSED] NV12 Handle for inexistent plane
[14:55:09] [PASSED] NV12 Handle for inexistent plane without DRM_MODE_FB_MODIFIERS
[14:55:09] [PASSED] YVU420 DRM_MODE_FB_MODIFIERS set without modifier
[14:55:09] [PASSED] YVU420 Normal sizes
[14:55:09] [PASSED] YVU420 Max sizes
[14:55:09] [PASSED] YVU420 Invalid pitch
[14:55:09] [PASSED] YVU420 Different pitches
[14:55:09] [PASSED] YVU420 Different buffer offsets/pitches
[14:55:09] [PASSED] YVU420 Modifier set just for plane 0, without DRM_MODE_FB_MODIFIERS
[14:55:09] [PASSED] YVU420 Modifier set just for planes 0, 1, without DRM_MODE_FB_MODIFIERS
[14:55:09] [PASSED] YVU420 Modifier set just for plane 0, 1, with DRM_MODE_FB_MODIFIERS
[14:55:09] [PASSED] YVU420 Valid modifier
[14:55:09] [PASSED] YVU420 Different modifiers per plane
[14:55:09] [PASSED] YVU420 Modifier for inexistent plane
[14:55:09] [PASSED] X0L2 Normal sizes
[14:55:09] [PASSED] X0L2 Max sizes
[14:55:09] [PASSED] X0L2 Invalid pitch
[14:55:09] [PASSED] X0L2 Pitch greater than minimum required
[14:55:09] [PASSED] X0L2 Handle for inexistent plane
[14:55:09] [PASSED] X0L2 Offset for inexistent plane, without DRM_MODE_FB_MODIFIERS set
[14:55:09] [PASSED] X0L2 Modifier without DRM_MODE_FB_MODIFIERS set
[14:55:09] [PASSED] X0L2 Valid modifier
[14:55:09] [PASSED] X0L2 Modifier for inexistent plane
[14:55:09] =========== [PASSED] drm_test_framebuffer_create ===========
[14:55:09] ================= [PASSED] drm_framebuffer =================
[14:55:09] ================ drm_gem_shmem (8 subtests) ================
[14:55:09] [PASSED] drm_gem_shmem_test_obj_create
[14:55:09] [PASSED] drm_gem_shmem_test_obj_create_private
[14:55:09] [PASSED] drm_gem_shmem_test_pin_pages
[14:55:09] [PASSED] drm_gem_shmem_test_vmap
[14:55:09] [PASSED] drm_gem_shmem_test_get_pages_sgt
[14:55:09] [PASSED] drm_gem_shmem_test_get_sg_table
[14:55:09] [PASSED] drm_gem_shmem_test_madvise
[14:55:09] [PASSED] drm_gem_shmem_test_purge
[14:55:09] ================== [PASSED] drm_gem_shmem ==================
[14:55:09] ================= drm_managed (2 subtests) =================
[14:55:09] [PASSED] drm_test_managed_release_action
[14:55:09] [PASSED] drm_test_managed_run_action
[14:55:09] =================== [PASSED] drm_managed ===================
[14:55:09] =================== drm_mm (6 subtests) ====================
[14:55:09] [PASSED] drm_test_mm_init
[14:55:09] [PASSED] drm_test_mm_debug
[14:55:09] [PASSED] drm_test_mm_align32
[14:55:09] [PASSED] drm_test_mm_align64
[14:55:09] [PASSED] drm_test_mm_lowest
[14:55:09] [PASSED] drm_test_mm_highest
[14:55:09] ===================== [PASSED] drm_mm ======================
[14:55:09] ============= drm_modes_analog_tv (4 subtests) =============
[14:55:09] [PASSED] drm_test_modes_analog_tv_ntsc_480i
[14:55:09] [PASSED] drm_test_modes_analog_tv_ntsc_480i_inlined
[14:55:09] [PASSED] drm_test_modes_analog_tv_pal_576i
[14:55:09] [PASSED] drm_test_modes_analog_tv_pal_576i_inlined
[14:55:09] =============== [PASSED] drm_modes_analog_tv ===============
[14:55:09] ============== drm_plane_helper (2 subtests) ===============
[14:55:09] =============== drm_test_check_plane_state  ================
[14:55:09] [PASSED] clipping_simple
[14:55:09] [PASSED] clipping_rotate_reflect
[14:55:09] [PASSED] positioning_simple
[14:55:09] [PASSED] upscaling
[14:55:09] [PASSED] downscaling
[14:55:09] [PASSED] rounding1
[14:55:09] [PASSED] rounding2
[14:55:09] [PASSED] rounding3
[14:55:09] [PASSED] rounding4
[14:55:09] =========== [PASSED] drm_test_check_plane_state ============
[14:55:09] =========== drm_test_check_invalid_plane_state  ============
[14:55:09] [PASSED] positioning_invalid
[14:55:09] [PASSED] upscaling_invalid
[14:55:09] [PASSED] downscaling_invalid
[14:55:09] ======= [PASSED] drm_test_check_invalid_plane_state ========
[14:55:09] ================ [PASSED] drm_plane_helper =================
[14:55:09] ====== drm_connector_helper_tv_get_modes (1 subtest) =======
[14:55:09] ====== drm_test_connector_helper_tv_get_modes_check  =======
[14:55:09] [PASSED] None
[14:55:09] [PASSED] PAL
[14:55:09] [PASSED] NTSC
[14:55:09] [PASSED] Both, NTSC Default
[14:55:09] [PASSED] Both, PAL Default
[14:55:09] [PASSED] Both, NTSC Default, with PAL on command-line
[14:55:09] [PASSED] Both, PAL Default, with NTSC on command-line
[14:55:09] == [PASSED] drm_test_connector_helper_tv_get_modes_check ===
[14:55:09] ======== [PASSED] drm_connector_helper_tv_get_modes ========
[14:55:09] ================== drm_rect (9 subtests) ===================
[14:55:09] [PASSED] drm_test_rect_clip_scaled_div_by_zero
[14:55:09] [PASSED] drm_test_rect_clip_scaled_not_clipped
[14:55:09] [PASSED] drm_test_rect_clip_scaled_clipped
stty: 'standard input': Inappropriate ioctl for device
[14:55:09] [PASSED] drm_test_rect_clip_scaled_signed_vs_unsigned
[14:55:09] ================= drm_test_rect_intersect  =================
[14:55:09] [PASSED] top-left x bottom-right: 2x2+1+1 x 2x2+0+0
[14:55:09] [PASSED] top-right x bottom-left: 2x2+0+0 x 2x2+1-1
[14:55:09] [PASSED] bottom-left x top-right: 2x2+1-1 x 2x2+0+0
[14:55:09] [PASSED] bottom-right x top-left: 2x2+0+0 x 2x2+1+1
[14:55:09] [PASSED] right x left: 2x1+0+0 x 3x1+1+0
[14:55:09] [PASSED] left x right: 3x1+1+0 x 2x1+0+0
[14:55:09] [PASSED] up x bottom: 1x2+0+0 x 1x3+0-1
[14:55:09] [PASSED] bottom x up: 1x3+0-1 x 1x2+0+0
[14:55:09] [PASSED] touching corner: 1x1+0+0 x 2x2+1+1
[14:55:09] [PASSED] touching side: 1x1+0+0 x 1x1+1+0
[14:55:09] [PASSED] equal rects: 2x2+0+0 x 2x2+0+0
[14:55:09] [PASSED] inside another: 2x2+0+0 x 1x1+1+1
[14:55:09] [PASSED] far away: 1x1+0+0 x 1x1+3+6
[14:55:09] [PASSED] points intersecting: 0x0+5+10 x 0x0+5+10
[14:55:09] [PASSED] points not intersecting: 0x0+0+0 x 0x0+5+10
[14:55:09] ============= [PASSED] drm_test_rect_intersect =============
[14:55:09] ================ drm_test_rect_calc_hscale  ================
[14:55:09] [PASSED] normal use
[14:55:09] [PASSED] out of max range
[14:55:09] [PASSED] out of min range
[14:55:09] [PASSED] zero dst
[14:55:09] [PASSED] negative src
[14:55:09] [PASSED] negative dst
[14:55:09] ============ [PASSED] drm_test_rect_calc_hscale ============
[14:55:09] ================ drm_test_rect_calc_vscale  ================
[14:55:09] [PASSED] normal use
[14:55:09] [PASSED] out of max range
[14:55:09] [PASSED] out of min range
[14:55:09] [PASSED] zero dst
[14:55:09] [PASSED] negative src
[14:55:09] [PASSED] negative dst
[14:55:09] ============ [PASSED] drm_test_rect_calc_vscale ============
[14:55:09] ================== drm_test_rect_rotate  ===================
[14:55:09] [PASSED] reflect-x
[14:55:09] [PASSED] reflect-y
[14:55:09] [PASSED] rotate-0
[14:55:09] [PASSED] rotate-90
[14:55:09] [PASSED] rotate-180
[14:55:09] [PASSED] rotate-270
[14:55:09] ============== [PASSED] drm_test_rect_rotate ===============
[14:55:09] ================ drm_test_rect_rotate_inv  =================
[14:55:09] [PASSED] reflect-x
[14:55:09] [PASSED] reflect-y
[14:55:09] [PASSED] rotate-0
[14:55:09] [PASSED] rotate-90
[14:55:09] [PASSED] rotate-180
[14:55:09] [PASSED] rotate-270
[14:55:09] ============ [PASSED] drm_test_rect_rotate_inv =============
[14:55:09] ==================== [PASSED] drm_rect =====================
[14:55:09] ============================================================
[14:55:09] Testing complete. Ran 417 tests: passed: 417
[14:55:09] Elapsed time: 23.993s total, 1.735s configuring, 22.088s building, 0.151s running

+ cleanup
++ stat -c %u:%g /kernel
+ chown -R 1003:1003 /kernel