drm/ttm: Document and optimize ttm_bo_pipeline_gutting()
authorThomas Hellström <thomas.hellstrom@linux.intel.com>
Wed, 2 Jun 2021 08:38:13 +0000 (10:38 +0200)
committerThomas Hellström <thomas.hellstrom@linux.intel.com>
Mon, 7 Jun 2021 14:07:08 +0000 (16:07 +0200)
commita3be8cd70fec2aa8913b59c9026031205c29df28
tree6b6bd93da399fd77d6ca54d4c045e73cf7a57c3a
parent053c57696cb99c35859e9e9cc58c7d00e434d956
drm/ttm: Document and optimize ttm_bo_pipeline_gutting()

If the bo is idle when calling ttm_bo_pipeline_gutting(), we unnecessarily
create a ghost object and push it out to delayed destroy.
Fix this by adding a path for idle, and document the function.

Also avoid having the bo end up in a bad state vulnerable to user-space
triggered kernel BUGs if the call to ttm_tt_create() fails.

Finally reuse ttm_bo_pipeline_gutting() in ttm_bo_evict().

Cc: Christian König <christian.koenig@amd.com>
Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Link: https://lore.kernel.org/r/20210602083818.241793-7-thomas.hellstrom@linux.intel.com
drivers/gpu/drm/ttm/ttm_bo.c
drivers/gpu/drm/ttm/ttm_bo_util.c
include/drm/ttm/ttm_tt.h