All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Hellstrom <thellstrom@vmware.com>
To: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: buggy/weird behavior in ttm
Date: Mon, 15 Oct 2012 14:14:51 +0200	[thread overview]
Message-ID: <507BFE3B.5070504@vmware.com> (raw)
In-Reply-To: <5077CBA7.2050509@canonical.com>

On 10/12/2012 09:49 AM, Maarten Lankhorst wrote:
>
>>>>> I suppose there will stay a small race though,
>>>> Hmm, where?
>>> When you enter the ddestroy path, you drop the lock and hope the buffer doesn't reserved
>>> away from under you.
>> Yes, that code isn't fully correct, it's missing a check for still on ddestroy after a waiting
>> reserve. However, the only chance of a waiting reserve given that the buffer *IS* on the
>> ddestroy list is if the current reserver returned early because someone started an
>> accelerated eviction which can't happen currently. The code needs fixing up though.
> bo gets put on ddestroy list, delayed destroy handler gets reservation and we try to get a
> reservation at the same time in ttm_mem_evict_first, losing out.
>
> Unlikely? Yes, but I don't see how it is impossible.

Anyone getting the reservation will remove the buffer from the ddestroy 
list atomically,
That means that another caller that finds the buffer on the ddestroy 
list will get the
reservation without wait. The exeption is if *anyone* gets the 
reservation without
removing it from the ddestroy list. That would trigger catastrophic 
failure, but I don't
think that's possible with the current code.

So yes, the code is broken, but I don't think it breaks anything currently.

/Thomas

  reply	other threads:[~2012-10-15 12:14 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-11 14:50 buggy/weird behavior in ttm Maarten Lankhorst
2012-10-11 16:57 ` Thomas Hellstrom
2012-10-11 18:42   ` Maarten Lankhorst
2012-10-11 19:26     ` Thomas Hellstrom
2012-10-11 19:35       ` Thomas Hellstrom
2012-10-11 20:55       ` Maarten Lankhorst
2012-10-12  5:57         ` Thomas Hellstrom
2012-10-12  7:49           ` Maarten Lankhorst
2012-10-15 12:14             ` Thomas Hellstrom [this message]
2012-10-12 10:09           ` Maarten Lankhorst
2012-10-15 12:27             ` Thomas Hellstrom
2012-10-15 15:37               ` Maarten Lankhorst
2012-10-15 18:34                 ` Maarten Lankhorst
2012-10-15 19:44                   ` Jerome Glisse
2012-10-15 18:40                 ` Thomas Hellstrom
2012-10-15 19:32                   ` Maarten Lankhorst

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=507BFE3B.5070504@vmware.com \
    --to=thellstrom@vmware.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=maarten.lankhorst@canonical.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.