All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Chris Wilson <chris@chris-wilson.co.uk>,
	 Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	 Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: intel-gfx <intel-gfx@lists.freedesktop.org>,
	Matthew Auld <matthew.auld@intel.com>
Subject: Re: [Intel-gfx] [PATCH 2/2] drm/i915: Change i915_vma_unbind() to report -EAGAIN on activity
Date: Fri, 21 Feb 2020 15:54:39 +0100	[thread overview]
Message-ID: <CAKMK7uGE0Fzw9CcmAZDN00tt4GCCX2Dk6O=JT7iODyvCXN3aag@mail.gmail.com> (raw)
In-Reply-To: <20191208161252.3015727-2-chris@chris-wilson.co.uk>

On Sun, Dec 8, 2019 at 5:13 PM Chris Wilson <chris@chris-wilson.co.uk> wrote:
>
> If someone else acquires the i915_vma before we complete our wait and
> unbind it, we currently error out with -EBUSY. Use -EAGAIN instead so
> that if necessary the caller is prepared to try again.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Matthew Auld <matthew.auld@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_vma.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_vma.c b/drivers/gpu/drm/i915/i915_vma.c
> index 9ca6664c190c..6794c742fbbf 100644
> --- a/drivers/gpu/drm/i915/i915_vma.c
> +++ b/drivers/gpu/drm/i915/i915_vma.c
> @@ -1181,7 +1181,7 @@ int __i915_vma_unbind(struct i915_vma *vma)
>         GEM_BUG_ON(i915_vma_is_active(vma));
>         if (i915_vma_is_pinned(vma)) {
>                 vma_print_allocator(vma, "is pinned");
> -               return -EBUSY;
> +               return -EAGAIN;

Maarten is apparently hitting this somehow in his dma_resv work, and
no idea yet why. But just general comment: We can't be leaking
temporary pins outside of holding the right locks, because then other
threads can spot these pins and fail, because parts of whatever they
need more of (vma or object doesn't really matter) can't be evicted
properly. And sprinkling more EAGAIN all over the place really isn't
the solution to get us out of these problems in the long term.

So if we do have random spurious pins that leak out from under their
locks, then we need to tug them back under those locks (struct_mutex
is the worst case for a bunch of these right now). That's the
fundamental shift in locking design with dma_resv vs the previous
design that had the explicit goal of lots of temporary and
not-so-temporary pins to untangle the locking. Now fully clear that we
have a lot of that still lying around, but we really can't spread it
further.
-Daniel

>         }
>
>         GEM_BUG_ON(i915_vma_is_active(vma));
> --
> 2.24.0
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx



-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2020-02-21 14:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-08 16:12 [Intel-gfx] [PATCH 1/2] drm/i915/gem: Avoid rcu_barrier() from shrinker paths Chris Wilson
2019-12-08 16:12 ` [Intel-gfx] [PATCH 2/2] drm/i915: Change i915_vma_unbind() to report -EAGAIN on activity Chris Wilson
2019-12-09 10:58   ` Matthew Auld
2020-02-21 14:54   ` Daniel Vetter [this message]
2019-12-08 16:34 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/2] drm/i915/gem: Avoid rcu_barrier() from shrinker paths Patchwork
2019-12-08 16:55 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2019-12-08 19:17 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
2019-12-09 10:47 ` [Intel-gfx] [PATCH 1/2] " Matthew Auld

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='CAKMK7uGE0Fzw9CcmAZDN00tt4GCCX2Dk6O=JT7iODyvCXN3aag@mail.gmail.com' \
    --to=daniel@ffwll.ch \
    --cc=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=matthew.auld@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 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.