All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: Ronny Meeus <ronny.meeus@gmail.com>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai] [xenomai-forge] timer-internal consume a lot of cpu
Date: Thu, 18 Dec 2014 17:06:38 +0100	[thread overview]
Message-ID: <5492FB8E.2050800@siemens.com> (raw)
In-Reply-To: <CAMJ=MEf1uFy1uLBK-r0CnL_sZONuxZ5dYUrMq4+cfJvqQEzSOQ@mail.gmail.com>

On 2014-12-18 16:49, Ronny Meeus wrote:
> On Thu, Dec 18, 2014 at 4:35 PM, Jan Kiszka <jan.kiszka@siemens.com> wrote:
>> On 2014-12-18 16:30, Gilles Chanteperdrix wrote:
>>> On Thu, Dec 18, 2014 at 04:25:40PM +0100, Ronny Meeus wrote:
>>>> On Thu, Dec 18, 2014 at 4:04 PM, Gilles Chanteperdrix
>>>> <gilles.chanteperdrix@xenomai.org> wrote:
>>>>> On Thu, Dec 18, 2014 at 03:58:52PM +0100, Jan Kiszka wrote:
>>>>>> On 2014-12-18 15:12, Gilles Chanteperdrix wrote:
>>>>>>> Otherwise, have you tried some alternate libc, such as musl:
>>>>>>> http://www.musl-libc.org/
>>>>>>>
>>>>>>> The following blog:
>>>>>>> http://ewontfix.com/
>>>>>>>
>>>>>>> Seems to show that the musl maintainers try and report glibc bugs
>>>>>>> and avoid them in their implementation.
>>>>>>>
>>>>>>> I have not tried xenomai with musl at all, so, maybe it does not
>>>>>>> even compile. But maybe just compiling a testcase for the condvar
>>>>>>> issue with that libc would help know if it has the same issue or
>>>>>>> not.
>>>>>>
>>>>>> Well, like with many of those "light-weight" re-implementations, the are
>>>>>> "small" issues with bits required for real-time:
>>>>>>
>>>>>> http://git.musl-libc.org/cgit/musl/tree/src/thread/pthread_mutexattr_setprotocol.c
>>>>>
>>>>> On the other hand, no implementation with a clear ENOTSUPP is better
>>>>> than a partial and buggy implementation that can not be trusted anyway.
>>>>>
>>>>> --
>>>>>                                             Gilles.
>>>>
>>>> Gilles I agree.
>>>>
>>>> In the meantime I tried it already.
>>>>
>>>> This is indeed the trace I get when running my test application with musl.
>>>> # ./cond_test_arm
>>>> # hread_mutexattr_setprotocol: Not supported
>>>>
>>>> Cobalt is not an option for us either since in that case all Linux
>>>> applications will run in low-priority. Next to that we also have a
>>>> huge priority inversion each time a Linux system call is done.
>>>>
>>>> Do we have other options to fix forge?
>>>
>>> Well, three options have been proposed if I followed this thread
>>> correctly:
>>> - stop using priority inheritance for these internal mutexes, at the
>>> risk of creating priority inversions
>>> - switch to priority ceiling (but what will be the ceiling? 99?)
>>
>> Likely - part of the reason why that is no general solution.
>>
>>> - use cobalt.
>>
>> - use a patched glibc
> 
> I tried to apply the patch on glibc 2.20 but it looks like the issue is still
> present.

You will need to extend to existing condvar users and tell glibc that
those vars will be used in combination with PI mutexes
(pthread_condattr_setprotocol_np).

> Even if it would be solved with the patch, we force all users
> of forge to work with a patched version of glibc and to go to 2.20.
> This might not always be easy.

Yes, that is unhandy.

> 
>> - fix upstream glibc - non-trivial, as history shows, but long overdue
> 
> Another option is to implement the priority boost in the copperplate lib.
> Before the signal is done, change the priority to an equal priority as
> the task signaling the conditional variable (in case the prio or the
> waiting task is lower).
> Once the thread is unblocked, restore the original priority (from the
> thread that receives the signal).

That implies you know the prios of the involved threads. Doesn't sound
like a generic solution either.

Jan

-- 
Siemens AG, Corporate Technology, CT RTC ITP SES-DE
Corporate Competence Center Embedded Linux


  reply	other threads:[~2014-12-18 16:06 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-07 16:26 [Xenomai] [xenomai-forge] timer-internal consume a lot of cpu Ronny Meeus
2014-12-16 17:36 ` Ronny Meeus
2014-12-16 17:58   ` Philippe Gerum
2014-12-16 19:41     ` Ronny Meeus
2014-12-16 20:07       ` Philippe Gerum
2014-12-18  8:00         ` Ronny Meeus
2014-12-18  9:04           ` Jan Kiszka
2014-12-18 12:28             ` Ronny Meeus
2014-12-18 13:35               ` Jan Kiszka
2014-12-18 14:17                 ` Ronny Meeus
2014-12-18 14:12               ` Gilles Chanteperdrix
2014-12-18 14:58                 ` Jan Kiszka
2014-12-18 15:04                   ` Gilles Chanteperdrix
2014-12-18 15:25                     ` Ronny Meeus
2014-12-18 15:30                       ` Gilles Chanteperdrix
2014-12-18 15:35                         ` Jan Kiszka
2014-12-18 15:49                           ` Ronny Meeus
2014-12-18 16:06                             ` Jan Kiszka [this message]
2014-12-18 17:21                               ` Ronny Meeus
2014-12-23 17:36                                 ` Ronny Meeus
2015-01-23 16:45                                   ` 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=5492FB8E.2050800@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=ronny.meeus@gmail.com \
    --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.