[PATCH 03/10] drm/ttm: do not check if list is empty in ttm_bo_force_list_clean

Thomas Hellstrom thomas at shipmail.org
Mon Nov 19 23:42:46 PST 2012


On 11/19/2012 03:10 PM, Maarten Lankhorst wrote:
> Op 19-11-12 14:33, Thomas Hellstrom schreef:
>> On 11/12/2012 03:00 PM, Maarten Lankhorst wrote:
>>> Just use the return error from ttm_mem_evict_first instead.
>> Here driver need to be able to evict a memory type completely, because they might shut down
>> the memory type or clear it for some legacy usage, suspending or whatever, so returning 0 on -EBUSY isn't sufficient,
>> we need at least a list empty check, and a shared reservation at this point is illegal.
>>
>> This is a point where the mechanism to exclude other reservers is needed, as we discussed previously.
>> vmwgfx is using the ttm lock, but will of course adapt if a new mechanism is emerging.
> Normally ttm_mem_evict_first only returns -EBUSY if the list is empty and no_wait = false,
> so I thought using the return code would be equivalent.
>
> We could do spin_lock(&glob->lru_lock); WARN_ON(!list_empty(&man->lru_lock)); spin_unlock(&glob->lru_lock); to handle this after -EBUSY.
>
> With a lot of objects on the lru list, this would save taking lru_lock twice for each object.
>
> ~Maarten

Sure, and in the allow_errors case we should return an error if the list 
isn't empty, to allow careful drivers to deal with that.

/Thomas



>
> _______________________________________________
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel





More information about the dri-devel mailing list