mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-29 05:44:11 +00:00
drm/i915: Add ww ctx to i915_gem_object_trylock
This is required for i915_gem_evict_vm, to be able to evict the entire VM, including objects that are already locked to the current ww ctx. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: Matthew Auld <matthew.auld@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20211216142749.1966107-12-maarten.lankhorst@linux.intel.com
This commit is contained in:
parent
be7612fd66
commit
d8be1357ed
6 changed files with 12 additions and 8 deletions
|
@ -210,9 +210,13 @@ static inline int i915_gem_object_lock_interruptible(struct drm_i915_gem_object
|
|||
return __i915_gem_object_lock(obj, ww, true);
|
||||
}
|
||||
|
||||
static inline bool i915_gem_object_trylock(struct drm_i915_gem_object *obj)
|
||||
static inline bool i915_gem_object_trylock(struct drm_i915_gem_object *obj,
|
||||
struct i915_gem_ww_ctx *ww)
|
||||
{
|
||||
return dma_resv_trylock(obj->base.resv);
|
||||
if (!ww)
|
||||
return dma_resv_trylock(obj->base.resv);
|
||||
else
|
||||
return ww_mutex_trylock(&obj->base.resv->lock, &ww->ctx);
|
||||
}
|
||||
|
||||
static inline void i915_gem_object_unlock(struct drm_i915_gem_object *obj)
|
||||
|
|
|
@ -216,7 +216,7 @@ i915_gem_shrink(struct i915_gem_ww_ctx *ww,
|
|||
|
||||
/* May arrive from get_pages on another bo */
|
||||
if (!ww) {
|
||||
if (!i915_gem_object_trylock(obj))
|
||||
if (!i915_gem_object_trylock(obj, NULL))
|
||||
goto skip;
|
||||
} else {
|
||||
err = i915_gem_object_lock(obj, ww);
|
||||
|
@ -410,7 +410,7 @@ i915_gem_shrinker_vmap(struct notifier_block *nb, unsigned long event, void *ptr
|
|||
if (!vma->iomap || i915_vma_is_active(vma))
|
||||
continue;
|
||||
|
||||
if (!i915_gem_object_trylock(obj))
|
||||
if (!i915_gem_object_trylock(obj, NULL))
|
||||
continue;
|
||||
|
||||
if (__i915_vma_unbind(vma) == 0)
|
||||
|
|
|
@ -656,7 +656,7 @@ static int __i915_gem_object_create_stolen(struct intel_memory_region *mem,
|
|||
cache_level = HAS_LLC(mem->i915) ? I915_CACHE_LLC : I915_CACHE_NONE;
|
||||
i915_gem_object_set_cache_coherency(obj, cache_level);
|
||||
|
||||
if (WARN_ON(!i915_gem_object_trylock(obj)))
|
||||
if (WARN_ON(!i915_gem_object_trylock(obj, NULL)))
|
||||
return -EBUSY;
|
||||
|
||||
i915_gem_object_init_memory_region(obj, mem);
|
||||
|
|
|
@ -26,7 +26,7 @@ static void dbg_poison_ce(struct intel_context *ce)
|
|||
int type = i915_coherent_map_type(ce->engine->i915, obj, true);
|
||||
void *map;
|
||||
|
||||
if (!i915_gem_object_trylock(obj))
|
||||
if (!i915_gem_object_trylock(obj, NULL))
|
||||
return;
|
||||
|
||||
map = i915_gem_object_pin_map(obj, type);
|
||||
|
|
|
@ -17,7 +17,7 @@ static int mock_timeline_pin(struct intel_timeline *tl)
|
|||
{
|
||||
int err;
|
||||
|
||||
if (WARN_ON(!i915_gem_object_trylock(tl->hwsp_ggtt->obj)))
|
||||
if (WARN_ON(!i915_gem_object_trylock(tl->hwsp_ggtt->obj, NULL)))
|
||||
return -EBUSY;
|
||||
|
||||
err = intel_timeline_pin_map(tl);
|
||||
|
|
|
@ -465,7 +465,7 @@ create_init_lmem_internal(struct intel_gt *gt, size_t sz, bool try_lmem)
|
|||
return obj;
|
||||
}
|
||||
|
||||
i915_gem_object_trylock(obj);
|
||||
i915_gem_object_trylock(obj, NULL);
|
||||
err = i915_gem_object_pin_pages(obj);
|
||||
if (err) {
|
||||
i915_gem_object_unlock(obj);
|
||||
|
|
Loading…
Reference in a new issue