[Intel-gfx] [PATCH 12/46] drm/i915/gem: Track the rpm wakerefs
John Harrison
John.C.Harrison at Intel.com
Wed Jan 9 23:45:21 UTC 2019
On 1/9/2019 03:16, Mika Kuoppala wrote:
> Chris Wilson <chris at chris-wilson.co.uk> writes:
>
>> diff --git a/drivers/gpu/drm/i915/i915_gem_shrinker.c b/drivers/gpu/drm/i915/i915_gem_shrinker.c
>> index 16693dd4d019..bc230e43b98f 100644
>> --- a/drivers/gpu/drm/i915/i915_gem_shrinker.c
>> +++ b/drivers/gpu/drm/i915/i915_gem_shrinker.c
>> @@ -154,6 +154,7 @@ i915_gem_shrink(struct drm_i915_private *i915,
>> { &i915->mm.bound_list, I915_SHRINK_BOUND },
>> { NULL, 0 },
>> }, *phase;
>> + intel_wakeref_t wakeref = 0;
>> unsigned long count = 0;
>> unsigned long scanned = 0;
>> bool unlock;
>> @@ -183,9 +184,11 @@ i915_gem_shrink(struct drm_i915_private *i915,
>> * device just to recover a little memory. If absolutely necessary,
>> * we will force the wake during oom-notifier.
>> */
>> - if ((flags & I915_SHRINK_BOUND) &&
>> - !intel_runtime_pm_get_if_in_use(i915))
>> - flags &= ~I915_SHRINK_BOUND;
>> + if (flags & I915_SHRINK_BOUND) {
>> + wakeref = intel_runtime_pm_get_if_in_use(i915);
>> + if (!wakeref)
>> + flags &= ~I915_SHRINK_BOUND;
>> + }
>>
>> /*
>> * As we may completely rewrite the (un)bound list whilst unbinding
>> @@ -266,7 +269,7 @@ i915_gem_shrink(struct drm_i915_private *i915,
>> }
>>
>> if (flags & I915_SHRINK_BOUND)
>> - intel_runtime_pm_put_unchecked(i915);
>> + intel_runtime_pm_put(i915, wakeref);
> This is ok but raises a question that did we have
> GEM_BUG_ON(wakeref == 0) on pm_put? Perhaps not needed
> per se as we do find that we don't have ref for 0.
>
> Reviewed-by: Mika Kuoppala <mika.kuoppala at linux.intel.com>
>
There is a WARN not a BUG if pm_put() is called with a zero wakeref (in
the cancel_ function after the search fails to find a match with zero).
However, the flag checks mean that it can't happen from here.
John.
More information about the Intel-gfx
mailing list