From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [RESEND] drm/i915: Interactive RPS mode
Date: Fri, 20 Jul 2018 15:58:51 +0100 [thread overview]
Message-ID: <41fe98a2-4415-c037-e332-e217c15ff815@linux.intel.com> (raw)
In-Reply-To: <153209519767.26154.13600794889973369314@skylake-alporthouse-com>
On 20/07/2018 14:59, Chris Wilson wrote:
> Quoting Tvrtko Ursulin (2018-07-20 14:29:52)
>>
>> On 20/07/2018 14:02, Chris Wilson wrote:
>>> Quoting Tvrtko Ursulin (2018-07-20 13:49:09)
>>>>
>>>> On 12/07/2018 18:38, Chris Wilson wrote:
>>>>> + if (rps->interactive)
>>>>> + new_power = HIGH_POWER;
>>>>> + rps_set_power(dev_priv, new_power);
>>>>> + mutex_unlock(&rps->power_lock);
>>>> >
>>>> > rps->last_adj = 0;
>>>>
>>>> This block should go up to the beginning of the function since when
>>>> rps->interactive all preceding calculations are for nothing. And can
>>>> immediately return then.
>>>
>>> We have to lock around rps_set_power, so you're not going to avoid
>>> taking the lock here, so I don't think it makes any difference.
>>> Certainly neater than locking everything.
>>
>> Not to avoid the lock but to avoid all the trouble of calculating
>> new_power to override it all if rps->interactive is set. Just looks a
>> bit weird. I suspect read of rps->interactive doesn't even need to be
>> under the lock so maybe:
>>
>> if (rps->interactive)
>> new_power = HIGH_POWER;
>> } else {
>> switch (...)
>> }
>
> There is a race there, so you do need to explain why we wouldn't care.
> (There is a reasonable argument about it being periodic and we don't care
> about the first vs interactive.) I thought it came out quite neat as the
> atomic override.
Putting it all under the lock works for me then. But okay, if you so
like the override idea, which I wouldn't call neat, but unusual, it's
not the end of the world.
>>>>> +{
>>>>> + struct intel_rps *rps = &dev_priv->gt_pm.rps;
>>>>> +
>>>>> + if (INTEL_GEN(dev_priv) < 6)
>>>>> + return;
>>>>> +
>>>>> + mutex_lock(&rps->power_lock);
>>>>> + if (state) {
>>>>> + if (!rps->interactive++ && READ_ONCE(dev_priv->gt.awake))
>>>>> + rps_set_power(dev_priv, HIGH_POWER);
>>>>> + } else {
>>>>> + GEM_BUG_ON(!rps->interactive);
>>>>> + rps->interactive--;
>>>>
>>>> Hm maybe protect this in production code so some missed code flows in
>>>> the atomic paths do not cause underflow and so permanent interactive mode.
>>>
>>> Are you suggesting testing is inadequate? ;) Underflow here isn't a big
>>> deal, it just locks in the HIGH_POWER (faster sampling, bias towards
>>> upclocking). Or worse not allow HIGH_POWER, status quo returned.
>>
>> Testing for this probably is inadequate, no? Would need to be looking at
>> the new debugfs flag from many test cases. And in real world probably
>> quite difficult to debug too.
>>
>> Whether or not it would be too much to add a DRM_WARN for this.. I am
>> leaning towards saying to have it, since it is about two systems
>> communicating together so it would be easier to notice a broken
>> contract. But I don't insist on it.
>
> Just checking underflow is not going to catch many problems. If we can
> identify some points where we know what the value should be... I wonder
> if we can assert it is zero at runtime/system suspend.
True, it only catches the imbalance in one direction quickly. If suspend
idea works go with that, but what's so bad about some log messages?
Assuming leak towards the overflow direction on each flip it could be
reached in ~18 hours which is realistic to get bug reports of.
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2018-07-20 14:58 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-11 21:01 [PATCH] drm/i915: Interactive RPS mode Chris Wilson
2018-07-11 22:06 ` ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
2018-07-11 22:07 ` ✗ Fi.CI.SPARSE: " Patchwork
2018-07-11 22:23 ` ✗ Fi.CI.BAT: failure " Patchwork
2018-07-12 7:50 ` [PATCH v3] " Chris Wilson
2018-07-12 8:02 ` [PATCH v4] " Chris Wilson
2018-07-12 17:38 ` [RESEND] " Chris Wilson
2018-07-20 12:49 ` Tvrtko Ursulin
2018-07-20 13:02 ` Chris Wilson
2018-07-20 13:07 ` Ville Syrjälä
2018-07-20 13:14 ` Chris Wilson
2018-07-20 13:32 ` Ville Syrjälä
2018-07-20 13:38 ` Chris Wilson
2018-07-20 13:50 ` Ville Syrjälä
2018-07-20 14:03 ` Chris Wilson
2018-07-20 14:19 ` Ville Syrjälä
2018-07-21 8:44 ` Chris Wilson
2018-07-20 13:29 ` Tvrtko Ursulin
2018-07-20 13:59 ` Chris Wilson
2018-07-20 14:58 ` Tvrtko Ursulin [this message]
2018-07-20 15:01 ` Chris Wilson
2018-07-12 17:58 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Interactive RPS mode (rev4) Patchwork
2018-07-12 17:59 ` ✗ Fi.CI.SPARSE: " Patchwork
2018-07-12 18:15 ` ✓ Fi.CI.BAT: success " Patchwork
2018-07-23 10:01 ` [PATCH] drm/i915: Interactive RPS mode Chris Wilson
2018-07-31 13:01 ` Joonas Lahtinen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=41fe98a2-4415-c037-e332-e217c15ff815@linux.intel.com \
--to=tvrtko.ursulin@linux.intel.com \
--cc=chris@chris-wilson.co.uk \
--cc=intel-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.