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
This commit is contained in:
@@ -170,6 +170,19 @@ int ttm_tt_populate(struct ttm_device *bdev, struct ttm_tt *ttm, struct ttm_oper
|
||||
*/
|
||||
void ttm_tt_unpopulate(struct ttm_device *bdev, struct ttm_tt *ttm);
|
||||
|
||||
/**
|
||||
* ttm_tt_mark_for_clear - Mark pages for clearing on populate.
|
||||
*
|
||||
* @ttm: Pointer to the ttm_tt structure
|
||||
*
|
||||
* Marks pages for clearing so that the next time the page vector is
|
||||
* populated, the pages will be cleared.
|
||||
*/
|
||||
static inline void ttm_tt_mark_for_clear(struct ttm_tt *ttm)
|
||||
{
|
||||
ttm->page_flags |= TTM_PAGE_FLAG_ZERO_ALLOC;
|
||||
}
|
||||
|
||||
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,
|
||||
|
||||
Reference in New Issue
Block a user