From: "Carlos O'Donell" <carlos@redhat.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>,
Darren Hart <dvhart@linux.intel.com>,
LKML <linux-kernel@vger.kernel.org>,
Dave Jones <davej@redhat.com>,
Linus Torvalds <torvalds@linux-foundation.org>,
Darren Hart <darren@dvhart.com>,
Davidlohr Bueso <davidlohr@hp.com>,
Ingo Molnar <mingo@kernel.org>,
Steven Rostedt <rostedt@goodmis.org>,
Clark Williams <williams@redhat.com>,
Paul McKenney <paulmck@linux.vnet.ibm.com>,
Lai Jiangshan <laijs@cn.fujitsu.com>,
Roland McGrath <roland@hack.frob.com>,
Jakub Jelinek <jakub@redhat.com>,
Michael Kerrisk <mtk.manpages@gmail.com>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Subject: Re: [patch 0/3] futex/rtmutex: Fix issues exposed by trinity
Date: Fri, 16 May 2014 13:54:05 -0400 [thread overview]
Message-ID: <537650BD.8050105@redhat.com> (raw)
In-Reply-To: <alpine.DEB.2.02.1405150055470.6261@ionos.tec.linutronix.de>
On 05/14/2014 07:11 PM, Thomas Gleixner wrote:
> On Wed, 14 May 2014, Carlos O'Donell wrote:
>> On 05/14/2014 05:22 AM, Peter Zijlstra wrote:
>>>>> I believe the thinking goes that if we get to here, then the lock is in an
>>>>> inconsistent state (between kernel and userspace). I don't have an answer for
>>>>> why pausing forever would be preferable to returning an error however...
>>>>
>>>> What error would we return?
>>>
>>> EDEADLK is a valid user return for pthread_mutex_lock() as per:
>>>
>>> http://pubs.opengroup.org/onlinepubs/009695399/functions/pthread_mutex_lock.html
>>
>> How is that correct? It isn't a deadlock we've detected but inconsistent
>> state between glibc and the kernel. In this case glibc should assert.
>> Delaying indefinitely with pause() never seems correct (despite that being
>> what we do today).
>
> If there is inconsistent state detected then the kernel will return
> -EPERM or -EINVAL. So lets put inconsistent state aside.
OK.
> In glibc you only can detect the simple AA dead lock, i.e lock owner
> tries to lock the lock it owns again. Trivial, right ?
Agreed.
> But glibc has no idea which lock chains are involved and might lead to
> a dead lock caused by nested locking, simplest and most popular being
> ABBA.
OK.
> The kernel can (if the implementation is fixed, patch is available
> already) very well detect ABBA and even more complex nested lock
> deadlocks. So it rightfully returns -EDEADLK and that is completely
> correct versus the spec and the call site can do something about it.
OK.
> And that's not different from the glibc detected AA deadlock at
> all. It's just detected by a different mechanism.
OK.
> On kernel side we currently provide this service only for the PI
> futexes because we have a kernel side state representation as long as
> the user space state is not corrupted.
OK.
> Back then when it was implemented the dead lock detection actually
> worked and was agreed on by both sides - kernel and glibc - to be
> usefull and essential to the whole endavour.
I agree that ignoring the situation of corrupted or inconsistent
state we should be returning EDEADLK to userspace.
We'll cleanup glibc.
Cheers,
Carlos.
next prev parent reply other threads:[~2014-05-16 17:55 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-12 20:45 [patch 0/3] futex/rtmutex: Fix issues exposed by trinity Thomas Gleixner
2014-05-12 20:45 ` [patch 1/3] rtmutex: Add missing deadlock check Thomas Gleixner
2014-05-13 5:51 ` Lai Jiangshan
2014-05-13 8:45 ` Thomas Gleixner
2014-05-13 8:48 ` Peter Zijlstra
2014-05-13 16:12 ` Paul E. McKenney
2014-05-13 19:42 ` Thomas Gleixner
2014-05-13 20:20 ` Steven Rostedt
2014-05-13 20:36 ` Paul E. McKenney
2014-05-13 21:27 ` Thomas Gleixner
2014-05-13 22:00 ` Paul E. McKenney
2014-05-13 22:44 ` Steven Rostedt
2014-05-13 23:27 ` Paul E. McKenney
2014-05-13 23:53 ` Steven Rostedt
2014-05-14 0:12 ` Paul E. McKenney
2014-05-14 6:54 ` Thomas Gleixner
[not found] ` <CAGChsmO9GO1Z2VBbw7uLtTXpYowdoUQbK8C3=Dt2jtGAnc6D2A@mail.gmail.com>
2014-05-14 13:33 ` Thomas Gleixner
2014-05-14 6:42 ` Thomas Gleixner
2014-05-14 12:59 ` Thomas Gleixner
2014-05-12 20:45 ` [patch 2/3] futex: Add another early deadlock detection check Thomas Gleixner
2014-05-19 12:22 ` [tip:core/urgent] " tip-bot for Thomas Gleixner
2014-05-12 20:45 ` [patch 3/3] futex: Prevent attaching to kernel threads Thomas Gleixner
2014-05-12 20:54 ` Peter Zijlstra
2014-05-12 21:16 ` Thomas Gleixner
2014-05-12 21:59 ` Davidlohr Bueso
2014-05-12 22:18 ` Thomas Gleixner
2014-05-19 12:22 ` [tip:core/urgent] " tip-bot for Thomas Gleixner
2014-05-12 21:37 ` [patch 0/3] futex/rtmutex: Fix issues exposed by trinity Steven Rostedt
2014-05-12 21:52 ` Thomas Gleixner
2014-05-12 22:08 ` Steven Rostedt
2014-05-12 22:37 ` Thomas Gleixner
2014-05-12 23:18 ` Steven Rostedt
2014-05-13 6:37 ` Ingo Molnar
2014-05-13 3:54 ` Darren Hart
2014-05-13 9:08 ` Thomas Gleixner
2014-05-14 7:06 ` Carlos O'Donell
2014-05-14 10:26 ` Thomas Gleixner
2014-05-14 20:59 ` Carlos O'Donell
2014-05-14 22:54 ` Thomas Gleixner
2014-05-15 7:37 ` Peter Zijlstra
2014-05-15 8:25 ` Peter Zijlstra
2014-05-16 18:21 ` Carlos O'Donell
2014-05-14 6:58 ` Carlos O'Donell
2014-05-14 9:22 ` Peter Zijlstra
2014-05-14 21:17 ` Carlos O'Donell
2014-05-14 23:11 ` Thomas Gleixner
2014-05-16 17:54 ` Carlos O'Donell [this message]
2014-05-15 8:07 ` Peter Zijlstra
2014-05-16 18:14 ` Carlos O'Donell
2014-05-14 9:53 ` Thomas Gleixner
2014-05-14 10:07 ` Peter Zijlstra
2014-05-14 10:28 ` Thomas Gleixner
2014-05-16 17:55 ` Carlos O'Donell
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=537650BD.8050105@redhat.com \
--to=carlos@redhat.com \
--cc=bigeasy@linutronix.de \
--cc=darren@dvhart.com \
--cc=davej@redhat.com \
--cc=davidlohr@hp.com \
--cc=dvhart@linux.intel.com \
--cc=jakub@redhat.com \
--cc=laijs@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=mtk.manpages@gmail.com \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
--cc=roland@hack.frob.com \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=williams@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.