All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-core] Warning when compiling trunk.
@ 2008-10-20 19:30 Gilles Chanteperdrix
  2008-10-20 20:03 ` Jan Kiszka
  0 siblings, 1 reply; 20+ messages in thread
From: Gilles Chanteperdrix @ 2008-10-20 19:30 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: Xenomai core


I get this warning when compiling trunk:

checking for __thread... rm: cannot remove `conftest1.dir': Is a directory
yes

-- 
					    Gilles.


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

* Re: [Xenomai-core] Warning when compiling trunk.
  2008-10-20 19:30 [Xenomai-core] Warning when compiling trunk Gilles Chanteperdrix
@ 2008-10-20 20:03 ` Jan Kiszka
  2008-10-20 20:34   ` Gilles Chanteperdrix
  0 siblings, 1 reply; 20+ messages in thread
From: Jan Kiszka @ 2008-10-20 20:03 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: Xenomai core

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

Gilles Chanteperdrix wrote:
> I get this warning when compiling trunk:
> 
> checking for __thread... rm: cannot remove `conftest1.dir': Is a directory
> yes
> 

That simple, it's a typo in this line:

http://www.rts.uni-hannover.de/xenomai/lxr/source/configure.in?v=SVN-trunk#394

Also, that rm should be done outside the if block to play safe.

Jan


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

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

* Re: [Xenomai-core] Warning when compiling trunk.
  2008-10-20 20:03 ` Jan Kiszka
@ 2008-10-20 20:34   ` Gilles Chanteperdrix
  2008-10-20 20:37     ` Gilles Chanteperdrix
  0 siblings, 1 reply; 20+ messages in thread
From: Gilles Chanteperdrix @ 2008-10-20 20:34 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: Xenomai core

Jan Kiszka wrote:
> Gilles Chanteperdrix wrote:
>> I get this warning when compiling trunk:
>>
>> checking for __thread... rm: cannot remove `conftest1.dir': Is a directory
>> yes
>>
> 
> That simple, it's a typo in this line:
> 
> http://www.rts.uni-hannover.de/xenomai/lxr/source/configure.in?v=SVN-trunk#394
> 
> Also, that rm should be done outside the if block to play safe.

Ok. But once this is fixed, I get a segmentation fault with __thread on
ARM in rt_task_trampoline. I am currently testing the SIGWINCH thing,
and if __thread is disabled, there is no segfault.

-- 
					    Gilles.


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

* Re: [Xenomai-core] Warning when compiling trunk.
  2008-10-20 20:34   ` Gilles Chanteperdrix
@ 2008-10-20 20:37     ` Gilles Chanteperdrix
  2008-10-20 20:42       ` Jan Kiszka
  0 siblings, 1 reply; 20+ messages in thread
From: Gilles Chanteperdrix @ 2008-10-20 20:37 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: Xenomai core

Gilles Chanteperdrix wrote:
> Jan Kiszka wrote:
>> Gilles Chanteperdrix wrote:
>>> I get this warning when compiling trunk:
>>>
>>> checking for __thread... rm: cannot remove `conftest1.dir': Is a directory
>>> yes
>>>
>> That simple, it's a typo in this line:
>>
>> http://www.rts.uni-hannover.de/xenomai/lxr/source/configure.in?v=SVN-trunk#394
>>
>> Also, that rm should be done outside the if block to play safe.
> 
> Ok. But once this is fixed, I get a segmentation fault with __thread on
> ARM in rt_task_trampoline. I am currently testing the SIGWINCH thing,
> and if __thread is disabled, there is no segfault.

If a #ifdef 0 xeno_set_current, there is no segfault.

-- 
					    Gilles.


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

* Re: [Xenomai-core] Warning when compiling trunk.
  2008-10-20 20:37     ` Gilles Chanteperdrix
@ 2008-10-20 20:42       ` Jan Kiszka
  2008-10-20 20:59         ` Gilles Chanteperdrix
  0 siblings, 1 reply; 20+ messages in thread
From: Jan Kiszka @ 2008-10-20 20:42 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: Xenomai core

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

Gilles Chanteperdrix wrote:
> Gilles Chanteperdrix wrote:
>> Jan Kiszka wrote:
>>> Gilles Chanteperdrix wrote:
>>>> I get this warning when compiling trunk:
>>>>
>>>> checking for __thread... rm: cannot remove `conftest1.dir': Is a directory
>>>> yes
>>>>
>>> That simple, it's a typo in this line:
>>>
>>> http://www.rts.uni-hannover.de/xenomai/lxr/source/configure.in?v=SVN-trunk#394
>>>
>>> Also, that rm should be done outside the if block to play safe.
>> Ok. But once this is fixed, I get a segmentation fault with __thread on
>> ARM in rt_task_trampoline. I am currently testing the SIGWINCH thing,
>> and if __thread is disabled, there is no segfault.
> 
> If a #ifdef 0 xeno_set_current, there is no segfault.
> 

Interesting. What about removing the initial-exec attributes? Is
__thread otherwise know to work on your platform?

Jan


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

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

* Re: [Xenomai-core] Warning when compiling trunk.
  2008-10-20 20:42       ` Jan Kiszka
@ 2008-10-20 20:59         ` Gilles Chanteperdrix
  2008-10-20 21:06           ` Gilles Chanteperdrix
  2008-10-20 21:12           ` Jan Kiszka
  0 siblings, 2 replies; 20+ messages in thread
From: Gilles Chanteperdrix @ 2008-10-20 20:59 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: Xenomai core

Jan Kiszka wrote:
> Gilles Chanteperdrix wrote:
>> Gilles Chanteperdrix wrote:
>>> Jan Kiszka wrote:
>>>> Gilles Chanteperdrix wrote:
>>>>> I get this warning when compiling trunk:
>>>>>
>>>>> checking for __thread... rm: cannot remove `conftest1.dir': Is a directory
>>>>> yes
>>>>>
>>>> That simple, it's a typo in this line:
>>>>
>>>> http://www.rts.uni-hannover.de/xenomai/lxr/source/configure.in?v=SVN-trunk#394
>>>>
>>>> Also, that rm should be done outside the if block to play safe.
>>> Ok. But once this is fixed, I get a segmentation fault with __thread on
>>> ARM in rt_task_trampoline. I am currently testing the SIGWINCH thing,
>>> and if __thread is disabled, there is no segfault.
>> If a #ifdef 0 xeno_set_current, there is no segfault.
>>
> 
> Interesting. What about removing the initial-exec attributes? Is
> __thread otherwise know to work on your platform?

Yes. This is a race condition, the real bug is, IMHO:
	__native_self = *iargs->task;
When the segfault happens iargs->task is NULL. I suspect you are not
supposed to use iargs after the __native_task_create syscall.

-- 
					    Gilles.


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

* Re: [Xenomai-core] Warning when compiling trunk.
  2008-10-20 20:59         ` Gilles Chanteperdrix
@ 2008-10-20 21:06           ` Gilles Chanteperdrix
  2008-10-20 21:15             ` Jan Kiszka
  2008-10-20 21:12           ` Jan Kiszka
  1 sibling, 1 reply; 20+ messages in thread
From: Gilles Chanteperdrix @ 2008-10-20 21:06 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: Xenomai core

Gilles Chanteperdrix wrote:
> Jan Kiszka wrote:
>> Gilles Chanteperdrix wrote:
>>> Gilles Chanteperdrix wrote:
>>>> Jan Kiszka wrote:
>>>>> Gilles Chanteperdrix wrote:
>>>>>> I get this warning when compiling trunk:
>>>>>>
>>>>>> checking for __thread... rm: cannot remove `conftest1.dir': Is a directory
>>>>>> yes
>>>>>>
>>>>> That simple, it's a typo in this line:
>>>>>
>>>>> http://www.rts.uni-hannover.de/xenomai/lxr/source/configure.in?v=SVN-trunk#394
>>>>>
>>>>> Also, that rm should be done outside the if block to play safe.
>>>> Ok. But once this is fixed, I get a segmentation fault with __thread on
>>>> ARM in rt_task_trampoline. I am currently testing the SIGWINCH thing,
>>>> and if __thread is disabled, there is no segfault.
>>> If a #ifdef 0 xeno_set_current, there is no segfault.
>>>
>> Interesting. What about removing the initial-exec attributes? Is
>> __thread otherwise know to work on your platform?
> 
> Yes. This is a race condition, the real bug is, IMHO:
> 	__native_self = *iargs->task;
> When the segfault happens iargs->task is NULL. I suspect you are not
> supposed to use iargs after the __native_task_create syscall.

Yes, that was the problem.

However, another problem, should not the __thread variables be given the
weak attribute too? If a native thread tries to use a pthread mutex, I
want pthread_mutex_lock to obtain the current xnhandle_t set by the
native skin, not an inexistant one that should have been set by the
posix skin but obviously has not.

-- 
					    Gilles.


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

* Re: [Xenomai-core] Warning when compiling trunk.
  2008-10-20 20:59         ` Gilles Chanteperdrix
  2008-10-20 21:06           ` Gilles Chanteperdrix
@ 2008-10-20 21:12           ` Jan Kiszka
  1 sibling, 0 replies; 20+ messages in thread
From: Jan Kiszka @ 2008-10-20 21:12 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: Xenomai core

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

Gilles Chanteperdrix wrote:
> Jan Kiszka wrote:
>> Gilles Chanteperdrix wrote:
>>> Gilles Chanteperdrix wrote:
>>>> Jan Kiszka wrote:
>>>>> Gilles Chanteperdrix wrote:
>>>>>> I get this warning when compiling trunk:
>>>>>>
>>>>>> checking for __thread... rm: cannot remove `conftest1.dir': Is a directory
>>>>>> yes
>>>>>>
>>>>> That simple, it's a typo in this line:
>>>>>
>>>>> http://www.rts.uni-hannover.de/xenomai/lxr/source/configure.in?v=SVN-trunk#394
>>>>>
>>>>> Also, that rm should be done outside the if block to play safe.
>>>> Ok. But once this is fixed, I get a segmentation fault with __thread on
>>>> ARM in rt_task_trampoline. I am currently testing the SIGWINCH thing,
>>>> and if __thread is disabled, there is no segfault.
>>> If a #ifdef 0 xeno_set_current, there is no segfault.
>>>
>> Interesting. What about removing the initial-exec attributes? Is
>> __thread otherwise know to work on your platform?
> 
> Yes. This is a race condition, the real bug is, IMHO:
> 	__native_self = *iargs->task;
> When the segfault happens iargs->task is NULL. I suspect you are not
> supposed to use iargs after the __native_task_create syscall.

Don't see the race yet. iargs is provided by the trampoline creator, and
with that one we synchronize with the barrier AFTER this access - or
does the compiler some fancy reordering here?

Jan


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

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

* Re: [Xenomai-core] Warning when compiling trunk.
  2008-10-20 21:06           ` Gilles Chanteperdrix
@ 2008-10-20 21:15             ` Jan Kiszka
  2008-10-20 21:25               ` Gilles Chanteperdrix
  0 siblings, 1 reply; 20+ messages in thread
From: Jan Kiszka @ 2008-10-20 21:15 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: Xenomai core

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

Gilles Chanteperdrix wrote:
> Gilles Chanteperdrix wrote:
>> Jan Kiszka wrote:
>>> Gilles Chanteperdrix wrote:
>>>> Gilles Chanteperdrix wrote:
>>>>> Jan Kiszka wrote:
>>>>>> Gilles Chanteperdrix wrote:
>>>>>>> I get this warning when compiling trunk:
>>>>>>>
>>>>>>> checking for __thread... rm: cannot remove `conftest1.dir': Is a directory
>>>>>>> yes
>>>>>>>
>>>>>> That simple, it's a typo in this line:
>>>>>>
>>>>>> http://www.rts.uni-hannover.de/xenomai/lxr/source/configure.in?v=SVN-trunk#394
>>>>>>
>>>>>> Also, that rm should be done outside the if block to play safe.
>>>>> Ok. But once this is fixed, I get a segmentation fault with __thread on
>>>>> ARM in rt_task_trampoline. I am currently testing the SIGWINCH thing,
>>>>> and if __thread is disabled, there is no segfault.
>>>> If a #ifdef 0 xeno_set_current, there is no segfault.
>>>>
>>> Interesting. What about removing the initial-exec attributes? Is
>>> __thread otherwise know to work on your platform?
>> Yes. This is a race condition, the real bug is, IMHO:
>> 	__native_self = *iargs->task;
>> When the segfault happens iargs->task is NULL. I suspect you are not
>> supposed to use iargs after the __native_task_create syscall.
> 
> Yes, that was the problem.

What did you change? Can you explain the why to me?

> 
> However, another problem, should not the __thread variables be given the
> weak attribute too? If a native thread tries to use a pthread mutex, I
> want pthread_mutex_lock to obtain the current xnhandle_t set by the
> native skin, not an inexistant one that should have been set by the
> posix skin but obviously has not.
> 

Yes, true. Please commit a fix as you are already patching.

Jan


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

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

* Re: [Xenomai-core] Warning when compiling trunk.
  2008-10-20 21:15             ` Jan Kiszka
@ 2008-10-20 21:25               ` Gilles Chanteperdrix
  2008-10-20 21:30                 ` Jan Kiszka
  0 siblings, 1 reply; 20+ messages in thread
From: Gilles Chanteperdrix @ 2008-10-20 21:25 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: Xenomai core

Jan Kiszka wrote:
> Gilles Chanteperdrix wrote:
>> Gilles Chanteperdrix wrote:
>>> Jan Kiszka wrote:
>>>> Gilles Chanteperdrix wrote:
>>>>> Gilles Chanteperdrix wrote:
>>>>>> Jan Kiszka wrote:
>>>>>>> Gilles Chanteperdrix wrote:
>>>>>>>> I get this warning when compiling trunk:
>>>>>>>>
>>>>>>>> checking for __thread... rm: cannot remove `conftest1.dir': Is a directory
>>>>>>>> yes
>>>>>>>>
>>>>>>> That simple, it's a typo in this line:
>>>>>>>
>>>>>>> http://www.rts.uni-hannover.de/xenomai/lxr/source/configure.in?v=SVN-trunk#394
>>>>>>>
>>>>>>> Also, that rm should be done outside the if block to play safe.
>>>>>> Ok. But once this is fixed, I get a segmentation fault with __thread on
>>>>>> ARM in rt_task_trampoline. I am currently testing the SIGWINCH thing,
>>>>>> and if __thread is disabled, there is no segfault.
>>>>> If a #ifdef 0 xeno_set_current, there is no segfault.
>>>>>
>>>> Interesting. What about removing the initial-exec attributes? Is
>>>> __thread otherwise know to work on your platform?
>>> Yes. This is a race condition, the real bug is, IMHO:
>>> 	__native_self = *iargs->task;
>>> When the segfault happens iargs->task is NULL. I suspect you are not
>>> supposed to use iargs after the __native_task_create syscall.
>> Yes, that was the problem.
> 
> What did you change? Can you explain the why to me?

Because I guess iargs is no longer valid at this point. So, I saved the
task pointer and reused it.

-- 
					    Gilles.


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

* Re: [Xenomai-core] Warning when compiling trunk.
  2008-10-20 21:25               ` Gilles Chanteperdrix
@ 2008-10-20 21:30                 ` Jan Kiszka
  2008-10-20 21:32                   ` Gilles Chanteperdrix
  2008-10-21  7:36                   ` Philippe Gerum
  0 siblings, 2 replies; 20+ messages in thread
From: Jan Kiszka @ 2008-10-20 21:30 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: Xenomai core

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

Gilles Chanteperdrix wrote:
> Jan Kiszka wrote:
>> Gilles Chanteperdrix wrote:
>>> Gilles Chanteperdrix wrote:
>>>> Jan Kiszka wrote:
>>>>> Gilles Chanteperdrix wrote:
>>>>>> Gilles Chanteperdrix wrote:
>>>>>>> Jan Kiszka wrote:
>>>>>>>> Gilles Chanteperdrix wrote:
>>>>>>>>> I get this warning when compiling trunk:
>>>>>>>>>
>>>>>>>>> checking for __thread... rm: cannot remove `conftest1.dir': Is a directory
>>>>>>>>> yes
>>>>>>>>>
>>>>>>>> That simple, it's a typo in this line:
>>>>>>>>
>>>>>>>> http://www.rts.uni-hannover.de/xenomai/lxr/source/configure.in?v=SVN-trunk#394
>>>>>>>>
>>>>>>>> Also, that rm should be done outside the if block to play safe.
>>>>>>> Ok. But once this is fixed, I get a segmentation fault with __thread on
>>>>>>> ARM in rt_task_trampoline. I am currently testing the SIGWINCH thing,
>>>>>>> and if __thread is disabled, there is no segfault.
>>>>>> If a #ifdef 0 xeno_set_current, there is no segfault.
>>>>>>
>>>>> Interesting. What about removing the initial-exec attributes? Is
>>>>> __thread otherwise know to work on your platform?
>>>> Yes. This is a race condition, the real bug is, IMHO:
>>>> 	__native_self = *iargs->task;
>>>> When the segfault happens iargs->task is NULL. I suspect you are not
>>>> supposed to use iargs after the __native_task_create syscall.
>>> Yes, that was the problem.
>> What did you change? Can you explain the why to me?
> 
> Because I guess iargs is no longer valid at this point. So, I saved the
> task pointer and reused it.
> 

Sorry, makes no sense to me: *iargs is on the stack of the
rt_task_create caller, and that one is not expected to proceed until we
issue __xn_sys_barrier.

Jan


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

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

* Re: [Xenomai-core] Warning when compiling trunk.
  2008-10-20 21:30                 ` Jan Kiszka
@ 2008-10-20 21:32                   ` Gilles Chanteperdrix
  2008-10-20 21:34                     ` Jan Kiszka
  2008-10-21  7:36                   ` Philippe Gerum
  1 sibling, 1 reply; 20+ messages in thread
From: Gilles Chanteperdrix @ 2008-10-20 21:32 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: Xenomai core

Jan Kiszka wrote:
> Gilles Chanteperdrix wrote:
>> Jan Kiszka wrote:
>>> Gilles Chanteperdrix wrote:
>>>> Gilles Chanteperdrix wrote:
>>>>> Jan Kiszka wrote:
>>>>>> Gilles Chanteperdrix wrote:
>>>>>>> Gilles Chanteperdrix wrote:
>>>>>>>> Jan Kiszka wrote:
>>>>>>>>> Gilles Chanteperdrix wrote:
>>>>>>>>>> I get this warning when compiling trunk:
>>>>>>>>>>
>>>>>>>>>> checking for __thread... rm: cannot remove `conftest1.dir': Is a directory
>>>>>>>>>> yes
>>>>>>>>>>
>>>>>>>>> That simple, it's a typo in this line:
>>>>>>>>>
>>>>>>>>> http://www.rts.uni-hannover.de/xenomai/lxr/source/configure.in?v=SVN-trunk#394
>>>>>>>>>
>>>>>>>>> Also, that rm should be done outside the if block to play safe.
>>>>>>>> Ok. But once this is fixed, I get a segmentation fault with __thread on
>>>>>>>> ARM in rt_task_trampoline. I am currently testing the SIGWINCH thing,
>>>>>>>> and if __thread is disabled, there is no segfault.
>>>>>>> If a #ifdef 0 xeno_set_current, there is no segfault.
>>>>>>>
>>>>>> Interesting. What about removing the initial-exec attributes? Is
>>>>>> __thread otherwise know to work on your platform?
>>>>> Yes. This is a race condition, the real bug is, IMHO:
>>>>> 	__native_self = *iargs->task;
>>>>> When the segfault happens iargs->task is NULL. I suspect you are not
>>>>> supposed to use iargs after the __native_task_create syscall.
>>>> Yes, that was the problem.
>>> What did you change? Can you explain the why to me?
>> Because I guess iargs is no longer valid at this point. So, I saved the
>> task pointer and reused it.
>>
> 
> Sorry, makes no sense to me: *iargs is on the stack of the
> rt_task_create caller, and that one is not expected to proceed until we
> issue __xn_sys_barrier.

Well I am busy with the ARM FCSE now. Do you want my test case ?

-- 
					    Gilles.


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

* Re: [Xenomai-core] Warning when compiling trunk.
  2008-10-20 21:32                   ` Gilles Chanteperdrix
@ 2008-10-20 21:34                     ` Jan Kiszka
  2008-10-20 21:35                       ` Gilles Chanteperdrix
  0 siblings, 1 reply; 20+ messages in thread
From: Jan Kiszka @ 2008-10-20 21:34 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: Xenomai core

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

Gilles Chanteperdrix wrote:
> Jan Kiszka wrote:
>> Gilles Chanteperdrix wrote:
>>> Jan Kiszka wrote:
>>>> Gilles Chanteperdrix wrote:
>>>>> Gilles Chanteperdrix wrote:
>>>>>> Jan Kiszka wrote:
>>>>>>> Gilles Chanteperdrix wrote:
>>>>>>>> Gilles Chanteperdrix wrote:
>>>>>>>>> Jan Kiszka wrote:
>>>>>>>>>> Gilles Chanteperdrix wrote:
>>>>>>>>>>> I get this warning when compiling trunk:
>>>>>>>>>>>
>>>>>>>>>>> checking for __thread... rm: cannot remove `conftest1.dir': Is a directory
>>>>>>>>>>> yes
>>>>>>>>>>>
>>>>>>>>>> That simple, it's a typo in this line:
>>>>>>>>>>
>>>>>>>>>> http://www.rts.uni-hannover.de/xenomai/lxr/source/configure.in?v=SVN-trunk#394
>>>>>>>>>>
>>>>>>>>>> Also, that rm should be done outside the if block to play safe.
>>>>>>>>> Ok. But once this is fixed, I get a segmentation fault with __thread on
>>>>>>>>> ARM in rt_task_trampoline. I am currently testing the SIGWINCH thing,
>>>>>>>>> and if __thread is disabled, there is no segfault.
>>>>>>>> If a #ifdef 0 xeno_set_current, there is no segfault.
>>>>>>>>
>>>>>>> Interesting. What about removing the initial-exec attributes? Is
>>>>>>> __thread otherwise know to work on your platform?
>>>>>> Yes. This is a race condition, the real bug is, IMHO:
>>>>>> 	__native_self = *iargs->task;
>>>>>> When the segfault happens iargs->task is NULL. I suspect you are not
>>>>>> supposed to use iargs after the __native_task_create syscall.
>>>>> Yes, that was the problem.
>>>> What did you change? Can you explain the why to me?
>>> Because I guess iargs is no longer valid at this point. So, I saved the
>>> task pointer and reused it.
>>>
>> Sorry, makes no sense to me: *iargs is on the stack of the
>> rt_task_create caller, and that one is not expected to proceed until we
>> issue __xn_sys_barrier.
> 
> Well I am busy with the ARM FCSE now. Do you want my test case ?

Yes, hoping that it triggers on x86 as well. And is toolchain independent.

Jan


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

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

* Re: [Xenomai-core] Warning when compiling trunk.
  2008-10-20 21:34                     ` Jan Kiszka
@ 2008-10-20 21:35                       ` Gilles Chanteperdrix
  2008-10-20 22:41                         ` Jan Kiszka
  0 siblings, 1 reply; 20+ messages in thread
From: Gilles Chanteperdrix @ 2008-10-20 21:35 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: Xenomai core

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

Jan Kiszka wrote:
> Gilles Chanteperdrix wrote:
>> Well I am busy with the ARM FCSE now. Do you want my test case ?
> 
> Yes, hoping that it triggers on x86 as well. And is toolchain independent.



-- 
					    Gilles.

[-- Attachment #2: test_sigshadow.c --]
[-- Type: text/x-csrc, Size: 495 bytes --]

#include <stdio.h>

#include <sys/mman.h>
#include <pthread.h>

#include <native/task.h>

void relaxed_thread(void *cookie)
{
	rt_task_set_mode(T_PRIMARY, 0, NULL);
	for (;;)
		;
}

int main(void)
{
	struct sched_param p;
	RT_TASK tid;

	mlockall(MCL_CURRENT | MCL_FUTURE);
	
	p.sched_priority = 99;
	pthread_setschedparam(pthread_self(), SCHED_FIFO, &p);

	rt_task_spawn(&tid, "relax", 65536, 12, 0, relaxed_thread, NULL);
	sleep(1);

	rt_task_suspend(&tid);
	sleep(1);

	exit(EXIT_SUCCESS);
}

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

* Re: [Xenomai-core] Warning when compiling trunk.
  2008-10-20 21:35                       ` Gilles Chanteperdrix
@ 2008-10-20 22:41                         ` Jan Kiszka
  2008-10-20 22:48                           ` Gilles Chanteperdrix
  2008-10-20 23:18                           ` Gilles Chanteperdrix
  0 siblings, 2 replies; 20+ messages in thread
From: Jan Kiszka @ 2008-10-20 22:41 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: Xenomai core

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

Gilles Chanteperdrix wrote:
> Jan Kiszka wrote:
>> Gilles Chanteperdrix wrote:
>>> Well I am busy with the ARM FCSE now. Do you want my test case ?
>> Yes, hoping that it triggers on x86 as well. And is toolchain independent.
> 

It doesn't trigger. Can you reproduce on x86?

Jan


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

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

* Re: [Xenomai-core] Warning when compiling trunk.
  2008-10-20 22:41                         ` Jan Kiszka
@ 2008-10-20 22:48                           ` Gilles Chanteperdrix
  2008-10-20 23:18                           ` Gilles Chanteperdrix
  1 sibling, 0 replies; 20+ messages in thread
From: Gilles Chanteperdrix @ 2008-10-20 22:48 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: Xenomai core

Jan Kiszka wrote:
> Gilles Chanteperdrix wrote:
>> Jan Kiszka wrote:
>>> Gilles Chanteperdrix wrote:
>>>> Well I am busy with the ARM FCSE now. Do you want my test case ?
>>> Yes, hoping that it triggers on x86 as well. And is toolchain independent.
> 
> It doesn't trigger. Can you reproduce on x86?

I think it will trigger more easily on UP. Did you try on UP ?

-- 
					    Gilles.


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

* Re: [Xenomai-core] Warning when compiling trunk.
  2008-10-20 22:41                         ` Jan Kiszka
  2008-10-20 22:48                           ` Gilles Chanteperdrix
@ 2008-10-20 23:18                           ` Gilles Chanteperdrix
  2008-10-21  6:31                             ` Jan Kiszka
  1 sibling, 1 reply; 20+ messages in thread
From: Gilles Chanteperdrix @ 2008-10-20 23:18 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: Xenomai core

Jan Kiszka wrote:
> Gilles Chanteperdrix wrote:
>> Jan Kiszka wrote:
>>> Gilles Chanteperdrix wrote:
>>>> Well I am busy with the ARM FCSE now. Do you want my test case ?
>>> Yes, hoping that it triggers on x86 as well. And is toolchain independent.
> 
> It doesn't trigger. Can you reproduce on x86?

Beware, I just noticed that I commited my fix. I thought I had commited
only files where I made changes for SIGWINCH, but it happens that I had
also made changes for SIGWINCH in src/skins/native/task.c

-- 
					    Gilles.


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

* Re: [Xenomai-core] Warning when compiling trunk.
  2008-10-20 23:18                           ` Gilles Chanteperdrix
@ 2008-10-21  6:31                             ` Jan Kiszka
  0 siblings, 0 replies; 20+ messages in thread
From: Jan Kiszka @ 2008-10-21  6:31 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: Xenomai core

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

Gilles Chanteperdrix wrote:
> Jan Kiszka wrote:
>> Gilles Chanteperdrix wrote:
>>> Jan Kiszka wrote:
>>>> Gilles Chanteperdrix wrote:
>>>>> Well I am busy with the ARM FCSE now. Do you want my test case ?
>>>> Yes, hoping that it triggers on x86 as well. And is toolchain independent.
>> It doesn't trigger. Can you reproduce on x86?
> 
> Beware, I just noticed that I commited my fix. I thought I had commited
> only files where I made changes for SIGWINCH, but it happens that I had
> also made changes for SIGWINCH in src/skins/native/task.c

I ran my local version of yesterday afternoon, and I used UP - no
segfaults. This issue remains fishy. Even if there is a race, we need to
understand it first. And I'm still failing to see what races.

Jan


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

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

* Re: [Xenomai-core] Warning when compiling trunk.
  2008-10-20 21:30                 ` Jan Kiszka
  2008-10-20 21:32                   ` Gilles Chanteperdrix
@ 2008-10-21  7:36                   ` Philippe Gerum
  2008-10-21  8:24                     ` Jan Kiszka
  1 sibling, 1 reply; 20+ messages in thread
From: Philippe Gerum @ 2008-10-21  7:36 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: Xenomai core

Jan Kiszka wrote:
> Gilles Chanteperdrix wrote:
>> Jan Kiszka wrote:
>>> Gilles Chanteperdrix wrote:
>>>> Gilles Chanteperdrix wrote:
>>>>> Jan Kiszka wrote:
>>>>>> Gilles Chanteperdrix wrote:
>>>>>>> Gilles Chanteperdrix wrote:
>>>>>>>> Jan Kiszka wrote:
>>>>>>>>> Gilles Chanteperdrix wrote:
>>>>>>>>>> I get this warning when compiling trunk:
>>>>>>>>>>
>>>>>>>>>> checking for __thread... rm: cannot remove `conftest1.dir': Is a directory
>>>>>>>>>> yes
>>>>>>>>>>
>>>>>>>>> That simple, it's a typo in this line:
>>>>>>>>>
>>>>>>>>> http://www.rts.uni-hannover.de/xenomai/lxr/source/configure.in?v=SVN-trunk#394
>>>>>>>>>
>>>>>>>>> Also, that rm should be done outside the if block to play safe.
>>>>>>>> Ok. But once this is fixed, I get a segmentation fault with __thread on
>>>>>>>> ARM in rt_task_trampoline. I am currently testing the SIGWINCH thing,
>>>>>>>> and if __thread is disabled, there is no segfault.
>>>>>>> If a #ifdef 0 xeno_set_current, there is no segfault.
>>>>>>>
>>>>>> Interesting. What about removing the initial-exec attributes? Is
>>>>>> __thread otherwise know to work on your platform?
>>>>> Yes. This is a race condition, the real bug is, IMHO:
>>>>> 	__native_self = *iargs->task;
>>>>> When the segfault happens iargs->task is NULL. I suspect you are not
>>>>> supposed to use iargs after the __native_task_create syscall.
>>>> Yes, that was the problem.
>>> What did you change? Can you explain the why to me?
>> Because I guess iargs is no longer valid at this point. So, I saved the
>> task pointer and reused it.
>>
> 
> Sorry, makes no sense to me: *iargs is on the stack of the
> rt_task_create caller, and that one is not expected to proceed until we
> issue __xn_sys_barrier.
>

Gilles is right, the caller may vanish before your thread variable is assigned.
__sys_barrier is there to synchronize with rt_task_start(), not internally with
the task creator.

parent: rt_task_create
	-> child: rt_task_trampoline
		-> xnshadow_map
			-> wakeup_process(parent)
<parent stack unwinding>
	-> child: assignment from automatic data, oops.

You may want to track how the completion block is used.

> Jan
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Xenomai-core mailing list
> Xenomai-core@domain.hid
> https://mail.gna.org/listinfo/xenomai-core


-- 
Philippe.


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

* Re: [Xenomai-core] Warning when compiling trunk.
  2008-10-21  7:36                   ` Philippe Gerum
@ 2008-10-21  8:24                     ` Jan Kiszka
  0 siblings, 0 replies; 20+ messages in thread
From: Jan Kiszka @ 2008-10-21  8:24 UTC (permalink / raw)
  To: rpm; +Cc: Xenomai core

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

Philippe Gerum wrote:
> Jan Kiszka wrote:
>> Gilles Chanteperdrix wrote:
>>> Jan Kiszka wrote:
>>>> Gilles Chanteperdrix wrote:
>>>>> Gilles Chanteperdrix wrote:
>>>>>> Jan Kiszka wrote:
>>>>>>> Gilles Chanteperdrix wrote:
>>>>>>>> Gilles Chanteperdrix wrote:
>>>>>>>>> Jan Kiszka wrote:
>>>>>>>>>> Gilles Chanteperdrix wrote:
>>>>>>>>>>> I get this warning when compiling trunk:
>>>>>>>>>>>
>>>>>>>>>>> checking for __thread... rm: cannot remove `conftest1.dir': Is a directory
>>>>>>>>>>> yes
>>>>>>>>>>>
>>>>>>>>>> That simple, it's a typo in this line:
>>>>>>>>>>
>>>>>>>>>> http://www.rts.uni-hannover.de/xenomai/lxr/source/configure.in?v=SVN-trunk#394
>>>>>>>>>>
>>>>>>>>>> Also, that rm should be done outside the if block to play safe.
>>>>>>>>> Ok. But once this is fixed, I get a segmentation fault with __thread on
>>>>>>>>> ARM in rt_task_trampoline. I am currently testing the SIGWINCH thing,
>>>>>>>>> and if __thread is disabled, there is no segfault.
>>>>>>>> If a #ifdef 0 xeno_set_current, there is no segfault.
>>>>>>>>
>>>>>>> Interesting. What about removing the initial-exec attributes? Is
>>>>>>> __thread otherwise know to work on your platform?
>>>>>> Yes. This is a race condition, the real bug is, IMHO:
>>>>>> 	__native_self = *iargs->task;
>>>>>> When the segfault happens iargs->task is NULL. I suspect you are not
>>>>>> supposed to use iargs after the __native_task_create syscall.
>>>>> Yes, that was the problem.
>>>> What did you change? Can you explain the why to me?
>>> Because I guess iargs is no longer valid at this point. So, I saved the
>>> task pointer and reused it.
>>>
>> Sorry, makes no sense to me: *iargs is on the stack of the
>> rt_task_create caller, and that one is not expected to proceed until we
>> issue __xn_sys_barrier.
>>
> 
> Gilles is right, the caller may vanish before your thread variable is assigned.
> __sys_barrier is there to synchronize with rt_task_start(), not internally with
> the task creator.
> 
> parent: rt_task_create
> 	-> child: rt_task_trampoline
> 		-> xnshadow_map
> 			-> wakeup_process(parent)
> <parent stack unwinding>
> 	-> child: assignment from automatic data, oops.
> 
> You may want to track how the completion block is used.

Damn, signal_completion is already invoked by xnshadow_map - OK, now
this makes a lot of sense.

Just checked the rest, and I introduced the same issue to vxworks. Will fix.

Jan


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

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

end of thread, other threads:[~2008-10-21  8:24 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-20 19:30 [Xenomai-core] Warning when compiling trunk Gilles Chanteperdrix
2008-10-20 20:03 ` Jan Kiszka
2008-10-20 20:34   ` Gilles Chanteperdrix
2008-10-20 20:37     ` Gilles Chanteperdrix
2008-10-20 20:42       ` Jan Kiszka
2008-10-20 20:59         ` Gilles Chanteperdrix
2008-10-20 21:06           ` Gilles Chanteperdrix
2008-10-20 21:15             ` Jan Kiszka
2008-10-20 21:25               ` Gilles Chanteperdrix
2008-10-20 21:30                 ` Jan Kiszka
2008-10-20 21:32                   ` Gilles Chanteperdrix
2008-10-20 21:34                     ` Jan Kiszka
2008-10-20 21:35                       ` Gilles Chanteperdrix
2008-10-20 22:41                         ` Jan Kiszka
2008-10-20 22:48                           ` Gilles Chanteperdrix
2008-10-20 23:18                           ` Gilles Chanteperdrix
2008-10-21  6:31                             ` Jan Kiszka
2008-10-21  7:36                   ` Philippe Gerum
2008-10-21  8:24                     ` Jan Kiszka
2008-10-20 21:12           ` Jan Kiszka

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.