From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH 2/8] drm/i915: Avoid live-lock with i915_vma_parked()
Date: Mon, 23 Mar 2020 10:09:24 +0000 [thread overview]
Message-ID: <06af04fa-80b8-abdb-4736-ed6e58ede79a@linux.intel.com> (raw)
In-Reply-To: <20200323092841.22240-2-chris@chris-wilson.co.uk>
On 23/03/2020 09:28, Chris Wilson wrote:
> Abuse^W Take advantage that we know we are inside the GT wakeref and
> that prevents any client execbuf from reopening the i915_vma in order to
> claim all the vma to close without having to drop the spinlock to free
> each one individually. By keeping the spinlock, we do not have to
> restart if we run concurrently with i915_gem_free_objects -- which
> causes them both to restart continually and make very very slow
> progress.
>
> Closes: https://gitlab.freedesktop.org/drm/intel/issues/1361
> Fixes: 77853186e547 ("drm/i915: Claim vma while under closed_lock in i915_vma_parked()")
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> ---
> drivers/gpu/drm/i915/i915_vma.c | 29 ++++++++++++++---------------
> 1 file changed, 14 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_vma.c b/drivers/gpu/drm/i915/i915_vma.c
> index 5b3efb43a8ef..08699fa069aa 100644
> --- a/drivers/gpu/drm/i915/i915_vma.c
> +++ b/drivers/gpu/drm/i915/i915_vma.c
> @@ -1097,6 +1097,7 @@ void i915_vma_release(struct kref *ref)
> void i915_vma_parked(struct intel_gt *gt)
> {
> struct i915_vma *vma, *next;
> + LIST_HEAD(closed);
>
> spin_lock_irq(>->closed_lock);
> list_for_each_entry_safe(vma, next, >->closed_vma, closed_link) {
> @@ -1108,28 +1109,26 @@ void i915_vma_parked(struct intel_gt *gt)
> if (!kref_get_unless_zero(&obj->base.refcount))
> continue;
>
> - if (i915_vm_tryopen(vm)) {
> - list_del_init(&vma->closed_link);
> - } else {
> + if (!i915_vm_tryopen(vm)) {
> i915_gem_object_put(obj);
> - obj = NULL;
> + continue;
> }
>
> - spin_unlock_irq(>->closed_lock);
> + list_move(&vma->closed_link, &closed);
> + }
> + spin_unlock_irq(>->closed_lock);
>
> - if (obj) {
> - __i915_vma_put(vma);
> - i915_gem_object_put(obj);
> - }
> + /* As the GT is held idle, no vma can be reopened as we destroy them */
> + list_for_each_entry_safe(vma, next, &closed, closed_link) {
> + struct drm_i915_gem_object *obj = vma->obj;
> + struct i915_address_space *vm = vma->vm;
>
> - i915_vm_close(vm);
> + INIT_LIST_HEAD(&vma->closed_link);
> + __i915_vma_put(vma);
>
> - /* Restart after dropping lock */
> - spin_lock_irq(>->closed_lock);
> - next = list_first_entry(>->closed_vma,
> - typeof(*next), closed_link);
> + i915_gem_object_put(obj);
> + i915_vm_close(vm);
> }
> - spin_unlock_irq(>->closed_lock);
> }
>
> static void __i915_vma_iounmap(struct i915_vma *vma)
>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2020-03-23 10:09 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-23 9:28 [Intel-gfx] [PATCH 1/8] drm/i915/gt: Mark timeline->cacheline as destroyed after rcu grace period Chris Wilson
2020-03-23 9:28 ` [Intel-gfx] [PATCH 2/8] drm/i915: Avoid live-lock with i915_vma_parked() Chris Wilson
2020-03-23 10:09 ` Tvrtko Ursulin [this message]
2020-03-23 9:28 ` [Intel-gfx] [PATCH 3/8] drm/i915: Extend intel_wakeref to support delayed puts Chris Wilson
2020-03-23 10:13 ` Tvrtko Ursulin
2020-03-23 10:32 ` [Intel-gfx] [PATCH] " Chris Wilson
2020-03-23 12:24 ` Tvrtko Ursulin
2020-03-23 9:28 ` [Intel-gfx] [PATCH 4/8] drm/i915/gt: Delay release of engine-pm after last retirement Chris Wilson
2020-03-23 10:14 ` Tvrtko Ursulin
2020-03-23 9:28 ` [Intel-gfx] [PATCH 5/8] drm/i915: Rely on direct submission to the queue Chris Wilson
2020-03-23 10:29 ` Tvrtko Ursulin
2020-03-23 9:28 ` [Intel-gfx] [PATCH 6/8] drm/i915/execlists: Pull tasklet interrupt-bh local to direct submission Chris Wilson
2020-03-23 9:28 ` [Intel-gfx] [PATCH 7/8] drm/i915: Immediately execute the fenced work Chris Wilson
2020-03-23 10:37 ` Tvrtko Ursulin
2020-03-23 10:46 ` Chris Wilson
2020-03-24 16:13 ` Tvrtko Ursulin
2020-03-24 16:19 ` Chris Wilson
2020-03-23 11:04 ` [Intel-gfx] [PATCH] " Chris Wilson
2020-03-23 9:28 ` [Intel-gfx] [PATCH 8/8] drm/i915/gem: Avoid gem_context->mutex for simple vma lookup Chris Wilson
2020-03-23 10:38 ` Tvrtko Ursulin
2020-03-23 9:43 ` [Intel-gfx] [PATCH 1/8] drm/i915/gt: Mark timeline->cacheline as destroyed after rcu grace period Matthew Auld
2020-03-23 13:06 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for series starting with [1/8] drm/i915/gt: Mark timeline->cacheline as destroyed after rcu grace period (rev3) 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=06af04fa-80b8-abdb-4736-ed6e58ede79a@linux.intel.com \
--to=tvrtko.ursulin@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