All of lore.kernel.org
 help / color / mirror / Atom feed
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 2/2] drm/i915: Use wait_for_atomic_us when waiting for gt fifo
Date: Thu, 06 Apr 2017 12:32:05 +0300	[thread overview]
Message-ID: <87y3vdg9uy.fsf@gaia.fi.intel.com> (raw)
In-Reply-To: <20170406091254.GY10496@nuc-i3427.alporthouse.com>

Chris Wilson <chris@chris-wilson.co.uk> writes:

> On Thu, Apr 06, 2017 at 11:44:19AM +0300, Mika Kuoppala wrote:
>> Replace the handcrafter loop when checking for fifo slots
>> with atomic wait for. This brings this wait in line with
>> the other waits on register access. We also get a readable
>> timeout constraint, so make it to fail after 10ms.
>> 
>> Chris suggested that we should fail silently as the fifo debug
>> handler, now attached to unclaimed mmio handling, will take care of the
>> possible errors at later stage.
>> 
>> Note that the decision to wait was changed so that we avoid
>> allocating the first reserved entry. Nor do we reduce the count
>> if we fail the wait, removing the possiblity to wrap the
>> count if the hw fifo returned zero.
>
> Otoh, we don't abort the write so the slot is still taken. Nor does it
> update the last known fifo_count along that path.
>
> However, we leave it set to a value that will cause us to reread the
> counter on the next call, so it comes out in the wash.
>
>> 
>> References: https://bugs.freedesktop.org/show_bug.cgi?id=100247
>> Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
>> ---
>>  drivers/gpu/drm/i915/intel_uncore.c | 30 +++++++++++++++---------------
>>  1 file changed, 15 insertions(+), 15 deletions(-)
>> 
>> diff --git a/drivers/gpu/drm/i915/intel_uncore.c b/drivers/gpu/drm/i915/intel_uncore.c
>> index a129a73..df744a8 100644
>> --- a/drivers/gpu/drm/i915/intel_uncore.c
>> +++ b/drivers/gpu/drm/i915/intel_uncore.c
>> @@ -29,6 +29,7 @@
>>  #include <linux/pm_runtime.h>
>>  
>>  #define FORCEWAKE_ACK_TIMEOUT_MS 50
>> +#define GT_FIFO_TIMEOUT_MS	 10
>>  
>>  #define __raw_posting_read(dev_priv__, reg__) (void)__raw_i915_read32((dev_priv__), (reg__))
>>  
>> @@ -181,28 +182,27 @@ static inline u32 fifo_free_entries(struct drm_i915_private *dev_priv)
>>  
>>  static int __gen6_gt_wait_for_fifo(struct drm_i915_private *dev_priv)
>>  {
>> -	int ret = 0;
>> +	u32 n;
>>  
>>  	/* On VLV, FIFO will be shared by both SW and HW.
>>  	 * So, we need to read the FREE_ENTRIES everytime */
>>  	if (IS_VALLEYVIEW(dev_priv))
>> -		dev_priv->uncore.fifo_count = fifo_free_entries(dev_priv);
>> -
>> -	if (dev_priv->uncore.fifo_count < GT_FIFO_NUM_RESERVED_ENTRIES) {
>> -		int loop = 500;
>> -		u32 fifo = fifo_free_entries(dev_priv);
>> -
>> -		while (fifo <= GT_FIFO_NUM_RESERVED_ENTRIES && loop--) {
>> -			udelay(10);
>> -			fifo = fifo_free_entries(dev_priv);
>> +		n = fifo_free_entries(dev_priv);
>> +	else
>> +		n = dev_priv->uncore.fifo_count;
>> +
>> +	if (n <= GT_FIFO_NUM_RESERVED_ENTRIES) {
>> +		if (wait_for_atomic((n = fifo_free_entries(dev_priv)) >
>> +				    GT_FIFO_NUM_RESERVED_ENTRIES,
>> +				    GT_FIFO_TIMEOUT_MS)) {
>> +			DRM_DEBUG("GT_FIFO timeout, entries: %u, unclaimed: %d\n", n,
>> +				  intel_uncore_unclaimed_mmio(dev_priv));
>
> What's the connection here between unclaimed mmio and the fifo count?
> i.e. what information do we glean? Espcially as this information is part
> of the generic mmio framework already.
>

To trigger fifodbg check and clean. And to get a trace from this exact spot.
So this battles against the commit message to leave the warn into the
unclaimed handling. I will remove it.

-Mika

>> +			return -EBUSY;
>>  		}
>> -		if (WARN_ON(loop < 0 && fifo <= GT_FIFO_NUM_RESERVED_ENTRIES))
>> -			++ret;
>> -		dev_priv->uncore.fifo_count = fifo;
>>  	}
>> -	dev_priv->uncore.fifo_count--;
>
> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
> -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

  reply	other threads:[~2017-04-06  9:32 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-06  8:44 [PATCH 1/2] drm/i915: Move the GTFIFODBG to the common mmio dbg framework Mika Kuoppala
2017-04-06  8:44 ` [PATCH 2/2] drm/i915: Use wait_for_atomic_us when waiting for gt fifo Mika Kuoppala
2017-04-06  9:12   ` Chris Wilson
2017-04-06  9:32     ` Mika Kuoppala [this message]
2017-04-06 15:40     ` Mika Kuoppala
2017-04-06 15:46       ` Chris Wilson
2017-05-03  9:54         ` Mika Kuoppala
2017-05-02 14:03       ` Mika Kuoppala
2017-04-06  9:03 ` [PATCH 1/2] drm/i915: Move the GTFIFODBG to the common mmio dbg framework Chris Wilson
2017-04-06  9:14   ` Chris Wilson
2017-04-06 15:39     ` Mika Kuoppala
2017-04-06 15:46       ` Ville Syrjälä
2017-04-06 16:05         ` Chris Wilson
2017-04-06 16:25           ` Ville Syrjälä
2017-04-06  9:35 ` ✗ Fi.CI.BAT: warning for series starting with [1/2] " Patchwork
2017-04-06 11:13   ` Mika Kuoppala
2017-04-06 11:32     ` Chris Wilson
2017-04-06 16:04 ` ✓ Fi.CI.BAT: success for series starting with [1/2] drm/i915: Move the GTFIFODBG to the common mmio dbg framework (rev2) Patchwork
2017-04-06 16:24 ` ✗ Fi.CI.BAT: failure for series starting with [1/2] drm/i915: Move the GTFIFODBG to the common mmio dbg framework (rev3) Patchwork
2017-05-02 14:27 ` ✓ Fi.CI.BAT: success for series starting with [1/2] drm/i915: Move the GTFIFODBG to the common mmio dbg framework (rev4) Patchwork

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=87y3vdg9uy.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.