From: Jan Kiszka <jan.kiszka@domain.hid>
To: rpm@xenomai.org
Cc: Jan Kiszka <jan.kiszka@domain.hid>, xenomai-core <xenomai@xenomai.org>
Subject: Re: [Xenomai-core] [BUG] Lock stealing is borken
Date: Tue, 19 Aug 2008 21:28:38 +0200 [thread overview]
Message-ID: <48AB1EE6.8070003@domain.hid> (raw)
In-Reply-To: <48AB1B29.4040001@domain.hid>
[-- Attachment #1: Type: text/plain, Size: 1408 bytes --]
Philippe Gerum wrote:
> Jan Kiszka wrote:
>> Hi,
>>
>> bad news, everyone :(. According to the result of some lengthy debug
>> session with a customer and several ad-hoc lttng instrumentations, we
>> have a fatal bug in the nucleus' implementation of the lock stealing
>> algorithm. Consider this scenario:
>>
>> 1. Thread A acquires Mutex X successfully, ie. it leaves the (in this
>> case) rt_mutex_acquire service, and its XNWAKEN flag is therefore
>> cleared.
>>
>> 2. Thread A blocks on some further Mutex Y (in our case it was a
>> semaphore, but that doesn't matter).
>>
>> 3. Thread B signals the availability of Mutex Y to Thread A, thus it
>> also set XNWAKEN in Thread A. But Thread A is not yet scheduled on
>> its CPU.
>>
>> 4. Thread C tries to acquire Mutex X, finds it assigned to Thread A, but
>> also notices that the XNWAKEN flag of Thread A is set. Thus it steals
>> the mutex although Thread A already entered the critical section -
>> and hell breaks loose...
>>
>
> See commit #3795, and change log entry from 2008-05-15. Unless I misunderstood
> your description, this bug was fixed in 2.4.4.
Oh, fatally missed that fix.
Anyway, the patch looks a bit unclean to me. Either you are lacking
wwake = NULL in xnpod_suspend_thread, or the whole information encoded
in XNWAKEN can already be covered by wwake directly.
Jan
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 257 bytes --]
next prev parent reply other threads:[~2008-08-19 19:28 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-19 16:42 [Xenomai-core] [BUG] Lock stealing is borken Jan Kiszka
2008-08-19 19:12 ` Philippe Gerum
2008-08-19 19:28 ` Jan Kiszka [this message]
2008-08-19 19:50 ` Philippe Gerum
2008-08-19 19:56 ` Jan Kiszka
2008-08-19 20:12 ` Philippe Gerum
2008-08-19 20:35 ` Jan Kiszka
2008-08-20 9:00 ` Philippe Gerum
2008-08-20 9:14 ` Jan Kiszka
2008-08-28 19:26 ` Philippe Gerum
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=48AB1EE6.8070003@domain.hid \
--to=jan.kiszka@domain.hid \
--cc=rpm@xenomai.org \
--cc=xenomai@xenomai.org \
/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.