]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
drm/ttm: Allow TTM LRU list nodes of different types
authorThomas Hellström <thomas.hellstrom@linux.intel.com>
Fri, 5 Jul 2024 15:31:59 +0000 (17:31 +0200)
committerChristian König <christian.koenig@amd.com>
Tue, 9 Jul 2024 10:37:32 +0000 (12:37 +0200)
commit6be74ddd0609959b4005f88b6a4d4af678e4a71f
tree33a9be1caec9b2787befe9cb843a38fe9a9b76bf
parentce7c90bfda2656418c69ba0dd8f8a7536b8928d4
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.
v3:
- Introduce ttm_lru_first_res_or_null()
  (Christian König, Thomas Hellström)
v5:
- Update also the TTM test code (Xe CI).

Cc: Christian König <christian.koenig@amd.com>
Cc: Somalapuram Amaranath <Amaranath.Somalapuram@amd.com>
Cc: Matthew Brost <matthew.brost@intel.com>
Cc: <dri-devel@lists.freedesktop.org>
Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240705153206.68526-2-thomas.hellstrom@linux.intel.com
Signed-off-by: Christian König <christian.koenig@amd.com>
drivers/gpu/drm/ttm/tests/ttm_bo_test.c
drivers/gpu/drm/ttm/tests/ttm_resource_test.c
drivers/gpu/drm/ttm/ttm_device.c
drivers/gpu/drm/ttm/ttm_resource.c
include/drm/ttm/ttm_resource.h