All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-core] Automatic shadowing in POSIX lib constructor
@ 2008-11-21 11:57 Jan Kiszka
  2008-11-21 13:56 ` Gilles Chanteperdrix
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Kiszka @ 2008-11-21 11:57 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: xenomai-core

Hi Gilles,

as indicated in an earlier post, my customer managed to reveal some
issues around dlopen'ing Xenomai libs, more precisely libs that were
linked against libpthread_rt. The constructor of the POSIX lib has
several problems here, and I think some are not fixable:

 o it auto-maps the constructor's caller even if it is not the main
   thread, and before main() was called

 o it ignores the caller's priority and sched policy, overwriting it
   with SCHED_OTHER

 o it removes mlockall from the process even if it was locked on entry

At least the last thing seems to be very hard to fix, but also for the
first item (testing if we are executed on application startup or later)
I see no solution right now.

So I propose to control automatic mapping as follows:
 - rebrand --without-__thread as --enable-dlopen, keeping it off by
   default
 - continue to check for platform support of initial-exec TLS, only
   use it when available *and* --enable-dlopen is not selected
 - don't perform auto-mapping in __init_posix_interface if
   --enable-dlopen is selected

This is build around the assumption that the user intentionally sets
--enable-dlopen because (s)he actually wants to use Xenomai libs like
that. And in that case (s)he is also expected to has a custom approach
which threads are shadowed (and with which priority) and which maybe not.

Comments? Better suggestions?

Jan

-- 
Siemens AG, Corporate Technology, CT SE 2 ES-OS
Corporate Competence Center Embedded Linux


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Xenomai-core] Automatic shadowing in POSIX lib constructor
  2008-11-21 11:57 [Xenomai-core] Automatic shadowing in POSIX lib constructor Jan Kiszka
@ 2008-11-21 13:56 ` Gilles Chanteperdrix
  0 siblings, 0 replies; 2+ messages in thread
From: Gilles Chanteperdrix @ 2008-11-21 13:56 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: xenomai-core

Jan Kiszka wrote:
> Hi Gilles,
> 
> as indicated in an earlier post, my customer managed to reveal some
> issues around dlopen'ing Xenomai libs, more precisely libs that were
> linked against libpthread_rt. The constructor of the POSIX lib has
> several problems here, and I think some are not fixable:
> 
>  o it auto-maps the constructor's caller even if it is not the main
>    thread, and before main() was called
> 
>  o it ignores the caller's priority and sched policy, overwriting it
>    with SCHED_OTHER
> 
>  o it removes mlockall from the process even if it was locked on entry
> 
> At least the last thing seems to be very hard to fix, but also for the
> first item (testing if we are executed on application startup or later)
> I see no solution right now.
> 
> So I propose to control automatic mapping as follows:
>  - rebrand --without-__thread as --enable-dlopen, keeping it off by
>    default
>  - continue to check for platform support of initial-exec TLS, only
>    use it when available *and* --enable-dlopen is not selected
>  - don't perform auto-mapping in __init_posix_interface if
>    --enable-dlopen is selected
> 
> This is build around the assumption that the user intentionally sets
> --enable-dlopen because (s)he actually wants to use Xenomai libs like
> that. And in that case (s)he is also expected to has a custom approach
> which threads are shadowed (and with which priority) and which maybe not.
> 
> Comments? Better suggestions?

The libtpthread_rt constructor is clearly written for the most common
case. I agree with your idea. Nevertheless, I think that when we detect
the failing case (I do not know yet how), we should issue a clear
message directing the use to the --enable-dlopen option.

-- 
                                                 Gilles.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-11-21 13:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-21 11:57 [Xenomai-core] Automatic shadowing in POSIX lib constructor Jan Kiszka
2008-11-21 13:56 ` Gilles Chanteperdrix

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.