All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Hellstrom <thomas@shipmail.org>
To: Daniel Vetter <daniel@ffwll.ch>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>,
	intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 0/9] [RFC] fair-lru eviction
Date: Wed, 19 May 2010 23:08:52 +0200	[thread overview]
Message-ID: <4BF45364.1050204@shipmail.org> (raw)
In-Reply-To: <20100519201341.GD3537@viiv.ffwll.ch>

On 05/19/2010 10:13 PM, Daniel Vetter wrote:
> On Wed, May 19, 2010 at 09:51:33PM +0200, Thomas Hellström wrote:
>    
>> Daniel,
>> TTM releases the spinlock protecting the drm_mm manager in between
>> evictions to be able to wait (without holding locks) for bo idle.
>> That means that the lru list may have changed between the first
>> eviction and the next. In practice, drivers either don't allow
>> simultaneous bo validation or should disallow it if thrashing is
>> likely to occur, so the likelyhood of the lru list changing in
>> between evictions should be small but it needs to be taken into
>> account.
>>      
> Well, in my opinion ttm locking optimize for the wrong case: Usually there
> should be a little bit of room free to fully pipeline everything. And if
> it there is no room free anymore, performance is gonna dip anyway, so we
> might as well block.

Yes, the driver is free to block in such cases if it wants to. It's a 
matter of taking a command submission rwsem in either read- or write 
mode. However, a validation sequence of one DRI client shouldn't 
unnecessarily block other renderers whose render targets  / sources are 
already in memory, but that's only a special case. TTM tries to make 
sure and encourage driver writers make sure no CPU locks are held while 
waiting for a GPU, which may turn out to be optimizing for the wrong 
case in a single-client-single-gpu environment, but turn out to be a 
good choice in other situations.

In any case, the code must take into account that the lru may be 
modified when the spinlock is released, which I believe you have 
addressed below.

>   I think the linux vm with the split between
> asynchronous background writeback and synchronous writeback in case of low
> amounts of free memory could be used as inspiration.
>
> Whatever, I think ttm could use this fair eviction stuff even with the
> current locking scheme: Do all the accounting under the spinlock, i.e.
> - scanning the lru
> - building up the eviction list
> - mark the memory blocks as free (with drm_mm_put_block)
> - reserve the complete free hole (needs a new function in drm_mm, but
>    range-restricted allocations are not yet implemented yet, anyway) with a
>    temporary object.
>
> Then do the effective eviction outside the spinlock. iirc ttm already uses
> such shadow (dunno what they're really called) objects for buffer moves.
>
>    
>> Nevertheless, the drm_mm.c cleanup is
>> Acked-by: Thomas Hellstrom<thellstrom@vmwgfx.com>
>>      
> Does that include the drm_mm_node->private pointer removal? Jerome naked
> that one (but I've objected). Just to clarify.
>
>    

IIRC, Jerome's range validation patches was using that member at some 
stage. I think if Jerome needs the pointer it should stay.

Thanks,
Thomas


>> I'll leave it to the Intel guys to comment on the fair eviction stuff.
>>
>> /Thomas
>>      
> Thanks, Daniel
>    

      reply	other threads:[~2010-05-19 21:08 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-18 21:11 [PATCH 0/9] [RFC] fair-lru eviction Daniel Vetter
2010-05-18 21:11 ` [PATCH 1/9] list.h: add list_for_each_entry_safe_from_reverse Daniel Vetter
2010-05-18 21:11 ` [PATCH 2/9] drm: use list_for_each_entry in drm_mm.c Daniel Vetter
2010-05-18 21:11 ` [PATCH 3/9] drm: kill drm_mm_node->private Daniel Vetter
2010-05-19  9:25   ` Jerome Glisse
2010-05-19 17:03     ` Daniel Vetter
2010-05-19 22:04       ` Jerome Glisse
2010-05-18 21:11 ` [PATCH 4/9] drm: kill dead code in drm_mm.c Daniel Vetter
2010-05-18 21:11 ` [PATCH 5/9] drm: sane naming for drm_mm.c Daniel Vetter
2010-05-18 21:11 ` [PATCH 6/9] drm_mm: extract check_free_mm_node Daniel Vetter
2010-05-18 21:11 ` [PATCH 7/9] drm: implement helper functions for scanning lru list Daniel Vetter
2010-05-18 21:11 ` [PATCH 8/9] drm/i915: prepare for fair lru eviction Daniel Vetter
2010-05-18 21:11 ` [PATCH 9/9] drm/i915: implement " Daniel Vetter
2010-05-19  3:05 ` [PATCH 0/9] [RFC] fair-lru eviction Eric Anholt
2010-05-19  8:06 ` Chris Wilson
2010-05-19 16:57   ` Daniel Vetter
2010-05-19 17:09     ` Chris Wilson
2010-05-19 19:51 ` Thomas Hellström
2010-05-19 20:13   ` Daniel Vetter
2010-05-19 21:08     ` Thomas Hellstrom [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=4BF45364.1050204@shipmail.org \
    --to=thomas@shipmail.org \
    --cc=daniel.vetter@ffwll.ch \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --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 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.