Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>,
	intel-gfx@lists.freedesktop.org,
	Mika Kuoppala <mika.kuoppala@intel.com>
Subject: Re: [PATCH 1/2] drm/i915: Compute the fw_domain id from the mask
Date: Mon, 22 May 2017 09:00:19 +0100	[thread overview]
Message-ID: <5d9facd3-9062-53d8-ca04-7899e95b415c@linux.intel.com> (raw)
In-Reply-To: <20170515104502.GC19912@nuc-i3427.alporthouse.com>


On 15/05/2017 11:45, Chris Wilson wrote:
> On Mon, May 15, 2017 at 11:18:11AM +0100, Tvrtko Ursulin wrote:
>>
>> On 12/05/2017 14:53, Chris Wilson wrote:
>>> Storing both the mask and the id is redundant as we can trivially
>>> compute one from the other. As the mask is more frequently used, remove
>>> the id.
>>>
>>> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
>>> Cc: Mika Kuoppala <mika.kuoppala@intel.com>
>>> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>>> ---
>>> drivers/gpu/drm/i915/i915_debugfs.c |  2 +-
>>> drivers/gpu/drm/i915/intel_uncore.c | 12 ++++++------
>>> drivers/gpu/drm/i915/intel_uncore.h |  6 ++----
>>> 3 files changed, 9 insertions(+), 11 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
>>> index bd9abef40c66..a2c9c3e792e1 100644
>>> --- a/drivers/gpu/drm/i915/i915_debugfs.c
>>> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
>>> @@ -1468,7 +1468,7 @@ static int i915_forcewake_domains(struct seq_file *m, void *data)
>>>
>>> 	for_each_fw_domain(fw_domain, i915, tmp)
>>> 		seq_printf(m, "%s.wake_count = %u\n",
>>> -			   intel_uncore_forcewake_domain_to_str(fw_domain->id),
>>> +			   intel_uncore_forcewake_domain_to_str(fw_domain),
>>> 			   READ_ONCE(fw_domain->wake_count));
>>>
>>> 	return 0;
>>> diff --git a/drivers/gpu/drm/i915/intel_uncore.c b/drivers/gpu/drm/i915/intel_uncore.c
>>> index 08d7d08438c0..7eaa592aed26 100644
>>> --- a/drivers/gpu/drm/i915/intel_uncore.c
>>> +++ b/drivers/gpu/drm/i915/intel_uncore.c
>>> @@ -40,8 +40,10 @@ static const char * const forcewake_domain_names[] = {
>>> };
>>>
>>> const char *
>>> -intel_uncore_forcewake_domain_to_str(const enum forcewake_domain_id id)
>>> +intel_uncore_forcewake_domain_to_str(const struct intel_uncore_forcewake_domain *d)
>>> {
>>> +	unsigned int id = ilog2(d->mask);
>>> +
>>> 	BUILD_BUG_ON(ARRAY_SIZE(forcewake_domain_names) != FW_DOMAIN_ID_COUNT);
>>>
>>> 	if (id >= 0 && id < FW_DOMAIN_ID_COUNT)
>>> @@ -77,7 +79,7 @@ fw_domain_wait_ack_clear(const struct drm_i915_private *i915,
>>> 			     FORCEWAKE_KERNEL) == 0,
>>> 			    FORCEWAKE_ACK_TIMEOUT_MS))
>>> 		DRM_ERROR("%s: timed out waiting for forcewake ack to clear.\n",
>>> -			  intel_uncore_forcewake_domain_to_str(d->id));
>>> +			  intel_uncore_forcewake_domain_to_str(d));
>>> }
>>>
>>> static inline void
>>> @@ -95,7 +97,7 @@ fw_domain_wait_ack(const struct drm_i915_private *i915,
>>> 			     FORCEWAKE_KERNEL),
>>> 			    FORCEWAKE_ACK_TIMEOUT_MS))
>>> 		DRM_ERROR("%s: timed out waiting for forcewake ack request.\n",
>>> -			  intel_uncore_forcewake_domain_to_str(d->id));
>>> +			  intel_uncore_forcewake_domain_to_str(d));
>>> }
>>>
>>> static inline void
>>> @@ -209,7 +211,7 @@ intel_uncore_fw_release_timer(struct hrtimer *timer)
>>> 	struct intel_uncore_forcewake_domain *domain =
>>> 	       container_of(timer, struct intel_uncore_forcewake_domain, timer);
>>> 	struct drm_i915_private *dev_priv =
>>> -		container_of(domain, struct drm_i915_private, uncore.fw_domain[domain->id]);
>>> +		container_of(domain, struct drm_i915_private, uncore.fw_domain[ilog2(domain->mask)]);
>>
>> Not sure I see the benefit of removing one field and then needing
>> this ilog2 in the timer callback.
>
> Timer was infrequent enough compared to the other paths that the extra
> instruction seemed a matter of little concern, and out of the way.

On one hand that's true, one the other it just looks inelegant.

Would storing a backpointer to intel_uncore from each domain be 
acceptable or it would defeat the purpose?

Regards,

Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

      reply	other threads:[~2017-05-22  8:00 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-12 13:53 [PATCH 1/2] drm/i915: Compute the fw_domain id from the mask Chris Wilson
2017-05-12 13:53 ` [PATCH 2/2] drm/i915: Keep the forcewake timer alive for 1ms past the most recent use Chris Wilson
2017-05-12 22:16   ` [PATCH v2] " Chris Wilson
2017-05-15 10:14     ` Tvrtko Ursulin
2017-05-15 10:41       ` Chris Wilson
2017-05-15 12:06         ` Tvrtko Ursulin
2017-05-15 12:35           ` Chris Wilson
2017-05-22  8:03             ` Tvrtko Ursulin
2017-05-15 11:20     ` Mika Kuoppala
2017-05-15 12:02       ` Chris Wilson
2017-05-12 14:39 ` ✗ Fi.CI.BAT: failure for series starting with [1/2] drm/i915: Compute the fw_domain id from the mask Patchwork
2017-05-12 22:46 ` ✗ Fi.CI.BAT: warning for series starting with [1/2] drm/i915: Compute the fw_domain id from the mask (rev2) Patchwork
2017-05-15 10:18 ` [PATCH 1/2] drm/i915: Compute the fw_domain id from the mask Tvrtko Ursulin
2017-05-15 10:45   ` Chris Wilson
2017-05-22  8:00     ` Tvrtko Ursulin [this message]

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=5d9facd3-9062-53d8-ca04-7899e95b415c@linux.intel.com \
    --to=tvrtko.ursulin@linux.intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=mika.kuoppala@intel.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox