public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 10/11] drm/i915: Mark the context and address space as closed
Date: Thu, 17 Dec 2015 14:35:02 +0000	[thread overview]
Message-ID: <5672C816.2020506@linux.intel.com> (raw)
In-Reply-To: <20151217142646.GI22950@nuc-i3427.alporthouse.com>


On 17/12/15 14:26, Chris Wilson wrote:
> On Thu, Dec 17, 2015 at 02:15:52PM +0000, Tvrtko Ursulin wrote:
>>> +static void i915_ppgtt_close(struct i915_address_space *vm)
>>> +{
>>> +	struct list_head *phases[] = {
>>> +		&vm->active_list,
>>> +		&vm->inactive_list,
>>> +		&vm->unbound_list,
>>> +		NULL,
>>> +	}, **phase;
>>> +
>>> +	RQ_BUG_ON(vm->is_ggtt);
>>> +	RQ_BUG_ON(vm->closed);
>>> +	vm->closed = true;
>>> +
>>> +	for (phase = phases; *phase; phase++) {
>>> +		struct i915_vma *vma, *vn;
>>> +
>>> +		list_for_each_entry_safe(vma, vn, *phase, vm_link)
>>> +			i915_vma_close(vma);
>>> +	}
>>> +}
>>
>> Hm so VMAs get unlinked from everywhere, but then on retire goes
>> back to inactive. Is it not a bit weird?
>
> Very weird. In the end, I have to stop unlinking in i915_vma_close()
> from the vm lists.
>
>> Why it is needed to unlink VMAs from everywhere when marking them as closed?
>
> Indeed, it was just to try and keep this walk short. But I realised that
> this would actually also foul up the evict/shrinker (by hiding objects
> from them that should be thrown away).
>
>> And actually on retire objects are ahead of VMAs in the
>> req->active_list so the last object unreference happens before the
>> last vma is retired, which is even weirder.
>>
>> Am I missing something?
>
> That shouldn't happen. The i915_gem_object_retire_read is run after the
> i915_vma_retire.
>
> I had added some commentary to i915_vma_move_to_active() that hopefully
> explains the interdependences between retire callbacks (mostly to try
> and prevent breakage later).
>
> @@ -1075,7 +1075,13 @@ void i915_vma_move_to_active(struct i915_vma *vma,
>
>          obj->dirty = 1; /* be paranoid  */
>
> -       /* Add a reference if we're newly entering the active list. */
> +       /* Add a reference if we're newly entering the active list.
> +        * The order in which we add operations to the retirement queue is
> +        * vital here: mark_active adds to the start of the callback list,
> +        * such that subsequent callbacks are called first. Therefore we
> +        * add the active reference first and queue for it to be dropped
> +        * *last*.
> +        */

I don't know how I concluded active VMA is after the active object, and 
I specifically saw the order and list_move.

Again, very good to document that, so something good at least came out 
of it. :)


Regards,

Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2015-12-17 14:35 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-14 11:36 [PATCH 01/11] drm/i915: Introduce drm_i915_gem_request_node for request tracking Chris Wilson
2015-12-14 11:36 ` [PATCH 02/11] drm/i915: Refactor activity tracking for requests Chris Wilson
2015-12-16 17:16   ` Tvrtko Ursulin
2015-12-16 17:31     ` Chris Wilson
2015-12-14 11:36 ` [PATCH 03/11] drm/i915: Rename vma->*_list to *_link for consistency Chris Wilson
2015-12-17 11:14   ` Tvrtko Ursulin
2015-12-17 11:24     ` Chris Wilson
2015-12-17 11:45       ` Chris Wilson
2015-12-14 11:36 ` [PATCH 04/11] drm/i915: Amalgamate GGTT/ppGTT vma debug list walkers Chris Wilson
2015-12-17 11:21   ` Tvrtko Ursulin
2015-12-14 11:36 ` [PATCH 05/11] drm/i915: Reduce the pointer dance of i915_is_ggtt() Chris Wilson
2015-12-17 11:31   ` Tvrtko Ursulin
2015-12-14 11:36 ` [PATCH 06/11] drm/i915: Store owning file on the i915_address_space Chris Wilson
2015-12-17 11:52   ` Tvrtko Ursulin
2015-12-17 13:25     ` Chris Wilson
2015-12-14 11:36 ` [PATCH 07/11] drm/i915: i915_vma_move_to_active prep patch Chris Wilson
2015-12-17 12:04   ` Tvrtko Ursulin
2015-12-14 11:36 ` [PATCH 08/11] drm/i915: Track active vma requests Chris Wilson
2015-12-17 12:26   ` Tvrtko Ursulin
2015-12-14 11:36 ` [PATCH 09/11] drm/i915: Release vma when the handle is closed Chris Wilson
2015-12-17 13:46   ` Tvrtko Ursulin
2015-12-17 14:11     ` Chris Wilson
2015-12-17 14:21     ` Chris Wilson
2015-12-17 14:32       ` Tvrtko Ursulin
2015-12-14 11:36 ` [PATCH 10/11] drm/i915: Mark the context and address space as closed Chris Wilson
2015-12-17 12:37   ` Tvrtko Ursulin
2015-12-17 12:39     ` Tvrtko Ursulin
2015-12-17 12:48     ` Chris Wilson
2015-12-17 13:26       ` Tvrtko Ursulin
2015-12-17 14:15   ` Tvrtko Ursulin
2015-12-17 14:26     ` Chris Wilson
2015-12-17 14:35       ` Tvrtko Ursulin [this message]
2015-12-14 11:36 ` [PATCH 11/11] Revert "drm/i915: Clean up associated VMAs on context destruction" Chris Wilson
2015-12-14 15:58 ` [PATCH 01/11] drm/i915: Introduce drm_i915_gem_request_node for request tracking Tvrtko Ursulin
2015-12-14 16:11   ` Chris Wilson
2015-12-15 10:51 ` [PATCH v2] drm/i915: Introduce drm_i915_gem_request_active " Chris Wilson
2015-12-17 14:48 ` ✗ failure: UK.CI.checkpatch.pl 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=5672C816.2020506@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