Skip to contentSkip to conversation

Yet another ((weak)) bug

Xenomai-core Jan Kiszka 3 participants 15 messages Feb 12, 2010 – Mar 2, 2010

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

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

Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
#1 lore raw
Quoted 9 lines · Jan Kiszka

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.

Quoted 4 lines

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.

Signature · 1 line
					    Gilles.
author
#2 lore raw
Quoted 10 lines · Gilles Chanteperdrix
Quoted 9 lines · Jan Kiszka

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.

Quoted 7 lines
Quoted 4 lines

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

Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
#3 lore raw
Quoted 14 lines · Jan Kiszka
Quoted 13 lines · Gilles Chanteperdrix
Quoted 12 lines · Jan Kiszka

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.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

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.

Signature · 1 line
					    Gilles.
author
#4 lore raw
Quoted 15 lines · Gilles Chanteperdrix
Quoted 14 lines · Jan Kiszka
Quoted 13 lines · Gilles Chanteperdrix
Quoted 12 lines · Jan Kiszka

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.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

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

Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
#5 lore raw
In reply to Jan Kiszka
Quoted 14 lines · Jan Kiszka
Quoted 13 lines · Gilles Chanteperdrix
Quoted 12 lines · Jan Kiszka

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.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

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.

Signature · 1 line
					    Gilles.
author
#6 lore raw
Quoted 16 lines · Gilles Chanteperdrix
Quoted 15 lines · Jan Kiszka
Quoted 14 lines · Gilles Chanteperdrix
Quoted 13 lines · Jan Kiszka

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?

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

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

Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
#7 lore raw

Am 12.02.2010 17:22, schrieb Jan Kiszka:

Quoted 22 lines
Quoted 21 lines · Gilles Chanteperdrix
Quoted 19 lines · Jan Kiszka
Quoted 10 lines · Gilles Chanteperdrix
Quoted 9 lines · Jan Kiszka

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.

Quoted 6 lines
Quoted 4 lines

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.

Quoted 8 lines
Quoted 3 lines

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

#8 lore raw
Quoted 7 lines · Stefan Kisdaroczi

Am 12.02.2010 17:22, schrieb Jan Kiszka:

Quoted 4 lines

libxnskin or so?

Jan

libxenomai ?

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

Signature · 1 line
					    Gilles.
author
#9 lore raw
Quoted 10 lines · Gilles Chanteperdrix
Quoted 6 lines · Stefan Kisdaroczi

Am 12.02.2010 17:22, schrieb Jan Kiszka:

Quoted 4 lines

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

Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
#10 lore raw
Quoted 5 lines · Jan Kiszka
Quoted 4 lines · Gilles Chanteperdrix
Quoted 3 lines · Stefan Kisdaroczi

Am 12.02.2010 17:22, schrieb Jan Kiszka:

Quoted 2 lines

libxnskin or so?

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 2 lines

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.

Signature · 1 line
					    Gilles.
author
#11 lore raw
Quoted 8 lines · Gilles Chanteperdrix
Quoted 7 lines · Jan Kiszka
Quoted 6 lines · Gilles Chanteperdrix
Quoted 5 lines · Stefan Kisdaroczi

Am 12.02.2010 17:22, schrieb Jan Kiszka:

Quoted 4 lines

libxnskin or so?

Jan

Quoted 7 lines
Quoted 4 lines
Quoted 3 lines
Quoted 1 line

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

Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
#12 lore raw
Quoted 12 lines · Jan Kiszka
Quoted 11 lines · Gilles Chanteperdrix
Quoted 10 lines · Jan Kiszka
Quoted 9 lines · Gilles Chanteperdrix
Quoted 6 lines · Stefan Kisdaroczi

Am 12.02.2010 17:22, schrieb Jan Kiszka:

Quoted 4 lines

libxnskin or so?

Jan

libxenomai ?

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

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

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.

Quoted 3 lines

Jan

Signature · 1 line
					    Gilles.
author
#13 lore raw
Quoted 16 lines · Gilles Chanteperdrix
Quoted 15 lines · Jan Kiszka
Quoted 14 lines · Gilles Chanteperdrix
Quoted 11 lines · Jan Kiszka
Quoted 9 lines · Gilles Chanteperdrix
Quoted 6 lines · Stefan Kisdaroczi

Am 12.02.2010 17:22, schrieb Jan Kiszka:

Quoted 4 lines

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.

Quoted 7 lines
Quoted 4 lines

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

Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
#14 lore raw
Quoted 17 lines · Jan Kiszka
Quoted 16 lines · Gilles Chanteperdrix
Quoted 15 lines · Jan Kiszka
Quoted 14 lines · Gilles Chanteperdrix
Quoted 11 lines · Jan Kiszka
Quoted 9 lines · Gilles Chanteperdrix
Quoted 6 lines · Stefan Kisdaroczi

Am 12.02.2010 17:22, schrieb Jan Kiszka:

Quoted 4 lines

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.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

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.

Quoted 3 lines

Jan

Signature · 1 line
					    Gilles.