From: Mika Kuoppala <mika.kuoppala@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 3/3] drm/i915: Check the ring is empty when declaring the engines are idle
Date: Wed, 31 May 2017 17:01:53 +0300 [thread overview]
Message-ID: <87lgpdrupa.fsf@gaia.fi.intel.com> (raw)
In-Reply-To: <20170531135835.GT23936@nuc-i3427.alporthouse.com>
Chris Wilson <chris@chris-wilson.co.uk> writes:
> On Tue, May 30, 2017 at 03:33:41PM +0300, Mika Kuoppala wrote:
>> Chris Wilson <chris@chris-wilson.co.uk> writes:
>>
>> > As another precaution when testing whether the CS engine is actually
>> > idle, also inspect the ring's HEAD/TAIL registers, which should be equal
>> > when there are no commands left to execute by the GPU.
>> >
>> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
>> > Cc: Mika Kuoppala <mika.kuoppala@intel.com>
>> > ---
>> > drivers/gpu/drm/i915/intel_engine_cs.c | 5 +++++
>> > 1 file changed, 5 insertions(+)
>> >
>> > diff --git a/drivers/gpu/drm/i915/intel_engine_cs.c b/drivers/gpu/drm/i915/intel_engine_cs.c
>> > index 699f2d3861c7..bc38bd128b76 100644
>> > --- a/drivers/gpu/drm/i915/intel_engine_cs.c
>> > +++ b/drivers/gpu/drm/i915/intel_engine_cs.c
>> > @@ -1212,6 +1212,11 @@ static bool ring_is_idle(struct intel_engine_cs *engine)
>> >
>> > intel_runtime_pm_get(dev_priv);
>> >
>> > + /* First check that no commands are left in the ring */
>> > + if ((I915_READ_HEAD(engine) & HEAD_ADDR) !=
>> > + (I915_READ_TAIL(engine) & TAIL_ADDR))
>> > + idle = false;
>> > +
>>
>> You are already certain that is not idle so why not goto out?
>
> In this case I could argue that extra path for the jump is not worth it.
> It saves a mmio read, yes, but will any one notice?
and one write :P
> It boils down to is it easier to read as:
>
Sold. It is easier to read as is. 3/3 is
Reviewed-by: Mika Kuoppala <mika.kuoppala@intel.com>
> static bool ring_is_idle(struct intel_engine_cs *engine)
> {
> struct drm_i915_private *dev_priv = engine->i915;
> bool idle = false;
>
> intel_runtime_pm_get(dev_priv);
>
> /* First check that no commands are left in the ring */
> if ((I915_READ_HEAD(engine) & HEAD_ADDR) !=
> (I915_READ_TAIL(engine) & TAIL_ADDR))
> goto busy;
>
> /* No bit for gen2, so assume the CS parser is idle */
> if (INTEL_GEN(dev_priv) > 2 && !(I915_READ_MODE(engine) & MODE_IDLE))
> goto busy;
>
> idle = true;
> busy:
> intel_runtime_pm_put(dev_priv);
>
> return idle;
> }
>
> First instinct would be no because of the goto.
> -Chris
>
> --
> Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2017-05-31 14:02 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-30 12:13 [PATCH 1/3] drm/i915: Short-circuit i915_gem_wait_for_idle() if already idle Chris Wilson
2017-05-30 12:13 ` [PATCH 2/3] drm/i915: Hold a wakeref for probing the ring registers Chris Wilson
2017-05-30 12:37 ` Tvrtko Ursulin
2017-05-30 12:50 ` Chris Wilson
2017-05-30 13:09 ` Tvrtko Ursulin
2017-05-30 12:38 ` Mika Kuoppala
2017-05-30 12:13 ` [PATCH 3/3] drm/i915: Check the ring is empty when declaring the engines are idle Chris Wilson
2017-05-30 12:33 ` Mika Kuoppala
2017-05-31 13:58 ` Chris Wilson
2017-05-31 14:01 ` Mika Kuoppala [this message]
2017-06-01 13:24 ` Chris Wilson
2017-05-30 12:21 ` [PATCH 1/3] drm/i915: Short-circuit i915_gem_wait_for_idle() if already idle Tvrtko Ursulin
2017-05-30 12:36 ` Chris Wilson
2017-05-30 12:37 ` Mika Kuoppala
2017-05-30 12:41 ` Joonas Lahtinen
2017-05-30 12:46 ` Chris Wilson
2017-05-30 14:09 ` ✓ Fi.CI.BAT: success for series starting with [1/3] " Patchwork
2017-05-30 16:20 ` Chris Wilson
2017-05-30 19:18 ` Saarinen, Jani
2017-05-30 19:39 ` Chris Wilson
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=87lgpdrupa.fsf@gaia.fi.intel.com \
--to=mika.kuoppala@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.