[Nouveau] [PATCH 2/3] drm/nouveau: add lockless dynamic semaphore allocator (v2)

2010-02-09 Thread Luca Barbieri
Changes in v2: - Addressed review comments - Fixed lockless algorithm (must not dec if negative in addition to if 0) - Made spinlock irqsave (fences are completed in IRQs) This patch adds code to allocate semaphores in a dynamic way using a lockless algorithm. 1. Semaphore BOs Semaphore BOs are

Re: [Nouveau] [PATCH 2/3] drm/nouveau: add lockless dynamic semaphore allocator

2010-02-01 Thread Marcin Slusarz
On Mon, Feb 01, 2010 at 10:50:09AM +0100, Luca Barbieri wrote: > This patch adds code to allocate semaphores in a dynamic way using > an algorithm with a lockless fast path. some minor comments below > > 1. Semaphore BOs > > Semaphore BOs are BOs containing semaphores. Each is 4KB large and > c

Re: [Nouveau] [PATCH 2/3] drm/nouveau: add lockless dynamic semaphore allocator

2010-02-01 Thread Francisco Jerez
Luca Barbieri writes: >> Sounds like premature optimization to me. I'm just stating my personal >> view here, but I have a feeling a patch with 60% of lines could do very >> well the same for most realistic cases. > > Perhaps, but really, the only thing you would probably save by using > spinlock

Re: [Nouveau] [PATCH 2/3] drm/nouveau: add lockless dynamic semaphore allocator

2010-02-01 Thread Luca Barbieri
> Sounds like premature optimization to me. I'm just stating my personal > view here, but I have a feeling a patch with 60% of lines could do very > well the same for most realistic cases. Perhaps, but really, the only thing you would probably save by using spinlocks in the fast path is retrying i

Re: [Nouveau] [PATCH 2/3] drm/nouveau: add lockless dynamic semaphore allocator

2010-02-01 Thread Francisco Jerez
Luca Barbieri writes: >> How often do we expect cross-channel sync to kick in? Maybe 2-3 times >> per frame? I suspect contentions will be rare enough to make spinlocks >> as fast as atomics for all real-life cases, and they don't have such a >> high maintainability cost. What do you guys think?

Re: [Nouveau] [PATCH 2/3] drm/nouveau: add lockless dynamic semaphore allocator

2010-02-01 Thread Luca Barbieri
> How often do we expect cross-channel sync to kick in? Maybe 2-3 times > per frame? I suspect contentions will be rare enough to make spinlocks > as fast as atomics for all real-life cases, and they don't have such a > high maintainability cost. What do you guys think? For the case of a single (o

Re: [Nouveau] [PATCH 2/3] drm/nouveau: add lockless dynamic semaphore allocator

2010-02-01 Thread Francisco Jerez
Luca Barbieri writes: > This patch adds code to allocate semaphores in a dynamic way using > an algorithm with a lockless fast path. > > 1. Semaphore BOs > > Semaphore BOs are BOs containing semaphores. Each is 4KB large and > contains 1024 4-byte semaphores. They are pinned. > > Semaphore BOs ar

[Nouveau] [PATCH 2/3] drm/nouveau: add lockless dynamic semaphore allocator

2010-02-01 Thread Luca Barbieri
This patch adds code to allocate semaphores in a dynamic way using an algorithm with a lockless fast path. 1. Semaphore BOs Semaphore BOs are BOs containing semaphores. Each is 4KB large and contains 1024 4-byte semaphores. They are pinned. Semaphore BOs are allocated on-demand and freed at devi