* [Xenomai-help] SIGILL when calling pthread_cleanup_push()
@ 2011-10-03 9:35 Michael Bernhard
2011-10-03 12:26 ` Gilles Chanteperdrix
0 siblings, 1 reply; 8+ messages in thread
From: Michael Bernhard @ 2011-10-03 9:35 UTC (permalink / raw)
To: xenomai@xenomai.org
Hi
We are using Xenomai-2.5.6 together with Linux-2.6.35 on a PXA270
processor. Xenomai works fine so far. However we get SIGILL when using
pthread_cleanup_push() in a RT-thread. I now tried the same over
Xenomai-2.6 and the behavior is still the same.
Here's a simple example which shows the problem (for Xenomai-2.6):
#include <stdlib.h>
#include <stdio.h>
#include <pthread.h>
#include <unistd.h>
#include <signal.h>
#include <execinfo.h>
#include <sys/mman.h>
pthread_t thread_id;
void sig_handler(int signal)
{
void *bt[32];
int nentries;
printf("Cought signal: %d\n", signal);
nentries = backtrace(bt,sizeof(bt) / sizeof(bt[0]));
backtrace_symbols_fd(bt,nentries,fileno(stdout));
}
void cancel_func(void * arg)
{
}
void * thread_func(void * arg)
{
/* When forcing a mode switch to Linux, SIGILL is not generated */
#if 0
__real_printf("Force mode switch\n");
#endif
pthread_cleanup_push (cancel_func, NULL);
pthread_cleanup_pop(1);
return NULL;
}
int main (int argc, char * argv[])
{
pthread_attr_t attr;
struct sched_param prio = {.sched_priority = 99};
signal(SIGILL, sig_handler);
mlockall(MCL_CURRENT | MCL_FUTURE);
pthread_attr_init(&attr);
pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);
pthread_attr_setschedpolicy(&attr, SCHED_FIFO);
pthread_attr_setschedparam(&attr, &prio);
pthread_create(&thread_id, &attr, thread_func, NULL);
sleep(1);
pthread_join(thread_id, NULL);
return 0;
}
SIGILL is not raised, when a mode switch to Linux is forced prior to
call pthread_cleanup_push(). It is also not rised when the RT-thread
runs under SCHED_OTHER.
The "Undefined instruction" gets incremented in /proc/xenomai/faults.
The backtrace does not reveal much information:
Cought signal: 4
./sigill[0x89bc]
/lib/libc.so.6(__default_sa_restorer_v2+0x0)[0x8bda90]
/lib/libc.so.6(__sigsetjmp+0x38)[0x8bc4f8]
./sigill[0x8a44]
/usr/xenomai/lib/libpthread_rt.so.1(+0x4448)[0x82c448]
/lib/libpthread.so.0(+0x5b60)[0x852b60]
/lib/libc.so.6(clone+0x88)[0x967c58]
What is going wrong here?
--
Michael
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [Xenomai-help] SIGILL when calling pthread_cleanup_push()
2011-10-03 9:35 [Xenomai-help] SIGILL when calling pthread_cleanup_push() Michael Bernhard
@ 2011-10-03 12:26 ` Gilles Chanteperdrix
2011-10-03 15:33 ` Gilles Chanteperdrix
0 siblings, 1 reply; 8+ messages in thread
From: Gilles Chanteperdrix @ 2011-10-03 12:26 UTC (permalink / raw)
To: Michael Bernhard; +Cc: xenomai@xenomai.org
On 10/03/2011 11:35 AM, Michael Bernhard wrote:
> Hi
>
> We are using Xenomai-2.5.6 together with Linux-2.6.35 on a PXA270
> processor. Xenomai works fine so far. However we get SIGILL when using
> pthread_cleanup_push() in a RT-thread. I now tried the same over
> Xenomai-2.6 and the behavior is still the same.
>
> Here's a simple example which shows the problem (for Xenomai-2.6):
Ok. Thanks for testing xenomai 2.6 by the way. I will try the test
program on an ARMv5 I have tonight. However, could you tell us a bit
more about your setup? What toolchain do you use? What threading library?
--
Gilles.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Xenomai-help] SIGILL when calling pthread_cleanup_push()
2011-10-03 12:26 ` Gilles Chanteperdrix
@ 2011-10-03 15:33 ` Gilles Chanteperdrix
2011-10-04 11:25 ` Gilles Chanteperdrix
0 siblings, 1 reply; 8+ messages in thread
From: Gilles Chanteperdrix @ 2011-10-03 15:33 UTC (permalink / raw)
To: Michael Bernhard; +Cc: xenomai@xenomai.org
On 10/03/2011 02:26 PM, Gilles Chanteperdrix wrote:
> On 10/03/2011 11:35 AM, Michael Bernhard wrote:
>> Hi
>>
>> We are using Xenomai-2.5.6 together with Linux-2.6.35 on a PXA270
>> processor. Xenomai works fine so far. However we get SIGILL when using
>> pthread_cleanup_push() in a RT-thread. I now tried the same over
>> Xenomai-2.6 and the behavior is still the same.
>>
>> Here's a simple example which shows the problem (for Xenomai-2.6):
>
> Ok. Thanks for testing xenomai 2.6 by the way. I will try the test
> program on an ARMv5 I have tonight. However, could you tell us a bit
> more about your setup? What toolchain do you use? What threading library?
And also: is your libc built with iwmmxt support?
--
Gilles.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Xenomai-help] SIGILL when calling pthread_cleanup_push()
2011-10-03 15:33 ` Gilles Chanteperdrix
@ 2011-10-04 11:25 ` Gilles Chanteperdrix
2011-10-04 15:14 ` Michael Bernhard
0 siblings, 1 reply; 8+ messages in thread
From: Gilles Chanteperdrix @ 2011-10-04 11:25 UTC (permalink / raw)
To: Michael Bernhard; +Cc: xenomai@xenomai.org
On 10/03/2011 05:33 PM, Gilles Chanteperdrix wrote:
> On 10/03/2011 02:26 PM, Gilles Chanteperdrix wrote:
>> On 10/03/2011 11:35 AM, Michael Bernhard wrote:
>>> Hi
>>>
>>> We are using Xenomai-2.5.6 together with Linux-2.6.35 on a PXA270
>>> processor. Xenomai works fine so far. However we get SIGILL when using
>>> pthread_cleanup_push() in a RT-thread. I now tried the same over
>>> Xenomai-2.6 and the behavior is still the same.
>>>
>>> Here's a simple example which shows the problem (for Xenomai-2.6):
>>
>> Ok. Thanks for testing xenomai 2.6 by the way. I will try the test
>> program on an ARMv5 I have tonight. However, could you tell us a bit
>> more about your setup? What toolchain do you use? What threading library?
>
> And also: is your libc built with iwmmxt support?
>
Hi Michael,
I can not reproduce this issue on another armv5 I have, but it does not
support iwmmxt. So, in order to see if the problem you have comes from
iwmmxt, you should try and build a root filesystem with a soft-float
toolchain, such as, for instance, the codesourcery toolchain.
Currently, iwmmxt floats are not supported with Xenomai, so, if you want
to get them working, something will have to be done.
Regards.
--
Gilles.
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [Xenomai-help] SIGILL when calling pthread_cleanup_push()
2011-10-04 11:25 ` Gilles Chanteperdrix
@ 2011-10-04 15:14 ` Michael Bernhard
2011-10-04 15:29 ` Gilles Chanteperdrix
0 siblings, 1 reply; 8+ messages in thread
From: Michael Bernhard @ 2011-10-04 15:14 UTC (permalink / raw)
To: xenomai
Gilles Chanteperdrix <gilles.chanteperdrix <at> xenomai.org> writes:
>
> On 10/03/2011 05:33 PM, Gilles Chanteperdrix wrote:
> > On 10/03/2011 02:26 PM, Gilles Chanteperdrix wrote:
> >> Ok. Thanks for testing xenomai 2.6 by the way. I will try the test
> >> program on an ARMv5 I have tonight. However, could you tell us a bit
> >> more about your setup? What toolchain do you use? What threading library?
We use codesourcery toolchain arm-2010.09. The rootfs was built using PTXdist.
I think, but have to verify, that NPTL is used as threading library.
> > And also: is your libc built with iwmmxt support?
I don't know, but will find out.
> I can not reproduce this issue on another armv5 I have, but it does not
> support iwmmxt. So, in order to see if the problem you have comes from
> iwmmxt, you should try and build a root filesystem with a soft-float
> toolchain, such as, for instance, the codesourcery toolchain.
>
> Currently, iwmmxt floats are not supported with Xenomai, so, if you want
> to get them working, something will have to be done.
In the example I gave, no floats were used. Does Xenomai needs to support iwmmxt
floats also in this case? And would compiling the application with -msoft-float
do the trick?
ATM, I'm busy with other things but have time to investigate tomorrow evening.
--
Michael
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Xenomai-help] SIGILL when calling pthread_cleanup_push()
2011-10-04 15:14 ` Michael Bernhard
@ 2011-10-04 15:29 ` Gilles Chanteperdrix
2011-10-05 17:07 ` Michael Bernhard
0 siblings, 1 reply; 8+ messages in thread
From: Gilles Chanteperdrix @ 2011-10-04 15:29 UTC (permalink / raw)
To: Michael Bernhard; +Cc: xenomai
On 10/04/2011 05:14 PM, Michael Bernhard wrote:
> Gilles Chanteperdrix <gilles.chanteperdrix <at> xenomai.org> writes:
>>
>> On 10/03/2011 05:33 PM, Gilles Chanteperdrix wrote:
>>> On 10/03/2011 02:26 PM, Gilles Chanteperdrix wrote:
>>>> Ok. Thanks for testing xenomai 2.6 by the way. I will try the test
>>>> program on an ARMv5 I have tonight. However, could you tell us a bit
>>>> more about your setup? What toolchain do you use? What threading library?
> We use codesourcery toolchain arm-2010.09. The rootfs was built using PTXdist.
> I think, but have to verify, that NPTL is used as threading library.
>
>>> And also: is your libc built with iwmmxt support?
> I don't know, but will find out.
>
>> I can not reproduce this issue on another armv5 I have, but it does not
>> support iwmmxt. So, in order to see if the problem you have comes from
>> iwmmxt, you should try and build a root filesystem with a soft-float
>> toolchain, such as, for instance, the codesourcery toolchain.
>>
>> Currently, iwmmxt floats are not supported with Xenomai, so, if you want
>> to get them working, something will have to be done.
> In the example I gave, no floats were used. Does Xenomai needs to support iwmmxt
> floats also in this case? And would compiling the application with -msoft-float
> do the trick?
>
> ATM, I'm busy with other things but have time to investigate tomorrow evening.
The bug happens inside sigsetjmp, which is a routine saving the current
context. So, if the libc is compiled with iwmmmxt support, and more
importantly, if the kernel is compiled with iwmmxt support, sigsetjmp
probably saves the floating point registers.
So another simple thing to try is to disable iwmmxt support in kernel
configuration.
--
Gilles.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Xenomai-help] SIGILL when calling pthread_cleanup_push()
2011-10-04 15:29 ` Gilles Chanteperdrix
@ 2011-10-05 17:07 ` Michael Bernhard
2011-10-05 17:35 ` Gilles Chanteperdrix
0 siblings, 1 reply; 8+ messages in thread
From: Michael Bernhard @ 2011-10-05 17:07 UTC (permalink / raw)
To: Gilles Chanteperdrix; +Cc: xenomai@xenomai.org
On 10/04/2011 05:29 PM, Gilles Chanteperdrix wrote:
> On 10/04/2011 05:14 PM, Michael Bernhard wrote:
>> Gilles Chanteperdrix<gilles.chanteperdrix<at> xenomai.org> writes:
>>>
>>> On 10/03/2011 05:33 PM, Gilles Chanteperdrix wrote:
>>>> On 10/03/2011 02:26 PM, Gilles Chanteperdrix wrote:
>>>>> Ok. Thanks for testing xenomai 2.6 by the way. I will try the test
>>>>> program on an ARMv5 I have tonight. However, could you tell us a bit
>>>>> more about your setup? What toolchain do you use? What threading library?
>> We use codesourcery toolchain arm-2010.09. The rootfs was built using PTXdist.
>> I think, but have to verify, that NPTL is used as threading library.
>>
>>>> And also: is your libc built with iwmmxt support?
>> I don't know, but will find out.
>>
>>> I can not reproduce this issue on another armv5 I have, but it does not
>>> support iwmmxt. So, in order to see if the problem you have comes from
>>> iwmmxt, you should try and build a root filesystem with a soft-float
>>> toolchain, such as, for instance, the codesourcery toolchain.
>>>
>>> Currently, iwmmxt floats are not supported with Xenomai, so, if you want
>>> to get them working, something will have to be done.
>> In the example I gave, no floats were used. Does Xenomai needs to support iwmmxt
>> floats also in this case? And would compiling the application with -msoft-float
>> do the trick?
>>
>> ATM, I'm busy with other things but have time to investigate tomorrow evening.
>
> The bug happens inside sigsetjmp, which is a routine saving the current
> context. So, if the libc is compiled with iwmmmxt support, and more
> importantly, if the kernel is compiled with iwmmxt support, sigsetjmp
> probably saves the floating point registers.
>
> So another simple thing to try is to disable iwmmxt support in kernel
> configuration.
I disabled iwmmxt support in the kernel my test is now working.
However what happens to applications/libraries that are compiled with
iwmmxt support when this feature is disabled in the kernel?
What has to be changed in Xenomai to have iwmmxt support?
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Xenomai-help] SIGILL when calling pthread_cleanup_push()
2011-10-05 17:07 ` Michael Bernhard
@ 2011-10-05 17:35 ` Gilles Chanteperdrix
0 siblings, 0 replies; 8+ messages in thread
From: Gilles Chanteperdrix @ 2011-10-05 17:35 UTC (permalink / raw)
To: Michael Bernhard; +Cc: xenomai@xenomai.org
On 10/05/2011 07:07 PM, Michael Bernhard wrote:
> On 10/04/2011 05:29 PM, Gilles Chanteperdrix wrote:
>> On 10/04/2011 05:14 PM, Michael Bernhard wrote:
>>> Gilles Chanteperdrix<gilles.chanteperdrix<at> xenomai.org> writes:
>>>>
>>>> On 10/03/2011 05:33 PM, Gilles Chanteperdrix wrote:
>>>>> On 10/03/2011 02:26 PM, Gilles Chanteperdrix wrote:
>>>>>> Ok. Thanks for testing xenomai 2.6 by the way. I will try the test
>>>>>> program on an ARMv5 I have tonight. However, could you tell us a bit
>>>>>> more about your setup? What toolchain do you use? What threading library?
>>> We use codesourcery toolchain arm-2010.09. The rootfs was built using PTXdist.
>>> I think, but have to verify, that NPTL is used as threading library.
>>>
>>>>> And also: is your libc built with iwmmxt support?
>>> I don't know, but will find out.
>>>
>>>> I can not reproduce this issue on another armv5 I have, but it does not
>>>> support iwmmxt. So, in order to see if the problem you have comes from
>>>> iwmmxt, you should try and build a root filesystem with a soft-float
>>>> toolchain, such as, for instance, the codesourcery toolchain.
>>>>
>>>> Currently, iwmmxt floats are not supported with Xenomai, so, if you want
>>>> to get them working, something will have to be done.
>>> In the example I gave, no floats were used. Does Xenomai needs to support iwmmxt
>>> floats also in this case? And would compiling the application with -msoft-float
>>> do the trick?
>>>
>>> ATM, I'm busy with other things but have time to investigate tomorrow evening.
>>
>> The bug happens inside sigsetjmp, which is a routine saving the current
>> context. So, if the libc is compiled with iwmmmxt support, and more
>> importantly, if the kernel is compiled with iwmmxt support, sigsetjmp
>> probably saves the floating point registers.
>>
>> So another simple thing to try is to disable iwmmxt support in kernel
>> configuration.
> I disabled iwmmxt support in the kernel my test is now working.
>
> However what happens to applications/libraries that are compiled with
> iwmmxt support when this feature is disabled in the kernel?
They will get... a SIGILL when trying to use the iwmmxt instructions.
>
> What has to be changed in Xenomai to have iwmmxt support?
Support for switching iwmmxt context, and this is painful. Philippe and
I worked on x86 floating points and ARM/VFP, and it took several
iterations to get it working correctly. The initial port of Xenomai on
PXA was done without access to real hardware, but support for a new
floating point instruction set can not be done that way.
--
Gilles.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2011-10-05 17:35 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-03 9:35 [Xenomai-help] SIGILL when calling pthread_cleanup_push() Michael Bernhard
2011-10-03 12:26 ` Gilles Chanteperdrix
2011-10-03 15:33 ` Gilles Chanteperdrix
2011-10-04 11:25 ` Gilles Chanteperdrix
2011-10-04 15:14 ` Michael Bernhard
2011-10-04 15:29 ` Gilles Chanteperdrix
2011-10-05 17:07 ` Michael Bernhard
2011-10-05 17:35 ` 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.