[Nouveau] [PATCH] drm/ttm: Fix race condition in ttm_bo_delayed_delete

Luca Barbieri luca at luca-barbieri.com
Mon Jan 18 14:33:35 PST 2010


> Would  nentry=list_first_entry(&entry->ddestroy, ....) work?
Yes, it seems a bit less intuitive, but if that's the accepted
practice, let's do that instead.

> Here nentry may have been removed from the list by another process, which
> would trigger the unnecessary call, mentioned above.
You are right.

I attached a revised patch.
It's only compile tested, but the changes are small and it should
hopefully work.

Note that in principle we could remove the special-case code for the
list head but that would require pretending the list head is actually
inside a ttm_buffer_object and adding a flag to not do the
unlock/cleanup/put/lock on it, which seems bad.

The whole function seems more complicated than needed, but I can't
find a way to do it with less code. If we could keep glob->lru_lock
while calling ttm_bo_cleanup_refs things would be much simpler, but
that would require intrusive changes and may not be possible.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-drm-ttm-Fix-race-condition-in-ttm_bo_delayed_delete-.patch
Type: text/x-diff
Size: 3345 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/nouveau/attachments/20100118/1d9fc7ea/attachment.patch 


More information about the Nouveau mailing list