Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Mika Kuoppala <mika.kuoppala@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Subject: Re: [Intel-gfx] [PATCH 1/3] drm/i915: Remove livelock from "do_idle_maps" vtd w/a
Date: Wed, 09 Dec 2020 17:21:02 +0200	[thread overview]
Message-ID: <87zh2nkntt.fsf@gaia.fi.intel.com> (raw)
In-Reply-To: <20201208231834.24812-1-chris@chris-wilson.co.uk>

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

> A call to wait for the GT to idle from inside the put_pages fallback is
> prone to cause an uninterruptible livelock. As it does not provide
> adequate serialisation with new requests, simply fallback to a trial

s/trial/trivial
> sleep.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>

> ---
>  drivers/gpu/drm/i915/i915_gem_gtt.c | 25 ++++++++++---------------
>  1 file changed, 10 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
> index c5ee1567f3d1..d2350a4c6606 100644
> --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
> @@ -55,22 +55,17 @@ int i915_gem_gtt_prepare_pages(struct drm_i915_gem_object *obj,
>  void i915_gem_gtt_finish_pages(struct drm_i915_gem_object *obj,
>  			       struct sg_table *pages)
>  {
> -	struct drm_i915_private *dev_priv = to_i915(obj->base.dev);
> -	struct device *kdev = &dev_priv->drm.pdev->dev;
> -	struct i915_ggtt *ggtt = &dev_priv->ggtt;
> -
> -	if (unlikely(ggtt->do_idle_maps)) {
> -		/* XXX This does not prevent more requests being submitted! */
> -		if (intel_gt_retire_requests_timeout(ggtt->vm.gt,
> -						     -MAX_SCHEDULE_TIMEOUT)) {
> -			drm_err(&dev_priv->drm,
> -				"Failed to wait for idle; VT'd may hang.\n");
> -			/* Wait a bit, in hopes it avoids the hang */
> -			udelay(10);
> -		}
> -	}
> +	struct drm_i915_private *i915 = to_i915(obj->base.dev);
> +	struct i915_ggtt *ggtt = &i915->ggtt;
> +
> +	/* XXX This does not prevent more requests being submitted! */
> +	if (unlikely(ggtt->do_idle_maps))
> +		/* Wait a bit, in hope it avoids the hang */
> +		usleep_range(100, 250);
>  
> -	dma_unmap_sg(kdev, pages->sgl, pages->nents, PCI_DMA_BIDIRECTIONAL);
> +	dma_unmap_sg(&i915->drm.pdev->dev,
> +		     pages->sgl, pages->nents,
> +		     PCI_DMA_BIDIRECTIONAL);
>  }
>  
>  /**
> -- 
> 2.20.1
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

      parent reply	other threads:[~2020-12-09 15:23 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-08 23:18 [Intel-gfx] [PATCH 1/3] drm/i915: Remove livelock from "do_idle_maps" vtd w/a Chris Wilson
2020-12-08 23:18 ` [Intel-gfx] [PATCH 2/3] drm/i915: Sleep around performing iommu unmaps on Tigerlake Chris Wilson
2020-12-09 15:22   ` Mika Kuoppala
2020-12-08 23:18 ` [Intel-gfx] [PATCH 3/3] drm/i915/gt: Remove uninterruptible parameter from intel_gt_wait_for_idle Chris Wilson
2020-12-09 15:23   ` Mika Kuoppala
2020-12-09  0:11 ` [Intel-gfx] ✗ Fi.CI.BAT: failure for series starting with [1/3] drm/i915: Remove livelock from "do_idle_maps" vtd w/a Patchwork
2020-12-09 15:21 ` Mika Kuoppala [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=87zh2nkntt.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox