From: Jan Kiszka <jan.kiszka@domain.hid>
To: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-core] Re: [Xenomai-help] Xenomai v2.3.1
Date: Tue, 20 Mar 2007 18:28:42 +0100 [thread overview]
Message-ID: <460019CA.1090308@domain.hid> (raw)
In-Reply-To: <4600125A.6000304@domain.hid>
[-- Attachment #1: Type: text/plain, Size: 1897 bytes --]
Gilles Chanteperdrix wrote:
> Bill Gatliff wrote:
>> Guys:
>>
>> Philippe Gerum wrote:
>>
>>> [posix]
>>> * Fix pthread_cond_wait() upon signal receipt (grab mutex anew).
>>>
>>
>> Probably OT, but someone was complaining to me the other day that
>> pthreads running on SCHED_FIFO/SCHED_RR that are blocked on mutexes
>> don't release in priority order. This was on a stock 2.6.18 kernel,
>> "recent glibc" (I didn't catch which version or config), ARM9 platform.
>>
>> First question: Is this actually true?
>>
>> Second question: Does Xenomai fix this? Do more recent kernel
>> developments fix this?
>>
>> Point me at the appropriate RTFM or code if that's the appropriate
>> answer. :)
>
> The appropriate RTFM is the POSIX spec [1]
>
> In short, it says: "If there are threads blocked on the mutex object
> referenced by 'mutex' when pthread_mutex_unlock() is called, resulting
> in the mutex becoming available, the scheduling policy shall determine
> which thread shall acquire the mutex."
>
> So, the correct implementation is to release a mutex in priority order.
>
> I think the glibc implements this correctly (at least NPTL), on the
> other hand, I believe it is not true for threads running with the
> SCHED_OTHER policy, in order to prevent starvation.
The problem with stock kernel is the FUTEX_WAIT operation: That one is
used by glibc to block on non-PI mutexes. It dequeues in FIFO order,
regardless of the waiter's priority. FUTEX_LOCK_PI (used e.g. for
PTHREAD_PRIO_INHERIT mutexes since glibc 2.5) is fine again.
The -rt patch contains a fix for FUTEX_WAIT, and I think I saw some
mainline patch once circulating as well. But it received a bit
scepticism due to possible performance regression for futex users that
don't care about priorities. And so nothing happened yet (I just checked
latest git)...
Jan
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 250 bytes --]
next prev parent reply other threads:[~2007-03-20 17:28 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-20 8:39 [Xenomai-core] Xenomai v2.3.1 Philippe Gerum
2007-03-20 10:53 ` Gilles Chanteperdrix
2007-03-20 16:25 ` [Xenomai-core] Re: [Xenomai-help] " Bill Gatliff
2007-03-20 16:56 ` Gilles Chanteperdrix
2007-03-20 17:03 ` Bill Gatliff
2007-03-20 17:34 ` Gilles Chanteperdrix
2007-03-20 17:28 ` Jan Kiszka [this message]
2007-03-20 20:11 ` [Xenomai-core] " Gilles Chanteperdrix
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=460019CA.1090308@domain.hid \
--to=jan.kiszka@domain.hid \
--cc=gilles.chanteperdrix@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.