All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-core] Error when exiting pSOS-task with return
@ 2008-02-27 13:52 Markus Osterried
  2008-03-08 17:20 ` Philippe Gerum
  0 siblings, 1 reply; 4+ messages in thread
From: Markus Osterried @ 2008-02-27 13:52 UTC (permalink / raw)
  To: Xenomai-core

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

Hello,
 
with Xenomai 2.4 on Linux 2.6.18 on PowerPC I have seen the following
trace:
 
Feb 26 19:37:25 (none) user.err kernel: BUG: sleeping function called
from invalid context at kernel/rwsem.c:20
Feb 26 19:37:25 (none) user.warn kernel: in_atomic():0,
irqs_disabled():1
Feb 26 19:37:25 (none) user.warn kernel: Call Trace:
Feb 26 19:37:25 (none) user.warn kernel: [C19BFE50] [C000C114]
show_stack+0x58/0x188 (unreliable)
Feb 26 19:37:25 (none) user.warn kernel: [C19BFEA0] [C00128B0]
__might_sleep+0xdc/0xf0
Feb 26 19:37:25 (none) user.warn kernel: [C19BFEC0] [C0032304]
down_read+0x24/0x58
Feb 26 19:37:25 (none) user.warn kernel: [C19BFED0] [C00192C8]
exit_mm+0x34/0xec
Feb 26 19:37:25 (none) user.warn kernel: [C19BFEF0] [C001B000]
do_exit+0x21c/0x98c
Feb 26 19:37:25 (none) user.warn kernel: [C19BFF30] [C001B810]
complete_and_exit+0x0/0x28
Feb 26 19:37:25 (none) user.warn kernel: [C19BFF40] [C00041A0]
ret_from_syscall+0x0/0x38
 
 
This happens (sometimes) when a pSOS-task exits by returning from its
main function.
I have changed the return statement into t_delete(0) and there was no
error anymore, so this isn't a major issue.
 
But anyway I would like to know whether this is a xenomai bug or it
isn't allowed to exit a pSOS-task by returning from main function.
I have seen at end of psos_task_trampoline that there is a
pthread_exit() instead of a t_delete().
 
Thanks
Markus
 

[-- Attachment #2: Type: text/html, Size: 3903 bytes --]

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

* Re: [Xenomai-core] Error when exiting pSOS-task with return
  2008-02-27 13:52 [Xenomai-core] Error when exiting pSOS-task with return Markus Osterried
@ 2008-03-08 17:20 ` Philippe Gerum
  2008-03-19  8:27   ` Markus Osterried
  0 siblings, 1 reply; 4+ messages in thread
From: Philippe Gerum @ 2008-03-08 17:20 UTC (permalink / raw)
  To: Markus Osterried; +Cc: Xenomai-core

Markus Osterried wrote:
> Hello,
>  
> with Xenomai 2.4 on Linux 2.6.18 on PowerPC I have seen the following trace:
>  
> Feb 26 19:37:25 (none) user.err kernel: BUG: sleeping function called
> from invalid context at kernel/rwsem.c:20
> Feb 26 19:37:25 (none) user.warn kernel: in_atomic():0, irqs_disabled():1
> Feb 26 19:37:25 (none) user.warn kernel: Call Trace:
> Feb 26 19:37:25 (none) user.warn kernel: [C19BFE50] [C000C114]
> show_stack+0x58/0x188 (unreliable)
> Feb 26 19:37:25 (none) user.warn kernel: [C19BFEA0] [C00128B0]
> __might_sleep+0xdc/0xf0
> Feb 26 19:37:25 (none) user.warn kernel: [C19BFEC0] [C0032304]
> down_read+0x24/0x58
> Feb 26 19:37:25 (none) user.warn kernel: [C19BFED0] [C00192C8]
> exit_mm+0x34/0xec
> Feb 26 19:37:25 (none) user.warn kernel: [C19BFEF0] [C001B000]
> do_exit+0x21c/0x98c
> Feb 26 19:37:25 (none) user.warn kernel: [C19BFF30] [C001B810]
> complete_and_exit+0x0/0x28
> Feb 26 19:37:25 (none) user.warn kernel: [C19BFF40] [C00041A0]
> ret_from_syscall+0x0/0x38
>  
>  
> This happens (sometimes) when a pSOS-task exits by returning from its
> main function.
> I have changed the return statement into t_delete(0) and there was no
> error anymore, so this isn't a major issue.
>  
> But anyway I would like to know whether this is a xenomai bug or it
> isn't allowed to exit a pSOS-task by returning from main function.
> I have seen at end of psos_task_trampoline that there is a
> pthread_exit() instead of a t_delete().
>

It is allowed to exit the task body directly. Another possibility is a bug in
old Adeos/ppc patch for 2.6.18, that would trigger when the nucleus has to relax
the exiting thread. Anyway, this issue is queued for investigation here. Thanks.

PS: you may want to check whether forcing the task to secondary mode before
calling t_delete(0) does not cause the issue to trigger again.

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


-- 
Philippe.


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

* Re: [Xenomai-core] Error when exiting pSOS-task with return
  2008-03-08 17:20 ` Philippe Gerum
@ 2008-03-19  8:27   ` Markus Osterried
  2008-03-19 17:56     ` Philippe Gerum
  0 siblings, 1 reply; 4+ messages in thread
From: Markus Osterried @ 2008-03-19  8:27 UTC (permalink / raw)
  To: rpm; +Cc: Xenomai-core

Hello Philippe,

sorry for the delay, I was on holiday a few days.

> PS: you may want to check whether forcing the task to secondary mode before calling t_delete(0) does not cause the issue to trigger again.

When forcing the task to secondary mode before returning from main function, the issue is triggered.
When forcing the task to primary mode before returning from main function, there is no error.
When using t_delete(0) there is no error, regardless of primary or secondary mode.


Markus



-----Original Message-----
From: Philippe Gerum [mailto:philippe.gerum@domain.hid] On Behalf Of Philippe Gerum
Sent: Samstag, 8. März 2008 18:20
To: Markus Osterried
Cc: Xenomai-core@domain.hid
Subject: Re: [Xenomai-core] Error when exiting pSOS-task with return

Markus Osterried wrote:
> Hello,
>  
> with Xenomai 2.4 on Linux 2.6.18 on PowerPC I have seen the following trace:
>  
> Feb 26 19:37:25 (none) user.err kernel: BUG: sleeping function called 
> from invalid context at kernel/rwsem.c:20 Feb 26 19:37:25 (none) 
> user.warn kernel: in_atomic():0, irqs_disabled():1 Feb 26 19:37:25 
> (none) user.warn kernel: Call Trace:
> Feb 26 19:37:25 (none) user.warn kernel: [C19BFE50] [C000C114]
> show_stack+0x58/0x188 (unreliable)
> Feb 26 19:37:25 (none) user.warn kernel: [C19BFEA0] [C00128B0] 
> __might_sleep+0xdc/0xf0 Feb 26 19:37:25 (none) user.warn kernel: 
> [C19BFEC0] [C0032304]
> down_read+0x24/0x58
> Feb 26 19:37:25 (none) user.warn kernel: [C19BFED0] [C00192C8] 
> exit_mm+0x34/0xec Feb 26 19:37:25 (none) user.warn kernel: [C19BFEF0] 
> [C001B000] do_exit+0x21c/0x98c Feb 26 19:37:25 (none) user.warn 
> kernel: [C19BFF30] [C001B810]
> complete_and_exit+0x0/0x28
> Feb 26 19:37:25 (none) user.warn kernel: [C19BFF40] [C00041A0]
> ret_from_syscall+0x0/0x38
>  
>  
> This happens (sometimes) when a pSOS-task exits by returning from its 
> main function.
> I have changed the return statement into t_delete(0) and there was no 
> error anymore, so this isn't a major issue.
>  
> But anyway I would like to know whether this is a xenomai bug or it 
> isn't allowed to exit a pSOS-task by returning from main function.
> I have seen at end of psos_task_trampoline that there is a
> pthread_exit() instead of a t_delete().
>

It is allowed to exit the task body directly. Another possibility is a bug in old Adeos/ppc patch for 2.6.18, that would trigger when the nucleus has to relax the exiting thread. Anyway, this issue is queued for investigation here. Thanks.

PS: you may want to check whether forcing the task to secondary mode before calling t_delete(0) does not cause the issue to trigger again.

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


--
Philippe.


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

* Re: [Xenomai-core] Error when exiting pSOS-task with return
  2008-03-19  8:27   ` Markus Osterried
@ 2008-03-19 17:56     ` Philippe Gerum
  0 siblings, 0 replies; 4+ messages in thread
From: Philippe Gerum @ 2008-03-19 17:56 UTC (permalink / raw)
  To: Markus Osterried; +Cc: Xenomai-core

Markus Osterried wrote:
> Hello Philippe,
> 
> sorry for the delay, I was on holiday a few days.
> 
>> PS: you may want to check whether forcing the task to secondary mode before calling t_delete(0) does not cause the issue to trigger again.
> 
> When forcing the task to secondary mode before returning from main function, the issue is triggered.
> When forcing the task to primary mode before returning from main function, there is no error.
> When using t_delete(0) there is no error, regardless of primary or secondary mode.
>

Ok, that makes sense; this must be an issue with a termination process going
through to the standard exit syscall path. I will try to reproduce it. Thanks.

> 
> Markus
> 
> 
> 
> -----Original Message-----
> From: Philippe Gerum [mailto:philippe.gerum@domain.hid] On Behalf Of Philippe Gerum
> Sent: Samstag, 8. März 2008 18:20
> To: Markus Osterried
> Cc: Xenomai-core@domain.hid
> Subject: Re: [Xenomai-core] Error when exiting pSOS-task with return
> 
> Markus Osterried wrote:
>> Hello,
>>  
>> with Xenomai 2.4 on Linux 2.6.18 on PowerPC I have seen the following trace:
>>  
>> Feb 26 19:37:25 (none) user.err kernel: BUG: sleeping function called 
>> from invalid context at kernel/rwsem.c:20 Feb 26 19:37:25 (none) 
>> user.warn kernel: in_atomic():0, irqs_disabled():1 Feb 26 19:37:25 
>> (none) user.warn kernel: Call Trace:
>> Feb 26 19:37:25 (none) user.warn kernel: [C19BFE50] [C000C114]
>> show_stack+0x58/0x188 (unreliable)
>> Feb 26 19:37:25 (none) user.warn kernel: [C19BFEA0] [C00128B0] 
>> __might_sleep+0xdc/0xf0 Feb 26 19:37:25 (none) user.warn kernel: 
>> [C19BFEC0] [C0032304]
>> down_read+0x24/0x58
>> Feb 26 19:37:25 (none) user.warn kernel: [C19BFED0] [C00192C8] 
>> exit_mm+0x34/0xec Feb 26 19:37:25 (none) user.warn kernel: [C19BFEF0] 
>> [C001B000] do_exit+0x21c/0x98c Feb 26 19:37:25 (none) user.warn 
>> kernel: [C19BFF30] [C001B810]
>> complete_and_exit+0x0/0x28
>> Feb 26 19:37:25 (none) user.warn kernel: [C19BFF40] [C00041A0]
>> ret_from_syscall+0x0/0x38
>>  
>>  
>> This happens (sometimes) when a pSOS-task exits by returning from its 
>> main function.
>> I have changed the return statement into t_delete(0) and there was no 
>> error anymore, so this isn't a major issue.
>>  
>> But anyway I would like to know whether this is a xenomai bug or it 
>> isn't allowed to exit a pSOS-task by returning from main function.
>> I have seen at end of psos_task_trampoline that there is a
>> pthread_exit() instead of a t_delete().
>>
> 
> It is allowed to exit the task body directly. Another possibility is a bug in old Adeos/ppc patch for 2.6.18, that would trigger when the nucleus has to relax the exiting thread. Anyway, this issue is queued for investigation here. Thanks.
> 
> PS: you may want to check whether forcing the task to secondary mode before calling t_delete(0) does not cause the issue to trigger again.
> 
>> Thanks
>> Markus
>>  
>>
>>
>> ----------------------------------------------------------------------
>> --
>>
>> _______________________________________________
>> Xenomai-core mailing list
>> Xenomai-core@domain.hid
>> https://mail.gna.org/listinfo/xenomai-core
> 
> 
> --
> Philippe.
> 


-- 
Philippe.


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

end of thread, other threads:[~2008-03-19 17:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-27 13:52 [Xenomai-core] Error when exiting pSOS-task with return Markus Osterried
2008-03-08 17:20 ` Philippe Gerum
2008-03-19  8:27   ` Markus Osterried
2008-03-19 17:56     ` Philippe Gerum

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.