From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Daniel Vetter <daniel@ffwll.ch>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>, Intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915: Move VMAs to inactive as request are retired
Date: Wed, 25 Nov 2015 10:16:37 +0000 [thread overview]
Message-ID: <56558A85.4090802@linux.intel.com> (raw)
In-Reply-To: <20151124174751.GX17050@phenom.ffwll.local>
On 24/11/15 17:47, Daniel Vetter wrote:
> On Mon, Nov 23, 2015 at 03:12:35PM +0000, Tvrtko Ursulin wrote:
>> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>>
>> Current code moves _any_ VMA to the inactive list only when
>> _all_ rendering on an object (so from any context or VM) has
>> been completed.
>>
>> This creates an un-natural situation where the context (and
>> VM) destructors can run with VMAs still on the respective
>> active list.
>>
>> Change here is to move VMAs to the inactive list as the
>> requests are getting retired.
>>
>> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92638
>> Testcase: igt/gem_request_retire/retire-vma-not-inactive
>> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
>> Cc: Chris Wilson <chris@chris-wilson.co.uk>
>> ---
>> drivers/gpu/drm/i915/i915_gem.c | 17 ++++++++++++++++-
>> 1 file changed, 16 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
>> index cd7e102720f4..47a743246d2c 100644
>> --- a/drivers/gpu/drm/i915/i915_gem.c
>> +++ b/drivers/gpu/drm/i915/i915_gem.c
>> @@ -2413,17 +2413,32 @@ static void
>> i915_gem_object_retire__read(struct drm_i915_gem_object *obj, int ring)
>> {
>> struct i915_vma *vma;
>> + struct i915_address_space *vm;
>>
>> RQ_BUG_ON(obj->last_read_req[ring] == NULL);
>> RQ_BUG_ON(!(obj->active & (1 << ring)));
>>
>> list_del_init(&obj->ring_list[ring]);
>> - i915_gem_request_assign(&obj->last_read_req[ring], NULL);
>>
>> if (obj->last_write_req && obj->last_write_req->ring->id == ring)
>> i915_gem_object_retire__write(obj);
>>
>> obj->active &= ~(1 << ring);
>> +
>> + if (obj->last_read_req[ring]->ctx->ppgtt)
>> + vm = &obj->last_read_req[ring]->ctx->ppgtt->base;
>> + else
>> + vm = &obj->last_read_req[ring]->i915->gtt.base;
>> +
>> + list_for_each_entry(vma, &obj->vma_list, vma_link) {
>> + if (vma->vm == vm &&
>> + vma->ggtt_view.type == I915_GGTT_VIEW_NORMAL &&
>> + !list_empty(&vma->mm_list))
>> + list_move_tail(&vma->mm_list, &vma->vm->inactive_list);
>> + }
>
> This is only a partial solution since with schedulers and semaphores and a
> few depencies on a given object, but in different vm you can still end up
> with an object that is idle in a vm, but slipped through here.
Could you describe the exact scenario you had in mind? I won't pretend
it this is simple code and I have it all figured out.
> Also, checking for the view type is some strange layering. Why that?
!ppgtt to skip potential other views I thought, no?
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2015-11-25 10:16 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-23 15:12 [PATCH] drm/i915: Move VMAs to inactive as request are retired Tvrtko Ursulin
2015-11-24 17:47 ` Daniel Vetter
2015-11-25 10:16 ` Tvrtko Ursulin [this message]
2015-11-26 10:01 ` Daniel Vetter
2015-11-26 14:07 ` Tvrtko Ursulin
2015-11-26 14:41 ` Daniel Vetter
2015-11-26 10:35 ` Chris Wilson
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=56558A85.4090802@linux.intel.com \
--to=tvrtko.ursulin@linux.intel.com \
--cc=Intel-gfx@lists.freedesktop.org \
--cc=daniel.vetter@ffwll.ch \
--cc=daniel@ffwll.ch \
/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