[Intel-gfx] [PATCH v4 2/3] drm/i915: Fix userptr deadlock with aliased GTT mmappings

Tvrtko Ursulin tvrtko.ursulin at linux.intel.com
Thu Sep 10 03:31:36 PDT 2015


On 09/10/2015 11:25 AM, Tvrtko Ursulin wrote:
>> +
>> +    active = false;
>> +    if (pinned < 0)
>> +        ret = pinned;
>> +    else if (pinned < num_pages)
>> +        ret = __i915_gem_userptr_get_pages_schedule(obj, &active);
>> +    else
>>           ret = __i915_gem_userptr_set_pages(obj, pvec, num_pages);
>> -        if (ret == 0) {
>> -            obj->userptr.work = NULL;
>> -            pinned = 0;
>> -        }
>> +    if (ret) {
>> +        __i915_gem_userptr_set_active(obj, active);
>> +        release_pages(pvec, pinned, 0);
>
> I think it would be safer to set pinned to zero in the pinned < 0 case,
> rather than rely on release_pages implementation knowledge. Otherwise it
> is too fragile.
>
> If you can put that back you can put my R-B on the patch.

Or possibly even better:

if (pinned >= 0)
	release_pages(...);

?

Tvrtko



More information about the Intel-gfx mailing list