Re: False positives in deadlock detection

Gábor Melis <[email protected]>
Newsgroups gmane.lisp.steel-bank.general
Message-ID <CADJFn4XoigQzB5UmbLzzmaM38r7QpZ5-tHk21MxnwZv7bAO2eA@mail.gmail.com>
On Fri, 15 Mar 2024 at 16:48, Stas Boukarev <[email protected]> wrote:
>
> If it finds a thread that waits for a mutex owned by the current thread then from this point nothing can change, so then it goes back and rechecks that the previous mutex is still owned by this thread and so on.
> Since the write to thread-waits-for happens after the write to mutex-owner if we can observe thread-waits-for then we can be sure mutex-owner is correct.

If there is only one lock acquisition to consider, then yes. In
general, the write order and the barriers seem to guarantee only that
the mutex-owner value is "earlier" than the thread-waits-for we
observe. When two locks are acquired (with just a bit of waiting) and
released in quick succession by the same thread, another thread may
get to see the mutex-owner of the first acquisition and the
thread-waits-for of the second.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.