All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <deathsimple@vodafone.de>
To: Jerome Glisse <j.glisse@gmail.com>
Cc: Jerome Glisse <jglisse@redhat.com>, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 14/20] drm/radeon: multiple ring allocator v2
Date: Mon, 07 May 2012 18:45:26 +0200	[thread overview]
Message-ID: <4FA7FC26.7040504@vodafone.de> (raw)
In-Reply-To: <CAH3drwbQJnaEyFV09QKifhrgAtVt+E2QAYUQPTNFf3b7vWeYOg@mail.gmail.com>

On 07.05.2012 17:23, Jerome Glisse wrote:
> On Mon, May 7, 2012 at 7:42 AM, Christian König<deathsimple@vodafone.de>  wrote:
>> A startover with a new idea for a multiple ring allocator.
>> Should perform as well as a normal ring allocator as long
>> as only one ring does somthing, but falls back to a more
>> complex algorithm if more complex things start to happen.
>>
>> We store the last allocated bo in last, we always try to allocate
>> after the last allocated bo. Principle is that in a linear GPU ring
>> progression was is after last is the oldest bo we allocated and thus
>> the first one that should no longer be in use by the GPU.
>>
>> If it's not the case we skip over the bo after last to the closest
>> done bo if such one exist. If none exist and we are not asked to
>> block we report failure to allocate.
>>
>> If we are asked to block we wait on all the oldest fence of all
>> rings. We just wait for any of those fence to complete.
>>
>> v2: We need to be able to let hole point to the list_head, otherwise
>>     try free will never free the first allocation of the list. Also
>>     stop calling radeon_fence_signalled more than necessary.
>>
>> Signed-off-by: Christian König<deathsimple@vodafone.de>
>> Signed-off-by: Jerome Glisse<jglisse@redhat.com>
> This one is NAK please use my patch. Yes in my patch we never try to
> free anything if there is only on sa_bo in the list if you really care
> about this it's a one line change:
> http://people.freedesktop.org/~glisse/reset5/0001-drm-radeon-multiple-ring-allocator-v2.patch
Nope that won't work correctly, "last" is pointing to the last 
allocation and that's the most unlikely to be freed at this time. Also 
in this version (like in the one before) radeon_sa_bo_next_hole lets 
hole point to the "prev" of the found sa_bo without checking if this 
isn't the lists head. That might cause a crash if an to be freed 
allocation is the first one in the buffer.

What radeon_sa_bo_try_free would need to do to get your approach working 
is to loop over the end of the buffer and also try to free at the 
beginning, but saying that keeping the last allocation results in a 
whole bunch of extra cases and "if"s, while just keeping a pointer to 
the "hole" (e.g. where the next allocation is most likely to succeed) 
simplifies the code quite a bit (but I agree that on the down side it 
makes it harder to understand).

> Your patch here can enter in infinite loop and never return holding
> the lock. See below.
>
> [SNIP]
>> +               } while (radeon_sa_bo_next_hole(sa_manager, fences));
> Here you can infinite loop, in the case there is a bunch of hole in
> the allocator but none of them allow to full fill the allocation.
> radeon_sa_bo_next_hole will keep returning true looping over and over
> on all the all. That's why i only restrict my patch to 2 hole skeeping
> and then fails the allocation or try to wait. I believe sadly we need
> an heuristic and 2 hole skeeping at most sounded like a good one.
Nope, that can't be an infinite loop, cause radeon_sa_bo_next_hole in 
conjunction with radeon_sa_bo_try_free are eating up the opportunities 
for holes.

Look again, it probably will never loop more than RADEON_NUM_RINGS + 1, 
with the exception for allocating in a complete scattered buffer, and 
even then it will never loop more often than halve the number of current 
allocations (and that is really really unlikely).

Cheers,
Christian.

  reply	other threads:[~2012-05-07 16:45 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-07 11:42 SA and other Patches Christian König
2012-05-07 11:42 ` [PATCH 01/20] drm/radeon: fix possible lack of synchronization btw ttm and other ring Christian König
2012-05-07 11:42 ` [PATCH 02/20] drm/radeon: clarify and extend wb setup on APUs and NI+ asics Christian König
2012-05-07 11:42 ` [PATCH 03/20] drm/radeon: replace the per ring mutex with a global one Christian König
2012-05-07 11:42 ` [PATCH 04/20] drm/radeon: convert fence to uint64_t v4 Christian König
2012-05-07 14:39   ` Jerome Glisse
2012-05-07 15:04     ` Christian König
2012-05-07 15:27       ` Jerome Glisse
2012-05-07 11:42 ` [PATCH 05/20] drm/radeon: rework fence handling, drop fence list v5 Christian König
2012-05-07 11:42 ` [PATCH 06/20] drm/radeon: rework locking ring emission mutex in fence deadlock detection Christian König
2012-05-07 11:42 ` [PATCH 07/20] drm/radeon: use inline functions to calc sa_bo addr Christian König
2012-05-07 11:42 ` [PATCH 08/20] drm/radeon: add proper locking to the SA v3 Christian König
2012-05-07 11:42 ` [PATCH 09/20] drm/radeon: add sub allocator debugfs file Christian König
2012-05-07 11:42 ` [PATCH 10/20] drm/radeon: keep start and end offset in the SA Christian König
2012-05-07 11:42 ` [PATCH 11/20] drm/radeon: make sa bo a stand alone object Christian König
2012-05-07 11:42 ` [PATCH 12/20] drm/radeon: define new SA interface v3 Christian König
2012-05-07 11:42 ` [PATCH 13/20] drm/radeon: use one wait queue for all rings add fence_wait_any v2 Christian König
2012-05-07 11:42 ` [PATCH 14/20] drm/radeon: multiple ring allocator v2 Christian König
2012-05-07 15:23   ` Jerome Glisse
2012-05-07 16:45     ` Christian König [this message]
     [not found]       ` <CAH3drwb=qkpeLrSL9dejg0WEt_bCk98TkR0vtggpn3_maN6gZg@mail.gmail.com>
2012-05-07 17:59         ` Fwd: " Jerome Glisse
2012-05-07 18:52           ` Jerome Glisse
2012-05-07 20:38             ` Christian König
2012-05-07 21:28               ` Jerome Glisse
2012-05-08 10:23                 ` Christian König
2012-05-08 14:55                   ` Jerome Glisse
2012-05-09  9:53                     ` Christian König
2012-05-07 11:42 ` [PATCH 15/20] drm/radeon: simplify semaphore handling v2 Christian König
2012-05-07 11:42 ` [PATCH 16/20] drm/radeon: rip out the ib pool Christian König
2012-05-07 11:42 ` [PATCH 17/20] drm/radeon: immediately free ttm-move semaphore Christian König
2012-05-07 11:42 ` [PATCH 18/20] drm/radeon: move the semaphore from the fence into the ib Christian König
2012-05-07 11:42 ` [PATCH 19/20] drm/radeon: remove r600 blit mutex v2 Christian König
2012-05-07 11:42 ` [PATCH 20/20] drm/radeon: make the ib an inline object Christian König
2012-05-07 14:34 ` SA and other Patches Jerome Glisse
2012-05-07 15:30   ` Jerome Glisse

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=4FA7FC26.7040504@vodafone.de \
    --to=deathsimple@vodafone.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=j.glisse@gmail.com \
    --cc=jglisse@redhat.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.