All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-help] pSOS+ simple example returns error code -14
@ 2010-09-19 15:04 ronny meeus
  2010-09-20  5:23 ` Philippe Gerum
  0 siblings, 1 reply; 5+ messages in thread
From: ronny meeus @ 2010-09-19 15:04 UTC (permalink / raw)
  To: xenomai

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

Hello

I'm using xenomai in a qemu setup.
My final goal is to use xenomai to port extisting pSOS application to the
linux platform.

The first step I did was building a kernel with the pSOS skin enabled. These
traces are generated at kernel startup:
[    0.212363] I-pipe: Domain Xenomai registered.
[    0.212363] Xenomai: hal/i386 started.
[    0.212363] Xenomai: scheduling class idle registered.
[    0.212363] Xenomai: scheduling class rt registered.
[    0.246987] Xenomai: real-time nucleus v2.5.4 (Sleep Walk) loaded.
[    0.246987] Xenomai: debug mode enabled.
[    0.274658] Xenomai: starting native API services.
[    0.274658] Xenomai: starting POSIX services.
[    0.296357] Xenomai: starting RTDM services.
[    0.296357] Xenomai: registered exported object RN#0 (regions)
[    0.296357] Xenomai: starting pSOS+ services.
[    0.305601] HugeTLB registered 4 MB page size, pre-allocated 0 pages

This is the example application:

#include <psos+/psos.h>

void task2_func(u_long a,u_long b,u_long c,u_long d)
{
        while (1) {
                tm_wkafter(1000);
        }
}

int main(int argc, char **argv)
{
        unsigned long tid;
        unsigned long args[4] = {0,0,0,0};

        t_create("TEST",10,160000,160000,0,&tid);
        t_start(tid,0,task2_func,args);
        while (1) {
                sleep(100);
        }
}

The command line used during compilation is:

/home/meeusr/repo/xenomai-configs/buildroot-output/staging/usr/bin/i686-unknown-linux-uclibc-gcc
-Os -pipe -Os -mtune=i686 -march=i686 -D_LARGEFILE_SOURCE
-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
-I/home/meeusr/repo/xenomai-configs/buildroot-output/staging/usr/include
-I/home/meeusr/repo/xenomai-configs/buildroot-output/staging/include
--sysroot=/home/meeusr/repo/xenomai-configs/buildroot-output/staging/
-isysroot /home/meeusr/repo/xenomai-configs/buildroot-output/staging
-I/home/meeusr/repo/xenomai-configs/buildroot-output/target/usr/xenomai/include
-D_GNU_SOURCE -D_REENTRANT -Wall -pipe -D__XENO__
-I/home/meeusr/repo/xenomai-configs/buildroot-output/target/usr/xenomai/include/psos+
rtprint.c -lpsos
-L/home/meeusr/repo/xenomai-configs/buildroot-output/target/usr/xenomai/lib
-lxenomai -lpthread  -lpsos -Xlinker -rpath -Xlinker
/home/meeusr/repo/xenomai-configs/buildroot-output/target/usr/xenomai/lib
-lrtdk -o rtprint_ronny


When I try to run the application I get (first time):
# ./rtprint_ronny
Xenomai pSOS skin init: t_shadow() failed, status -14#
#

The second time I get
# ./rtprint_ronny
[  145.049826] Xenomai: FAILED to register object MAIN (unknown type),
status -17
Xenomai pSOS skin init: t_shadow() failed, status -17#
#

I already read somewhere that the -14 and -17 error codes (negative values)
indicate that there is a problem in the nucleus
Can somebody tell me what I do wrong?

Best regards,
Ronny

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

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

* Re: [Xenomai-help] pSOS+ simple example returns error code -14
  2010-09-19 15:04 [Xenomai-help] pSOS+ simple example returns error code -14 ronny meeus
@ 2010-09-20  5:23 ` Philippe Gerum
  2010-09-20  7:42   ` Gilles Chanteperdrix
  0 siblings, 1 reply; 5+ messages in thread
From: Philippe Gerum @ 2010-09-20  5:23 UTC (permalink / raw)
  To: ronny meeus; +Cc: xenomai

On Sun, 2010-09-19 at 16:04 +0100, ronny meeus wrote:
> Hello
> 
> I'm using xenomai in a qemu setup.
> My final goal is to use xenomai to port extisting pSOS application to
> the linux platform.
> 
> The first step I did was building a kernel with the pSOS skin enabled.
> These traces are generated at kernel startup:
> [    0.212363] I-pipe: Domain Xenomai registered.
> [    0.212363] Xenomai: hal/i386 started.
> [    0.212363] Xenomai: scheduling class idle registered.
> [    0.212363] Xenomai: scheduling class rt registered.
> [    0.246987] Xenomai: real-time nucleus v2.5.4 (Sleep Walk) loaded.
> [    0.246987] Xenomai: debug mode enabled.
> [    0.274658] Xenomai: starting native API services.
> [    0.274658] Xenomai: starting POSIX services.
> [    0.296357] Xenomai: starting RTDM services.
> [    0.296357] Xenomai: registered exported object RN#0 (regions)
> [    0.296357] Xenomai: starting pSOS+ services.
> [    0.305601] HugeTLB registered 4 MB page size, pre-allocated 0
> pages
> 
> This is the example application:
> 
> #include <psos+/psos.h>
> 
> void task2_func(u_long a,u_long b,u_long c,u_long d)
> {
>         while (1) {
>                 tm_wkafter(1000);
>         }
> }
> 
> int main(int argc, char **argv)
> {
>         unsigned long tid;
>         unsigned long args[4] = {0,0,0,0};
> 
>         t_create("TEST",10,160000,160000,0,&tid);
>         t_start(tid,0,task2_func,args);
>         while (1) {
>                 sleep(100);
>         }
> }

I'm unsure whether the code above is actually the one which issues the
output mentioned below. I see no t_shadow call, and no status printout
there.

> 
> The command line used during compilation is:
> 
> /home/meeusr/repo/xenomai-configs/buildroot-output/staging/usr/bin/i686-unknown-linux-uclibc-gcc -Os -pipe -Os -mtune=i686 -march=i686 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -I/home/meeusr/repo/xenomai-configs/buildroot-output/staging/usr/include -I/home/meeusr/repo/xenomai-configs/buildroot-output/staging/include --sysroot=/home/meeusr/repo/xenomai-configs/buildroot-output/staging/ -isysroot /home/meeusr/repo/xenomai-configs/buildroot-output/staging -I/home/meeusr/repo/xenomai-configs/buildroot-output/target/usr/xenomai/include -D_GNU_SOURCE -D_REENTRANT -Wall -pipe -D__XENO__ -I/home/meeusr/repo/xenomai-configs/buildroot-output/target/usr/xenomai/include/psos+  rtprint.c -lpsos -L/home/meeusr/repo/xenomai-configs/buildroot-output/target/usr/xenomai/lib -lxenomai -lpthread  -lpsos -Xlinker -rpath -Xlinker /home/meeusr/repo/xenomai-configs/buildroot-output/target/usr/xenomai/lib -lrtdk -o rtprint_ronny
> 
> 
> When I try to run the application I get (first time):
> # ./rtprint_ronny
> Xenomai pSOS skin init: t_shadow() failed, status -14# 
> #

Assuming your code does call t_shadow, the behavior you see is caused by
a regression in the pSOS skin. Please apply:
http://git.xenomai.org/?p=xenomai-rpm.git;a=commit;h=55c1b958c6bd11068cacb6258c7a957ab581ce73

> 
> The second time I get
> # ./rtprint_ronny
> [  145.049826] Xenomai: FAILED to register object MAIN (unknown type),
> status -17
> Xenomai pSOS skin init: t_shadow() failed, status -17# 
> # 

This was a consequence of the previous bug; the shadowing call would
raise a fault causing the calling task to die, but the cleanup code
could not run as expected, leaving a stale "MAIN" task entry in the
internal registry. This would in turn cause -EEXIST to be sent for any
attempt to create a "MAIN"-labeled task again. The patch mentioned above
should prevent this situation to occur.

> 
> I already read somewhere that the -14 and -17 error codes (negative
> values) indicate that there is a problem in the nucleus 
> Can somebody tell me what I do wrong? 

Nothing. The pSOS emulator code was wrong.

> 
> Best regards,
> Ronny
> _______________________________________________
> Xenomai-help mailing list
> Xenomai-help@domain.hid
> https://mail.gna.org/listinfo/xenomai-help

-- 
Philippe.




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

* Re: [Xenomai-help] pSOS+ simple example returns error code -14
  2010-09-20  5:23 ` Philippe Gerum
@ 2010-09-20  7:42   ` Gilles Chanteperdrix
  2010-09-20  7:54     ` Philippe Gerum
  0 siblings, 1 reply; 5+ messages in thread
From: Gilles Chanteperdrix @ 2010-09-20  7:42 UTC (permalink / raw)
  To: Philippe Gerum; +Cc: xenomai

Philippe Gerum wrote:
> On Sun, 2010-09-19 at 16:04 +0100, ronny meeus wrote:
>> Hello
>>
>> I'm using xenomai in a qemu setup.
>> My final goal is to use xenomai to port extisting pSOS application to
>> the linux platform.
>>
>> The first step I did was building a kernel with the pSOS skin enabled.
>> These traces are generated at kernel startup:
>> [    0.212363] I-pipe: Domain Xenomai registered.
>> [    0.212363] Xenomai: hal/i386 started.
>> [    0.212363] Xenomai: scheduling class idle registered.
>> [    0.212363] Xenomai: scheduling class rt registered.
>> [    0.246987] Xenomai: real-time nucleus v2.5.4 (Sleep Walk) loaded.
>> [    0.246987] Xenomai: debug mode enabled.
>> [    0.274658] Xenomai: starting native API services.
>> [    0.274658] Xenomai: starting POSIX services.
>> [    0.296357] Xenomai: starting RTDM services.
>> [    0.296357] Xenomai: registered exported object RN#0 (regions)
>> [    0.296357] Xenomai: starting pSOS+ services.
>> [    0.305601] HugeTLB registered 4 MB page size, pre-allocated 0
>> pages
>>
>> This is the example application:
>>
>> #include <psos+/psos.h>
>>
>> void task2_func(u_long a,u_long b,u_long c,u_long d)
>> {
>>         while (1) {
>>                 tm_wkafter(1000);
>>         }
>> }
>>
>> int main(int argc, char **argv)
>> {
>>         unsigned long tid;
>>         unsigned long args[4] = {0,0,0,0};
>>
>>         t_create("TEST",10,160000,160000,0,&tid);
>>         t_start(tid,0,task2_func,args);
>>         while (1) {
>>                 sleep(100);
>>         }
>> }
> 
> I'm unsure whether the code above is actually the one which issues the
> output mentioned below. I see no t_shadow call, and no status printout
> there.

Maybe the auto-shadowing of the main thread?

-- 
                                                                Gilles.


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

* Re: [Xenomai-help] pSOS+ simple example returns error code -14
  2010-09-20  7:42   ` Gilles Chanteperdrix
@ 2010-09-20  7:54     ` Philippe Gerum
  2010-09-20 18:46       ` ronny meeus
  0 siblings, 1 reply; 5+ messages in thread
From: Philippe Gerum @ 2010-09-20  7:54 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: xenomai

On Mon, 2010-09-20 at 09:42 +0200, Gilles Chanteperdrix wrote:
> Philippe Gerum wrote:
> > On Sun, 2010-09-19 at 16:04 +0100, ronny meeus wrote:
> >> Hello
> >>
> >> I'm using xenomai in a qemu setup.
> >> My final goal is to use xenomai to port extisting pSOS application to
> >> the linux platform.
> >>
> >> The first step I did was building a kernel with the pSOS skin enabled.
> >> These traces are generated at kernel startup:
> >> [    0.212363] I-pipe: Domain Xenomai registered.
> >> [    0.212363] Xenomai: hal/i386 started.
> >> [    0.212363] Xenomai: scheduling class idle registered.
> >> [    0.212363] Xenomai: scheduling class rt registered.
> >> [    0.246987] Xenomai: real-time nucleus v2.5.4 (Sleep Walk) loaded.
> >> [    0.246987] Xenomai: debug mode enabled.
> >> [    0.274658] Xenomai: starting native API services.
> >> [    0.274658] Xenomai: starting POSIX services.
> >> [    0.296357] Xenomai: starting RTDM services.
> >> [    0.296357] Xenomai: registered exported object RN#0 (regions)
> >> [    0.296357] Xenomai: starting pSOS+ services.
> >> [    0.305601] HugeTLB registered 4 MB page size, pre-allocated 0
> >> pages
> >>
> >> This is the example application:
> >>
> >> #include <psos+/psos.h>
> >>
> >> void task2_func(u_long a,u_long b,u_long c,u_long d)
> >> {
> >>         while (1) {
> >>                 tm_wkafter(1000);
> >>         }
> >> }
> >>
> >> int main(int argc, char **argv)
> >> {
> >>         unsigned long tid;
> >>         unsigned long args[4] = {0,0,0,0};
> >>
> >>         t_create("TEST",10,160000,160000,0,&tid);
> >>         t_start(tid,0,task2_func,args);
> >>         while (1) {
> >>                 sleep(100);
> >>         }
> >> }
> > 
> > I'm unsure whether the code above is actually the one which issues the
> > output mentioned below. I see no t_shadow call, and no status printout
> > there.
> 
> Maybe the auto-shadowing of the main thread?
> 

Correct. I did not recall we had auto-shadowing in place for pSOS
actually.

-- 
Philippe.




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

* Re: [Xenomai-help] pSOS+ simple example returns error code -14
  2010-09-20  7:54     ` Philippe Gerum
@ 2010-09-20 18:46       ` ronny meeus
  0 siblings, 0 replies; 5+ messages in thread
From: ronny meeus @ 2010-09-20 18:46 UTC (permalink / raw)
  To: xenomai

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

After applying the patch the problem is resolved.
Thank you very much for the quick support.

Best regards,
Ronny

On Mon, Sep 20, 2010 at 9:54 AM, Philippe Gerum <rpm@xenomai.org> wrote:

> On Mon, 2010-09-20 at 09:42 +0200, Gilles Chanteperdrix wrote:
> > Philippe Gerum wrote:
> > > On Sun, 2010-09-19 at 16:04 +0100, ronny meeus wrote:
> > >> Hello
> > >>
> > >> I'm using xenomai in a qemu setup.
> > >> My final goal is to use xenomai to port extisting pSOS application to
> > >> the linux platform.
> > >>
> > >> The first step I did was building a kernel with the pSOS skin enabled.
> > >> These traces are generated at kernel startup:
> > >> [    0.212363] I-pipe: Domain Xenomai registered.
> > >> [    0.212363] Xenomai: hal/i386 started.
> > >> [    0.212363] Xenomai: scheduling class idle registered.
> > >> [    0.212363] Xenomai: scheduling class rt registered.
> > >> [    0.246987] Xenomai: real-time nucleus v2.5.4 (Sleep Walk) loaded.
> > >> [    0.246987] Xenomai: debug mode enabled.
> > >> [    0.274658] Xenomai: starting native API services.
> > >> [    0.274658] Xenomai: starting POSIX services.
> > >> [    0.296357] Xenomai: starting RTDM services.
> > >> [    0.296357] Xenomai: registered exported object RN#0 (regions)
> > >> [    0.296357] Xenomai: starting pSOS+ services.
> > >> [    0.305601] HugeTLB registered 4 MB page size, pre-allocated 0
> > >> pages
> > >>
> > >> This is the example application:
> > >>
> > >> #include <psos+/psos.h>
> > >>
> > >> void task2_func(u_long a,u_long b,u_long c,u_long d)
> > >> {
> > >>         while (1) {
> > >>                 tm_wkafter(1000);
> > >>         }
> > >> }
> > >>
> > >> int main(int argc, char **argv)
> > >> {
> > >>         unsigned long tid;
> > >>         unsigned long args[4] = {0,0,0,0};
> > >>
> > >>         t_create("TEST",10,160000,160000,0,&tid);
> > >>         t_start(tid,0,task2_func,args);
> > >>         while (1) {
> > >>                 sleep(100);
> > >>         }
> > >> }
> > >
> > > I'm unsure whether the code above is actually the one which issues the
> > > output mentioned below. I see no t_shadow call, and no status printout
> > > there.
> >
> > Maybe the auto-shadowing of the main thread?
> >
>
> Correct. I did not recall we had auto-shadowing in place for pSOS
> actually.
>
> --
> Philippe.
>
>
>

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

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

end of thread, other threads:[~2010-09-20 18:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-19 15:04 [Xenomai-help] pSOS+ simple example returns error code -14 ronny meeus
2010-09-20  5:23 ` Philippe Gerum
2010-09-20  7:42   ` Gilles Chanteperdrix
2010-09-20  7:54     ` Philippe Gerum
2010-09-20 18:46       ` ronny meeus

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.