All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-core] Yet another ((weak)) bug
@ 2010-02-12 15:21 Jan Kiszka
  2010-02-12 15:25 ` Gilles Chanteperdrix
  0 siblings, 1 reply; 15+ messages in thread
From: Jan Kiszka @ 2010-02-12 15:21 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: xenomai-core

Hi Gilles,

this one requires some fixing too:

xeno_sem_heap is marked weak. xeno_init_sem_heaps is called once per
initialized skin. It unmaps any existing heap and creates a new one.
That's already fragile during constructor run, but it's lethal during
process runtime, ie. when using dlopen.

I think the solution is to handle forks separately and only remap in
that case. Digging in this direction now.

BTW, what triggers the re-run of xeno_init_sem_heaps after a fork so far?

Jan

-- 
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux


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

* Re: [Xenomai-core] Yet another ((weak)) bug
  2010-02-12 15:21 [Xenomai-core] Yet another ((weak)) bug Jan Kiszka
@ 2010-02-12 15:25 ` Gilles Chanteperdrix
  2010-02-12 15:37   ` Jan Kiszka
  0 siblings, 1 reply; 15+ messages in thread
From: Gilles Chanteperdrix @ 2010-02-12 15:25 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: xenomai-core

Jan Kiszka wrote:
> Hi Gilles,
> 
> this one requires some fixing too:
> 
> xeno_sem_heap is marked weak. xeno_init_sem_heaps is called once per
> initialized skin. It unmaps any existing heap and creates a new one.
> That's already fragile during constructor run, but it's lethal during
> process runtime, ie. when using dlopen.
> 
> I think the solution is to handle forks separately and only remap in
> that case. Digging in this direction now.
> 
> BTW, what triggers the re-run of xeno_init_sem_heaps after a fork so far?

It must be done for the child process to get a private heap different
from the parent process. I would guess it is handled by pthread_atfork.

-- 
					    Gilles.


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

* Re: [Xenomai-core] Yet another ((weak)) bug
  2010-02-12 15:25 ` Gilles Chanteperdrix
@ 2010-02-12 15:37   ` Jan Kiszka
  2010-02-12 15:54     ` Gilles Chanteperdrix
  2010-02-12 16:03     ` Gilles Chanteperdrix
  0 siblings, 2 replies; 15+ messages in thread
From: Jan Kiszka @ 2010-02-12 15:37 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: xenomai-core

Gilles Chanteperdrix wrote:
> Jan Kiszka wrote:
>> Hi Gilles,
>>
>> this one requires some fixing too:
>>
>> xeno_sem_heap is marked weak. xeno_init_sem_heaps is called once per
>> initialized skin. It unmaps any existing heap and creates a new one.
>> That's already fragile during constructor run, but it's lethal during
>> process runtime, ie. when using dlopen.
>>
>> I think the solution is to handle forks separately and only remap in
>> that case. Digging in this direction now.
>>
>> BTW, what triggers the re-run of xeno_init_sem_heaps after a fork so far?
> 
> It must be done for the child process to get a private heap different
> from the parent process. I would guess it is handled by pthread_atfork.

Ah, only the POSIX skin does that. However, sem-heaps must not be
POSIX-only. OK, patch in the make.

Jan

-- 
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux


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

* Re: [Xenomai-core] Yet another ((weak)) bug
  2010-02-12 15:37   ` Jan Kiszka
@ 2010-02-12 15:54     ` Gilles Chanteperdrix
  2010-02-12 16:45       ` Jan Kiszka
  2010-02-12 16:03     ` Gilles Chanteperdrix
  1 sibling, 1 reply; 15+ messages in thread
From: Gilles Chanteperdrix @ 2010-02-12 15:54 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: xenomai-core

Jan Kiszka wrote:
> Gilles Chanteperdrix wrote:
>> Jan Kiszka wrote:
>>> Hi Gilles,
>>>
>>> this one requires some fixing too:
>>>
>>> xeno_sem_heap is marked weak. xeno_init_sem_heaps is called once per
>>> initialized skin. It unmaps any existing heap and creates a new one.
>>> That's already fragile during constructor run, but it's lethal during
>>> process runtime, ie. when using dlopen.
>>>
>>> I think the solution is to handle forks separately and only remap in
>>> that case. Digging in this direction now.
>>>
>>> BTW, what triggers the re-run of xeno_init_sem_heaps after a fork so far?
>> It must be done for the child process to get a private heap different
>> from the parent process. I would guess it is handled by pthread_atfork.
> 
> Ah, only the POSIX skin does that. However, sem-heaps must not be
> POSIX-only. OK, patch in the make.

Actually, xeno_skin_bind_opt should call pthread_atfork, since the child
 process should be bound again, whatever the skin.

-- 
					    Gilles.


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

* Re: [Xenomai-core] Yet another ((weak)) bug
  2010-02-12 15:37   ` Jan Kiszka
  2010-02-12 15:54     ` Gilles Chanteperdrix
@ 2010-02-12 16:03     ` Gilles Chanteperdrix
  2010-02-12 16:22       ` Jan Kiszka
  1 sibling, 1 reply; 15+ messages in thread
From: Gilles Chanteperdrix @ 2010-02-12 16:03 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: xenomai-core

Jan Kiszka wrote:
> Gilles Chanteperdrix wrote:
>> Jan Kiszka wrote:
>>> Hi Gilles,
>>>
>>> this one requires some fixing too:
>>>
>>> xeno_sem_heap is marked weak. xeno_init_sem_heaps is called once per
>>> initialized skin. It unmaps any existing heap and creates a new one.
>>> That's already fragile during constructor run, but it's lethal during
>>> process runtime, ie. when using dlopen.
>>>
>>> I think the solution is to handle forks separately and only remap in
>>> that case. Digging in this direction now.
>>>
>>> BTW, what triggers the re-run of xeno_init_sem_heaps after a fork so far?
>> It must be done for the child process to get a private heap different
>> from the parent process. I would guess it is handled by pthread_atfork.
> 
> Ah, only the POSIX skin does that. However, sem-heaps must not be
> POSIX-only. OK, patch in the make.

Ok. I am thinking more and more that you are right about making
libxeno_common a standalone library. Only the name stinks, we should
find a better one.


-- 
					    Gilles.


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

* Re: [Xenomai-core] Yet another ((weak)) bug
  2010-02-12 16:03     ` Gilles Chanteperdrix
@ 2010-02-12 16:22       ` Jan Kiszka
  2010-02-12 16:29         ` Stefan Kisdaroczi
  0 siblings, 1 reply; 15+ messages in thread
From: Jan Kiszka @ 2010-02-12 16:22 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: xenomai-core

Gilles Chanteperdrix wrote:
> Jan Kiszka wrote:
>> Gilles Chanteperdrix wrote:
>>> Jan Kiszka wrote:
>>>> Hi Gilles,
>>>>
>>>> this one requires some fixing too:
>>>>
>>>> xeno_sem_heap is marked weak. xeno_init_sem_heaps is called once per
>>>> initialized skin. It unmaps any existing heap and creates a new one.
>>>> That's already fragile during constructor run, but it's lethal during
>>>> process runtime, ie. when using dlopen.
>>>>
>>>> I think the solution is to handle forks separately and only remap in
>>>> that case. Digging in this direction now.
>>>>
>>>> BTW, what triggers the re-run of xeno_init_sem_heaps after a fork so far?
>>> It must be done for the child process to get a private heap different
>>> from the parent process. I would guess it is handled by pthread_atfork.
>> Ah, only the POSIX skin does that. However, sem-heaps must not be
>> POSIX-only. OK, patch in the make.
> 
> Ok. I am thinking more and more that you are right about making
> libxeno_common a standalone library. Only the name stinks, we should
> find a better one.

libxnskin or so?

Jan

-- 
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux


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

* Re: [Xenomai-core] Yet another ((weak)) bug
  2010-02-12 16:22       ` Jan Kiszka
@ 2010-02-12 16:29         ` Stefan Kisdaroczi
  2010-02-12 21:14           ` Gilles Chanteperdrix
  0 siblings, 1 reply; 15+ messages in thread
From: Stefan Kisdaroczi @ 2010-02-12 16:29 UTC (permalink / raw)
  To: xenomai

[-- Attachment #1: Type: text/plain, Size: 1222 bytes --]

Am 12.02.2010 17:22, schrieb Jan Kiszka:
> Gilles Chanteperdrix wrote:
>> Jan Kiszka wrote:
>>> Gilles Chanteperdrix wrote:
>>>> Jan Kiszka wrote:
>>>>> Hi Gilles,
>>>>>
>>>>> this one requires some fixing too:
>>>>>
>>>>> xeno_sem_heap is marked weak. xeno_init_sem_heaps is called once per
>>>>> initialized skin. It unmaps any existing heap and creates a new one.
>>>>> That's already fragile during constructor run, but it's lethal during
>>>>> process runtime, ie. when using dlopen.
>>>>>
>>>>> I think the solution is to handle forks separately and only remap in
>>>>> that case. Digging in this direction now.
>>>>>
>>>>> BTW, what triggers the re-run of xeno_init_sem_heaps after a fork so far?
>>>> It must be done for the child process to get a private heap different
>>>> from the parent process. I would guess it is handled by pthread_atfork.
>>> Ah, only the POSIX skin does that. However, sem-heaps must not be
>>> POSIX-only. OK, patch in the make.
>>
>> Ok. I am thinking more and more that you are right about making
>> libxeno_common a standalone library. Only the name stinks, we should
>> find a better one.
> 
> libxnskin or so?
> 
> Jan
> 

libxenomai ?

Stefan


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 251 bytes --]

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

* Re: [Xenomai-core] Yet another ((weak)) bug
  2010-02-12 15:54     ` Gilles Chanteperdrix
@ 2010-02-12 16:45       ` Jan Kiszka
  0 siblings, 0 replies; 15+ messages in thread
From: Jan Kiszka @ 2010-02-12 16:45 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: xenomai-core

Gilles Chanteperdrix wrote:
> Jan Kiszka wrote:
>> Gilles Chanteperdrix wrote:
>>> Jan Kiszka wrote:
>>>> Hi Gilles,
>>>>
>>>> this one requires some fixing too:
>>>>
>>>> xeno_sem_heap is marked weak. xeno_init_sem_heaps is called once per
>>>> initialized skin. It unmaps any existing heap and creates a new one.
>>>> That's already fragile during constructor run, but it's lethal during
>>>> process runtime, ie. when using dlopen.
>>>>
>>>> I think the solution is to handle forks separately and only remap in
>>>> that case. Digging in this direction now.
>>>>
>>>> BTW, what triggers the re-run of xeno_init_sem_heaps after a fork so far?
>>> It must be done for the child process to get a private heap different
>>> from the parent process. I would guess it is handled by pthread_atfork.
>> Ah, only the POSIX skin does that. However, sem-heaps must not be
>> POSIX-only. OK, patch in the make.
> 
> Actually, xeno_skin_bind_opt should call pthread_atfork, since the child
>  process should be bound again, whatever the skin.

That's a another thing, but it's true. First of all I just pushed a fix
for the sem_heap issue that makes our test case happy.

Jan

-- 
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux


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

* Re: [Xenomai-core] Yet another ((weak)) bug
  2010-02-12 16:29         ` Stefan Kisdaroczi
@ 2010-02-12 21:14           ` Gilles Chanteperdrix
  2010-02-24 13:18             ` Jan Kiszka
  0 siblings, 1 reply; 15+ messages in thread
From: Gilles Chanteperdrix @ 2010-02-12 21:14 UTC (permalink / raw)
  To: Stefan Kisdaroczi; +Cc: xenomai

Stefan Kisdaroczi wrote:
> Am 12.02.2010 17:22, schrieb Jan Kiszka:
>> libxnskin or so?
>>
>> Jan
>>
> 
> libxenomai ?

Ok. Let's go for libxenomai. I will try and do that in the next few days.

-- 
					    Gilles.


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

* Re: [Xenomai-core] Yet another ((weak)) bug
  2010-02-12 21:14           ` Gilles Chanteperdrix
@ 2010-02-24 13:18             ` Jan Kiszka
  2010-02-24 14:08               ` Gilles Chanteperdrix
  0 siblings, 1 reply; 15+ messages in thread
From: Jan Kiszka @ 2010-02-24 13:18 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: xenomai

Gilles Chanteperdrix wrote:
> Stefan Kisdaroczi wrote:
>> Am 12.02.2010 17:22, schrieb Jan Kiszka:
>>> libxnskin or so?
>>>
>>> Jan
>>>
>> libxenomai ?
> 
> Ok. Let's go for libxenomai. I will try and do that in the next few days.
> 

Already had a chance to look into this?

Jan

-- 
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux


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

* Re: [Xenomai-core] Yet another ((weak)) bug
  2010-02-24 13:18             ` Jan Kiszka
@ 2010-02-24 14:08               ` Gilles Chanteperdrix
  2010-03-01 14:00                 ` Jan Kiszka
  0 siblings, 1 reply; 15+ messages in thread
From: Gilles Chanteperdrix @ 2010-02-24 14:08 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: xenomai

Jan Kiszka wrote:
> Gilles Chanteperdrix wrote:
>> Stefan Kisdaroczi wrote:
>>> Am 12.02.2010 17:22, schrieb Jan Kiszka:
>>>> libxnskin or so?
>>>>
>>>> Jan
>>>>
>>> libxenomai ?
>> Ok. Let's go for libxenomai. I will try and do that in the next few days.
>>
> 
> Already had a chance to look into this?

No. I was off a few days. I just looked at it in the train, but could
not test it yet.

-- 
					    Gilles.


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

* Re: [Xenomai-core] Yet another ((weak)) bug
  2010-02-24 14:08               ` Gilles Chanteperdrix
@ 2010-03-01 14:00                 ` Jan Kiszka
  2010-03-01 14:02                   ` Gilles Chanteperdrix
  0 siblings, 1 reply; 15+ messages in thread
From: Jan Kiszka @ 2010-03-01 14:00 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: xenomai

Gilles Chanteperdrix wrote:
> Jan Kiszka wrote:
>> Gilles Chanteperdrix wrote:
>>> Stefan Kisdaroczi wrote:
>>>> Am 12.02.2010 17:22, schrieb Jan Kiszka:
>>>>> libxnskin or so?
>>>>>
>>>>> Jan
>>>>>
>>>> libxenomai ?
>>> Ok. Let's go for libxenomai. I will try and do that in the next few days.
>>>
>> Already had a chance to look into this?
> 
> No. I was off a few days. I just looked at it in the train, but could
> not test it yet.

If there is anything I can do to help accelerating it, please let me
know. We need to bake a new Xenomai package this week for our customer,
and at some point I need to decide between upstream and my temporary
fix. Upstream is generally preferred - if available.

Jan

-- 
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux


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

* Re: [Xenomai-core] Yet another ((weak)) bug
  2010-03-01 14:00                 ` Jan Kiszka
@ 2010-03-01 14:02                   ` Gilles Chanteperdrix
  2010-03-01 14:05                     ` Jan Kiszka
  0 siblings, 1 reply; 15+ messages in thread
From: Gilles Chanteperdrix @ 2010-03-01 14:02 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: xenomai

Jan Kiszka wrote:
> Gilles Chanteperdrix wrote:
>> Jan Kiszka wrote:
>>> Gilles Chanteperdrix wrote:
>>>> Stefan Kisdaroczi wrote:
>>>>> Am 12.02.2010 17:22, schrieb Jan Kiszka:
>>>>>> libxnskin or so?
>>>>>>
>>>>>> Jan
>>>>>>
>>>>> libxenomai ?
>>>> Ok. Let's go for libxenomai. I will try and do that in the next few days.
>>>>
>>> Already had a chance to look into this?
>> No. I was off a few days. I just looked at it in the train, but could
>> not test it yet.
> 
> If there is anything I can do to help accelerating it, please let me
> know. We need to bake a new Xenomai package this week for our customer,
> and at some point I need to decide between upstream and my temporary
> fix. Upstream is generally preferred - if available.

Yes, I have been a bit delayed, but should handle this this week, so as
to be ready for a release next week-end.

> 
> Jan
> 


-- 
					    Gilles.


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

* Re: [Xenomai-core] Yet another ((weak)) bug
  2010-03-01 14:02                   ` Gilles Chanteperdrix
@ 2010-03-01 14:05                     ` Jan Kiszka
  2010-03-02  0:13                       ` Gilles Chanteperdrix
  0 siblings, 1 reply; 15+ messages in thread
From: Jan Kiszka @ 2010-03-01 14:05 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: xenomai@xenomai.org

Gilles Chanteperdrix wrote:
> Jan Kiszka wrote:
>> Gilles Chanteperdrix wrote:
>>> Jan Kiszka wrote:
>>>> Gilles Chanteperdrix wrote:
>>>>> Stefan Kisdaroczi wrote:
>>>>>> Am 12.02.2010 17:22, schrieb Jan Kiszka:
>>>>>>> libxnskin or so?
>>>>>>>
>>>>>>> Jan
>>>>>>>
>>>>>> libxenomai ?
>>>>> Ok. Let's go for libxenomai. I will try and do that in the next few days.
>>>>>
>>>> Already had a chance to look into this?
>>> No. I was off a few days. I just looked at it in the train, but could
>>> not test it yet.
>> If there is anything I can do to help accelerating it, please let me
>> know. We need to bake a new Xenomai package this week for our customer,
>> and at some point I need to decide between upstream and my temporary
>> fix. Upstream is generally preferred - if available.
> 
> Yes, I have been a bit delayed, but should handle this this week, so as
> to be ready for a release next week-end.

Anything in some private branch already?

Jan

-- 
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux


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

* Re: [Xenomai-core] Yet another ((weak)) bug
  2010-03-01 14:05                     ` Jan Kiszka
@ 2010-03-02  0:13                       ` Gilles Chanteperdrix
  0 siblings, 0 replies; 15+ messages in thread
From: Gilles Chanteperdrix @ 2010-03-02  0:13 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: xenomai@xenomai.org

Jan Kiszka wrote:
> Gilles Chanteperdrix wrote:
>> Jan Kiszka wrote:
>>> Gilles Chanteperdrix wrote:
>>>> Jan Kiszka wrote:
>>>>> Gilles Chanteperdrix wrote:
>>>>>> Stefan Kisdaroczi wrote:
>>>>>>> Am 12.02.2010 17:22, schrieb Jan Kiszka:
>>>>>>>> libxnskin or so?
>>>>>>>>
>>>>>>>> Jan
>>>>>>>>
>>>>>>> libxenomai ?
>>>>>> Ok. Let's go for libxenomai. I will try and do that in the next few days.
>>>>>>
>>>>> Already had a chance to look into this?
>>>> No. I was off a few days. I just looked at it in the train, but could
>>>> not test it yet.
>>> If there is anything I can do to help accelerating it, please let me
>>> know. We need to bake a new Xenomai package this week for our customer,
>>> and at some point I need to decide between upstream and my temporary
>>> fix. Upstream is generally preferred - if available.
>> Yes, I have been a bit delayed, but should handle this this week, so as
>> to be ready for a release next week-end.
> 
> Anything in some private branch already?

Ok. Everything pushed. It works on ARM and x86. I have not tested in the
multilib and/or dlopen case, so please test it if you can.

> 
> Jan
> 


-- 
					    Gilles.


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

end of thread, other threads:[~2010-03-02  0:13 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-12 15:21 [Xenomai-core] Yet another ((weak)) bug Jan Kiszka
2010-02-12 15:25 ` Gilles Chanteperdrix
2010-02-12 15:37   ` Jan Kiszka
2010-02-12 15:54     ` Gilles Chanteperdrix
2010-02-12 16:45       ` Jan Kiszka
2010-02-12 16:03     ` Gilles Chanteperdrix
2010-02-12 16:22       ` Jan Kiszka
2010-02-12 16:29         ` Stefan Kisdaroczi
2010-02-12 21:14           ` Gilles Chanteperdrix
2010-02-24 13:18             ` Jan Kiszka
2010-02-24 14:08               ` Gilles Chanteperdrix
2010-03-01 14:00                 ` Jan Kiszka
2010-03-01 14:02                   ` Gilles Chanteperdrix
2010-03-01 14:05                     ` Jan Kiszka
2010-03-02  0:13                       ` 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.