From: Imre Deak <imre.deak@intel.com>
To: "Chris Wilson" <chris@chris-wilson.co.uk>,
intel-gfx@lists.freedesktop.org,
"Ville Syrjälä" <ville.syrjala@linux.intel.com>,
stable@vger.kernel.org
Subject: Re: [PATCH] drm/i915/gen9: Increase PCODE request timeout to 100ms
Date: Tue, 21 Feb 2017 11:22:12 +0200 [thread overview]
Message-ID: <20170221092212.GA4428@ideak-desk.fi.intel.com> (raw)
In-Reply-To: <20170220160533.GO11809@nuc-i3427.alporthouse.com>
On Mon, Feb 20, 2017 at 04:05:33PM +0000, Chris Wilson wrote:
> On Mon, Feb 20, 2017 at 05:29:44PM +0200, Imre Deak wrote:
> > After
> > commit 2c7d0602c815277f7cb7c932b091288710d8aba7
> > Author: Imre Deak <imre.deak@intel.com>
> > Date: Mon Dec 5 18:27:37 2016 +0200
> >
> > drm/i915/gen9: Fix PCODE polling during CDCLK change notification
> >
> > there is still one report of the CDCLK-change request timing out on a
> > KBL machine, see the Reference link. On that machine the maximum time
> > the request took to succeed was 34ms, so increase the timeout to 100ms.
> >
> > Reference: https://bugs.freedesktop.org/show_bug.cgi?id=99345
> > Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > Cc: Chris Wilson <chris@chris-wilson.co.uk>
> > Cc: <stable@vger.kernel.org>
> > Signed-off-by: Imre Deak <imre.deak@intel.com>
> > ---
> > drivers/gpu/drm/i915/intel_drv.h | 2 +-
> > drivers/gpu/drm/i915/intel_pm.c | 11 ++++++-----
> > 2 files changed, 7 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> > index 821c57c..7970ba8 100644
> > --- a/drivers/gpu/drm/i915/intel_drv.h
> > +++ b/drivers/gpu/drm/i915/intel_drv.h
> > @@ -87,7 +87,7 @@
> > int cpu, ret, timeout = (US) * 1000; \
> > u64 base; \
> > _WAIT_FOR_ATOMIC_CHECK(ATOMIC); \
> > - BUILD_BUG_ON((US) > 50000); \
> > + BUILD_BUG_ON((US) > 100000); \
> > if (!(ATOMIC)) { \
> > preempt_disable(); \
> > cpu = smp_processor_id(); \
> > diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> > index fe243c6..90134b0 100644
> > --- a/drivers/gpu/drm/i915/intel_pm.c
> > +++ b/drivers/gpu/drm/i915/intel_pm.c
> > @@ -7910,10 +7910,10 @@ static bool skl_pcode_try_request(struct drm_i915_private *dev_priv, u32 mbox,
> > * @timeout_base_ms: timeout for polling with preemption enabled
> > *
> > * Keep resending the @request to @mbox until PCODE acknowledges it, PCODE
> > - * reports an error or an overall timeout of @timeout_base_ms+10 ms expires.
> > + * reports an error or an overall timeout of @timeout_base_ms+100 ms expires.
> > * The request is acknowledged once the PCODE reply dword equals @reply after
> > * applying @reply_mask. Polling is first attempted with preemption enabled
> > - * for @timeout_base_ms and if this times out for another 10 ms with
> > + * for @timeout_base_ms and if this times out for another 100 ms with
> > * preemption disabled.
> > *
> > * Returns 0 on success, %-ETIMEDOUT in case of a timeout, <0 in case of some
> > @@ -7949,14 +7949,15 @@ int skl_pcode_request(struct drm_i915_private *dev_priv, u32 mbox, u32 request,
> > * worst case) _and_ PCODE was busy for some reason even after a
> > * (queued) request and @timeout_base_ms delay. As a workaround retry
> > * the poll with preemption disabled to maximize the number of
> > - * requests. Increase the timeout from @timeout_base_ms to 10ms to
> > + * requests. Increase the timeout from @timeout_base_ms to 100ms to
> > * account for interrupts that could reduce the number of these
> > - * requests.
> > + * requests, and for any quirks of the PCODE firmware that delays
> > + * the request completion.
> > */
> > DRM_DEBUG_KMS("PCODE timeout, retrying with preemption disabled\n");
> > WARN_ON_ONCE(timeout_base_ms > 3);
> > preempt_disable();
> > - ret = wait_for_atomic(COND, 10);
> > + ret = wait_for_atomic(COND, 100);
> > preempt_enable();
>
> Ugh. Straw + camel. How about something like:
>
> __try_request_atomic:
> cond_resched();
>
> preempt_disable()
> ret = COND ? wait_for_atomic(COND, 10) : 0;
> preempt_enable();
> return ret;
>
> try_request:
> ret = wait_for(__try_request_atomic() == 0, 100);
>
> So that our preempt-off period doesn't grow completely unchecked, or do
> we need that 34ms loop?
Yes, that's at least how I understand it. Scheduling away is what let's
PCODE start servicing some other request than ours or go idle. That's
in a way what we see when the preempt-enabled poll times out.
--Imre
next prev parent reply other threads:[~2017-02-21 9:22 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-20 15:29 [PATCH] drm/i915/gen9: Increase PCODE request timeout to 100ms Imre Deak
2017-02-20 16:05 ` Chris Wilson
2017-02-21 9:22 ` Imre Deak [this message]
2017-02-21 9:37 ` Chris Wilson
2017-02-21 10:06 ` [Intel-gfx] " Tvrtko Ursulin
2017-02-21 12:43 ` Imre Deak
2017-02-21 13:11 ` Tvrtko Ursulin
2017-02-21 14:13 ` [Intel-gfx] " Imre Deak
2017-02-21 14:16 ` Tvrtko Ursulin
2017-02-21 13:19 ` [Intel-gfx] " Chris Wilson
2017-02-21 14:18 ` Imre Deak
2017-02-20 17:22 ` ✓ Fi.CI.BAT: success for " Patchwork
2017-02-24 14:32 ` [PATCH v2] drm/i915/gen9: Increase PCODE request timeout to 50ms Imre Deak
2017-02-24 15:52 ` ✓ Fi.CI.BAT: success for drm/i915/gen9: Increase PCODE request timeout to 100ms (rev2) Patchwork
2017-02-24 19:18 ` Chris Wilson
2017-03-01 11:17 ` Imre Deak
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=20170221092212.GA4428@ideak-desk.fi.intel.com \
--to=imre.deak@intel.com \
--cc=chris@chris-wilson.co.uk \
--cc=intel-gfx@lists.freedesktop.org \
--cc=stable@vger.kernel.org \
--cc=ville.syrjala@linux.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