All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-help] Make error
@ 2007-02-12  5:24 Preetam Joshi
  2007-02-12  7:20 ` Markus Franke
  2007-02-12  8:47 ` Jan Kiszka
  0 siblings, 2 replies; 20+ messages in thread
From: Preetam Joshi @ 2007-02-12  5:24 UTC (permalink / raw)
  To: xenomai

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

Hi all,

I am using xenomai with linux kernel 2.6.19 and have applied the patch
successfully. I have created my own examples in the native section under
xenomai-2.3.0/examples/native and am tryuing to run the makefile in it.

But i get the error as /usr/bin/ld: cannot find -lnative
collect2: ld returned 1 exit status

How do i resolve this error.

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

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

* Re: [Xenomai-help] Make error
  2007-02-12  5:24 [Xenomai-help] Make error Preetam Joshi
@ 2007-02-12  7:20 ` Markus Franke
  2007-02-12  8:47 ` Jan Kiszka
  1 sibling, 0 replies; 20+ messages in thread
From: Markus Franke @ 2007-02-12  7:20 UTC (permalink / raw)
  To: xenomai

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

Preetam Joshi wrote:
> But i get the error as /usr/bin/ld: cannot find -lnative
> collect2: ld returned 1 exit status
> 
> How do i resolve this error.

You should maybe add something like "-L<PATH_TO_XENOMAI>/lib" to your
LDFLAGS in the Makefile. The problem is that "libnative.a" is not found
during linking process.

Regards,
Markus


[-- Attachment #2: Markus.Franke.vcf --]
[-- Type: text/x-vcard, Size: 245 bytes --]

begin:vcard
fn:Markus Franke
n:Franke;Markus
adr;quoted-printable:;;Vettersstra=C3=9Fe 64/722;Chemnitz;Saxony;09126;Germany
email;internet:Markus.Franke@domain.hid
x-mozilla-html:FALSE
url:http://www.tu-chemnitz.de/~franm
version:2.1
end:vcard


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

* Re: [Xenomai-help] Make error
  2007-02-12  5:24 [Xenomai-help] Make error Preetam Joshi
  2007-02-12  7:20 ` Markus Franke
@ 2007-02-12  8:47 ` Jan Kiszka
       [not found]   ` <e45fe62b0702120448i7b23bd24o4fa88a05237a69a@domain.hid>
  1 sibling, 1 reply; 20+ messages in thread
From: Jan Kiszka @ 2007-02-12  8:47 UTC (permalink / raw)
  To: Preetam Joshi; +Cc: xenomai

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

Preetam Joshi wrote:
> Hi all,
> 
> I am using xenomai with linux kernel 2.6.19 and have applied the patch
> successfully. I have created my own examples in the native section under
> xenomai-2.3.0/examples/native and am tryuing to run the makefile in it.
> 
> But i get the error as /usr/bin/ld: cannot find -lnative
> collect2: ld returned 1 exit status
> 
> How do i resolve this error.
> 

The example Makefiles from the SVN repository can provide the required
compiler/linker flags, you just need to pass the Xenomai user space
installation path (make XENO=<path-to-xenomai>).

Jan


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

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

* Re: [Xenomai-help] Make error
       [not found]   ` <e45fe62b0702120448i7b23bd24o4fa88a05237a69a@domain.hid>
@ 2007-02-12 13:06     ` Jan Kiszka
  2007-02-13  7:19       ` Preetam Joshi
  0 siblings, 1 reply; 20+ messages in thread
From: Jan Kiszka @ 2007-02-12 13:06 UTC (permalink / raw)
  To: Preetam Joshi; +Cc: xenomai-help

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

Preetam Joshi wrote:
> hi,

Please keep the CC when replying (reply-to-all).

> 
> Itried adding the options as shown in the example latency in the SVN
> repository but the latency example as well as my example both gve the same
> error stating
> 
> make: *** No rule to make target `../../skins/native/libnative.la', needed
> by `latency'.  Stop.
> make: *** No rule to make target `../../skins/native/libnative.la', needed
> by `mytask'.  Stop.
> 

You are doing something wrong. Does the user space part build AND
install cleanly? If yes, check out the examples repository next:

svn co svn://svn.gna.org/svn/xenomai/branches/v2.3.x/examples

Then try to build the native examples:

# cd examples/native
# make XENO=<path-to-xenomai-installation>

This should work out-of-the-box. You can then add your own example here,
only extending APPLICATIONS in examples/native/Makefile.

Jan


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

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

* Re: [Xenomai-help] Make error
  2007-02-12 13:06     ` Jan Kiszka
@ 2007-02-13  7:19       ` Preetam Joshi
  2007-02-13  8:08         ` Jan Kiszka
  2007-02-13  9:00         ` Gilles Chanteperdrix
  0 siblings, 2 replies; 20+ messages in thread
From: Preetam Joshi @ 2007-02-13  7:19 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: xenomai-help

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

Hi the libnative error is solved but know when i make it gives me error
stating:

Makefile:312: .deps/mytask-mytask.Po: No such file or directory
make: *** No rule to make target `.deps/mytask-mytask.Po'.  Stop.


On 2/12/07, Jan Kiszka <jan.kiszka@domain.hid> wrote:
>
> Preetam Joshi wrote:
> > hi,
>
> Please keep the CC when replying (reply-to-all).
>
> >
> > Itried adding the options as shown in the example latency in the SVN
> > repository but the latency example as well as my example both gve the
> same
> > error stating
> >
> > make: *** No rule to make target `../../skins/native/libnative.la',
> needed
> > by `latency'.  Stop.
> > make: *** No rule to make target `../../skins/native/libnative.la',
> needed
> > by `mytask'.  Stop.
> >
>
> You are doing something wrong. Does the user space part build AND
> install cleanly? If yes, check out the examples repository next:
>
> svn co svn://svn.gna.org/svn/xenomai/branches/v2.3.x/examples
>
> Then try to build the native examples:
>
> # cd examples/native
> # make XENO=<path-to-xenomai-installation>
>
> This should work out-of-the-box. You can then add your own example here,
> only extending APPLICATIONS in examples/native/Makefile.
>
> Jan
>
>
>

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

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

* Re: [Xenomai-help] Make error
  2007-02-13  7:19       ` Preetam Joshi
@ 2007-02-13  8:08         ` Jan Kiszka
       [not found]           ` <e45fe62b0702130021i5ec6c345m699a9abcc2e665c0@domain.hid>
  2007-02-13  9:00         ` Gilles Chanteperdrix
  1 sibling, 1 reply; 20+ messages in thread
From: Jan Kiszka @ 2007-02-13  8:08 UTC (permalink / raw)
  To: Preetam Joshi; +Cc: xenomai-help

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

Preetam Joshi wrote:
> Hi the libnative error is solved but know when i make it gives me error
> stating:
> 
> Makefile:312: .deps/mytask-mytask.Po: No such file or directory
> make: *** No rule to make target `.deps/mytask-mytask.Po'.  Stop.
> 

Using which makefile? Those under examples/ are far shorter than 312
lines...

> 
> On 2/12/07, Jan Kiszka <jan.kiszka@domain.hid> wrote:
>>
>> Preetam Joshi wrote:
>> > hi,
>>
>> Please keep the CC when replying (reply-to-all).
>>
>> >
>> > Itried adding the options as shown in the example latency in the SVN
>> > repository but the latency example as well as my example both gve the
>> same
>> > error stating
>> >
>> > make: *** No rule to make target `../../skins/native/libnative.la',
>> needed
>> > by `latency'.  Stop.
>> > make: *** No rule to make target `../../skins/native/libnative.la',
>> needed
>> > by `mytask'.  Stop.
>> >
>>
>> You are doing something wrong. Does the user space part build AND
>> install cleanly? If yes, check out the examples repository next:
>>
>> svn co svn://svn.gna.org/svn/xenomai/branches/v2.3.x/examples
>>
>> Then try to build the native examples:
>>
>> # cd examples/native
>> # make XENO=<path-to-xenomai-installation>
>>
>> This should work out-of-the-box. You can then add your own example here,
>> only extending APPLICATIONS in examples/native/Makefile.
>>
>> Jan
>>
>>
>>
> 



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

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

* Re: [Xenomai-help] Make error
  2007-02-13  7:19       ` Preetam Joshi
  2007-02-13  8:08         ` Jan Kiszka
@ 2007-02-13  9:00         ` Gilles Chanteperdrix
  1 sibling, 0 replies; 20+ messages in thread
From: Gilles Chanteperdrix @ 2007-02-13  9:00 UTC (permalink / raw)
  To: Preetam Joshi; +Cc: xenomai-help, Jan Kiszka

Preetam Joshi wrote:
> Hi the libnative error is solved but know when i make it gives me error
> stating:
> 
> Makefile:312: .deps/mytask-mytask.Po: No such file or directory
> make: *** No rule to make target `.deps/mytask-mytask.Po'.  Stop.

This should only happen if you have played with the autotools. Go to the
top of the build tree and type :

./config.status depfiles

-- 
                                                 Gilles Chanteperdrix


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

* Re: [Xenomai-help] Make error
       [not found]           ` <e45fe62b0702130021i5ec6c345m699a9abcc2e665c0@domain.hid>
@ 2007-02-13 10:28             ` Jan Kiszka
  2007-02-14  5:57               ` Preetam Joshi
  0 siblings, 1 reply; 20+ messages in thread
From: Jan Kiszka @ 2007-02-13 10:28 UTC (permalink / raw)
  To: Preetam Joshi; +Cc: Xenomai-help

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

Preetam Joshi wrote:
> I have taken the makefile from
> 
> Using the one under test suite /xenomai/src/testsuite/switchbench/
> 
> n modified for mytask jus replaced all the witchbench related statements
> with mytask
> 
> It works for switchbench or latency or switchsuite but not for my example.

Unless you are planning to write an extension of the Xenomai user space
part, you don't need to make your life that hard. Just follow my
suggestions and use the makefiles from the examples repos.

Jan

PS: The CC, take care of it...


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

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

* Re: [Xenomai-help] Make error
  2007-02-13 10:28             ` Jan Kiszka
@ 2007-02-14  5:57               ` Preetam Joshi
  2007-02-14  8:53                 ` Jan Kiszka
  0 siblings, 1 reply; 20+ messages in thread
From: Preetam Joshi @ 2007-02-14  5:57 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: Xenomai-help

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

Hi ,

Its working now .

But how do i set a scheduling policy say FIFO for a real time task . ?

On 2/13/07, Jan Kiszka <jan.kiszka@domain.hid> wrote:
>
> Preetam Joshi wrote:
> > I have taken the makefile from
> >
> > Using the one under test suite /xenomai/src/testsuite/switchbench/
> >
> > n modified for mytask jus replaced all the witchbench related statements
> > with mytask
> >
> > It works for switchbench or latency or switchsuite but not for my
> example.
>
> Unless you are planning to write an extension of the Xenomai user space
> part, you don't need to make your life that hard. Just follow my
> suggestions and use the makefiles from the examples repos.
>
> Jan
>
> PS: The CC, take care of it...
>
>
>

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

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

* Re: [Xenomai-help] Make error
  2007-02-14  5:57               ` Preetam Joshi
@ 2007-02-14  8:53                 ` Jan Kiszka
  2007-02-15  7:19                   ` Preetam Joshi
  0 siblings, 1 reply; 20+ messages in thread
From: Jan Kiszka @ 2007-02-14  8:53 UTC (permalink / raw)
  To: Preetam Joshi; +Cc: Xenomai-help

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

Preetam Joshi wrote:
> Hi ,
> 
> Its working now .
> 
> But how do i set a scheduling policy say FIFO for a real time task . ?

Depends on the skin you use. Please have a look at the available API
documentation regarding how to set priorities or scheduling policies.

Jan


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

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

* Re: [Xenomai-help] Make error
  2007-02-14  8:53                 ` Jan Kiszka
@ 2007-02-15  7:19                   ` Preetam Joshi
  2007-02-15  9:03                     ` Jan Kiszka
  0 siblings, 1 reply; 20+ messages in thread
From: Preetam Joshi @ 2007-02-15  7:19 UTC (permalink / raw)
  To: jan.kiszka; +Cc: Xenomai-help

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

Hi,

Do u mean to say that if i have created my tasks using native xenomai API's
like rt_task_create , then inside those tasks i will have to use posix skin
calls like pthread_setschedpolicy, etc...?

Is that so.

Cant i just have context switch between the tasks themselves say low
priority and a high priority task created by rt_task_create.

Reason being i have created two tasks using the rt_task_create API and my
high priority task is runnning and my low priority task has slept, so as
soon as my low priority task has expired its sleep time and gets ready to
run,

The low priority task preempts my high priority task and even its priority
gets raised to that of the high priority task and starts executing. The
higgh priority task gets suspended altogether amidst its running. Simply
baffled by the behavior?

On 2/14/07, Jan Kiszka <jan.kiszka@domain.hid> wrote:
>
> Preetam Joshi wrote:
> > Hi ,
> >
> > Its working now .
> >
> > But how do i set a scheduling policy say FIFO for a real time task . ?
>
> Depends on the skin you use. Please have a look at the available API
> documentation regarding how to set priorities or scheduling policies.
>
> Jan
>
>
>

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

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

* Re: [Xenomai-help] Make error
  2007-02-15  7:19                   ` Preetam Joshi
@ 2007-02-15  9:03                     ` Jan Kiszka
  2007-02-15  9:58                       ` Preetam Joshi
  0 siblings, 1 reply; 20+ messages in thread
From: Jan Kiszka @ 2007-02-15  9:03 UTC (permalink / raw)
  To: Preetam Joshi; +Cc: Xenomai-help

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

Preetam Joshi wrote:
> Hi,
> 
> Do u mean to say that if i have created my tasks using native xenomai API's
> like rt_task_create , then inside those tasks i will have to use posix skin
> calls like pthread_setschedpolicy, etc...?
> 
> Is that so.

Nope. If you picked the native skin API, all scheduler setup for a RT
task should be done through that interface.

> 
> Cant i just have context switch between the tasks themselves say low
> priority and a high priority task created by rt_task_create.
> 
> Reason being i have created two tasks using the rt_task_create API and my
> high priority task is runnning and my low priority task has slept, so as
> soon as my low priority task has expired its sleep time and gets ready to
> run,
> 
> The low priority task preempts my high priority task and even its priority
> gets raised to that of the high priority task and starts executing. The
> higgh priority task gets suspended altogether amidst its running. Simply
> baffled by the behavior?

If you have found a weird behaviour of Xenomai, please post some
as-small-as-possible demo code that exposes the issue. We will have a
look at it.

Jan


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

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

* Re: [Xenomai-help] Make error
  2007-02-15  9:03                     ` Jan Kiszka
@ 2007-02-15  9:58                       ` Preetam Joshi
  2007-02-15 10:11                         ` Anders Blomdell
  0 siblings, 1 reply; 20+ messages in thread
From: Preetam Joshi @ 2007-02-15  9:58 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: Xenomai-help

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

ok,

here is the code.
The code essentially cerates two tasks low and high priority task.
The low priority task has priority as 3 and high as 98

When i execute this initally everything goes smoothly as low priority task
starts running with priority thread 3 , it sleeps so then the high priority
thread runs with priority 98. But before the high priority thread finishes
the for loop for 7 times the low priority thread prempts it and starts
running with priority = 98.

This is what has baffled me?

#include <stdio.h>
#include <unistd.h>
#include <sys/mman.h>
#include <native/task.h>
#include <native/timer.h>

RT_TASK task1;
RT_TASK task2;
RT_TASK_INFO info;

void low_task(void *arg)
{
        rt_task_inquire(&task1, &info);
        printf("Priority of low task %d\n", info.cprio);

        rt_task_sleep(3000000000);

       while(1)
        {
                printf("Priority of Low task %d\n",info.cprio);
        }

}

void high_task(void *arg)
{
        unsigned int i;
        rt_task_inquire(&task2, &info);
        printf("Priority of high task before sleep %d\n", info.cprio);
        for(i=0;i<7;i++)
        {

                printf("Priority of High Priotity task1 %d\n",info.cprio);
                rt_task_sleep(1000000000);
        }

        printf("High priority thread goin to sleep %d\n",info.cprio);
        rt_task_sleep(3000000000);

        for(i=0;i<100;i++)
        {
                printf("Priority of High task2 %d\n",info.cprio);
        }

       int main(int argc, char* argv[])
{
        mlockall(MCL_CURRENT|MCL_FUTURE);

        rt_task_create(&task1, "Low Priority Task", 0, 3, 0);
        rt_task_create(&task2, "High Priority Task", 0, 98, 0);

        rt_task_start(&task1, &low_task, NULL);
        rt_task_start(&task2, &high_task, NULL);

        pause();

        rt_task_join(&task1);
        rt_task_join(&task2);

}













On 2/15/07, Jan Kiszka <jan.kiszka@domain.hid> wrote:
>
> Preetam Joshi wrote:
> > Hi,
> >
> > Do u mean to say that if i have created my tasks using native xenomai
> API's
> > like rt_task_create , then inside those tasks i will have to use posix
> skin
> > calls like pthread_setschedpolicy, etc...?
> >
> > Is that so.
>
> Nope. If you picked the native skin API, all scheduler setup for a RT
> task should be done through that interface.
>
> >
> > Cant i just have context switch between the tasks themselves say low
> > priority and a high priority task created by rt_task_create.
> >
> > Reason being i have created two tasks using the rt_task_create API and
> my
> > high priority task is runnning and my low priority task has slept, so as
> > soon as my low priority task has expired its sleep time and gets ready
> to
> > run,
> >
> > The low priority task preempts my high priority task and even its
> priority
> > gets raised to that of the high priority task and starts executing. The
> > higgh priority task gets suspended altogether amidst its running. Simply
> > baffled by the behavior?
>
> If you have found a weird behaviour of Xenomai, please post some
> as-small-as-possible demo code that exposes the issue. We will have a
> look at it.
>
> Jan
>
>
>

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

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

* Re: [Xenomai-help] Make error
  2007-02-15  9:58                       ` Preetam Joshi
@ 2007-02-15 10:11                         ` Anders Blomdell
  2007-02-15 10:16                           ` Preetam Joshi
  2007-02-15 10:17                           ` Jan Kiszka
  0 siblings, 2 replies; 20+ messages in thread
From: Anders Blomdell @ 2007-02-15 10:11 UTC (permalink / raw)
  To: Preetam Joshi; +Cc: Xenomai-help, Jan Kiszka

Preetam Joshi wrote:
> ok,
> 
> here is the code.
> The code essentially cerates two tasks low and high priority task.
> The low priority task has priority as 3 and high as 98
> 
> When i execute this initally everything goes smoothly as low priority task
> starts running with priority thread 3 , it sleeps so then the high priority
> thread runs with priority 98. But before the high priority thread finishes
> the for loop for 7 times the low priority thread prempts it and starts
> running with priority = 98.
Nope, you just don't read the state (using a global is also a bad idea).

> 
> This is what has baffled me?
> 
> #include <stdio.h>
> #include <unistd.h>
> #include <sys/mman.h>
> #include <native/task.h>
> #include <native/timer.h>
> 
> RT_TASK task1;
> RT_TASK task2;
> RT_TASK_INFO info;
> 
> void low_task(void *arg)
> {
          RT_TASK_INFO info;
>        rt_task_inquire(&task1, &info);
>        printf("Priority of low task %d\n", info.cprio);
> 
>        rt_task_sleep(3000000000);
> 
>       while(1)
>        {
                  rt_task_inquire(&task1, &info);
>                printf("Priority of Low task %d\n",info.cprio);
>        }
> 
> }
> 
> void high_task(void *arg)
> {
>        unsigned int i;
>        rt_task_inquire(&task2, &info);
>        printf("Priority of high task before sleep %d\n", info.cprio);
>        for(i=0;i<7;i++)
>        {
> 
>                printf("Priority of High Priotity task1 %d\n",info.cprio);
>                rt_task_sleep(1000000000);
>        }
> 
>        printf("High priority thread goin to sleep %d\n",info.cprio);
>        rt_task_sleep(3000000000);
> 
>        for(i=0;i<100;i++)
>        {
>                printf("Priority of High task2 %d\n",info.cprio);
>        }
> 
>       int main(int argc, char* argv[])
> {
>        mlockall(MCL_CURRENT|MCL_FUTURE);
> 
>        rt_task_create(&task1, "Low Priority Task", 0, 3, 0);
>        rt_task_create(&task2, "High Priority Task", 0, 98, 0);
> 
>        rt_task_start(&task1, &low_task, NULL);
>        rt_task_start(&task2, &high_task, NULL);
> 
>        pause();
> 
>        rt_task_join(&task1);
>        rt_task_join(&task2);
> 
> }
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> On 2/15/07, Jan Kiszka <jan.kiszka@domain.hid> wrote:
>>
>> Preetam Joshi wrote:
>> > Hi,
>> >
>> > Do u mean to say that if i have created my tasks using native xenomai
>> API's
>> > like rt_task_create , then inside those tasks i will have to use posix
>> skin
>> > calls like pthread_setschedpolicy, etc...?
>> >
>> > Is that so.
>>
>> Nope. If you picked the native skin API, all scheduler setup for a RT
>> task should be done through that interface.
>>
>> >
>> > Cant i just have context switch between the tasks themselves say low
>> > priority and a high priority task created by rt_task_create.
>> >
>> > Reason being i have created two tasks using the rt_task_create API and
>> my
>> > high priority task is runnning and my low priority task has slept, 
>> so as
>> > soon as my low priority task has expired its sleep time and gets ready
>> to
>> > run,
>> >
>> > The low priority task preempts my high priority task and even its
>> priority
>> > gets raised to that of the high priority task and starts executing. The
>> > higgh priority task gets suspended altogether amidst its running. 
>> Simply
>> > baffled by the behavior?
>>
>> If you have found a weird behaviour of Xenomai, please post some
>> as-small-as-possible demo code that exposes the issue. We will have a
>> look at it.
>>
Regards

Anders


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

* Re: [Xenomai-help] Make error
  2007-02-15 10:11                         ` Anders Blomdell
@ 2007-02-15 10:16                           ` Preetam Joshi
  2007-02-15 10:30                             ` Gilles Chanteperdrix
  2007-02-15 12:00                             ` Philippe Gerum
  2007-02-15 10:17                           ` Jan Kiszka
  1 sibling, 2 replies; 20+ messages in thread
From: Preetam Joshi @ 2007-02-15 10:16 UTC (permalink / raw)
  To: Anders Blomdell; +Cc: Xenomai-help, Jan Kiszka

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

Hi using it inside the task loop wwud give me RT_TASK_info as undeclared its
a global structure even as mentioned in the API documentation and the
behavior wud neways still remain the same as i mentioned in the code?

Please execute the code and comment.

Thanks.

On 2/15/07, Anders Blomdell <anders.blomdell@domain.hid> wrote:
>
> Preetam Joshi wrote:
> > ok,
> >
> > here is the code.
> > The code essentially cerates two tasks low and high priority task.
> > The low priority task has priority as 3 and high as 98
> >
> > When i execute this initally everything goes smoothly as low priority
> task
> > starts running with priority thread 3 , it sleeps so then the high
> priority
> > thread runs with priority 98. But before the high priority thread
> finishes
> > the for loop for 7 times the low priority thread prempts it and starts
> > running with priority = 98.
> Nope, you just don't read the state (using a global is also a bad idea).
>
> >
> > This is what has baffled me?
> >
> > #include <stdio.h>
> > #include <unistd.h>
> > #include <sys/mman.h>
> > #include <native/task.h>
> > #include <native/timer.h>
> >
> > RT_TASK task1;
> > RT_TASK task2;
> > RT_TASK_INFO info;
> >
> > void low_task(void *arg)
> > {
>           RT_TASK_INFO info;
> >        rt_task_inquire(&task1, &info);
> >        printf("Priority of low task %d\n", info.cprio);
> >
> >        rt_task_sleep(3000000000);
> >
> >       while(1)
> >        {
>                   rt_task_inquire(&task1, &info);
> >                printf("Priority of Low task %d\n",info.cprio);
> >        }
> >
> > }
> >
> > void high_task(void *arg)
> > {
> >        unsigned int i;
> >        rt_task_inquire(&task2, &info);
> >        printf("Priority of high task before sleep %d\n", info.cprio);
> >        for(i=0;i<7;i++)
> >        {
> >
> >                printf("Priority of High Priotity task1 %d\n",info.cprio
> );
> >                rt_task_sleep(1000000000);
> >        }
> >
> >        printf("High priority thread goin to sleep %d\n",info.cprio);
> >        rt_task_sleep(3000000000);
> >
> >        for(i=0;i<100;i++)
> >        {
> >                printf("Priority of High task2 %d\n",info.cprio);
> >        }
> >
> >       int main(int argc, char* argv[])
> > {
> >        mlockall(MCL_CURRENT|MCL_FUTURE);
> >
> >        rt_task_create(&task1, "Low Priority Task", 0, 3, 0);
> >        rt_task_create(&task2, "High Priority Task", 0, 98, 0);
> >
> >        rt_task_start(&task1, &low_task, NULL);
> >        rt_task_start(&task2, &high_task, NULL);
> >
> >        pause();
> >
> >        rt_task_join(&task1);
> >        rt_task_join(&task2);
> >
> > }
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > On 2/15/07, Jan Kiszka <jan.kiszka@domain.hid> wrote:
> >>
> >> Preetam Joshi wrote:
> >> > Hi,
> >> >
> >> > Do u mean to say that if i have created my tasks using native xenomai
> >> API's
> >> > like rt_task_create , then inside those tasks i will have to use
> posix
> >> skin
> >> > calls like pthread_setschedpolicy, etc...?
> >> >
> >> > Is that so.
> >>
> >> Nope. If you picked the native skin API, all scheduler setup for a RT
> >> task should be done through that interface.
> >>
> >> >
> >> > Cant i just have context switch between the tasks themselves say low
> >> > priority and a high priority task created by rt_task_create.
> >> >
> >> > Reason being i have created two tasks using the rt_task_create API
> and
> >> my
> >> > high priority task is runnning and my low priority task has slept,
> >> so as
> >> > soon as my low priority task has expired its sleep time and gets
> ready
> >> to
> >> > run,
> >> >
> >> > The low priority task preempts my high priority task and even its
> >> priority
> >> > gets raised to that of the high priority task and starts executing.
> The
> >> > higgh priority task gets suspended altogether amidst its running.
> >> Simply
> >> > baffled by the behavior?
> >>
> >> If you have found a weird behaviour of Xenomai, please post some
> >> as-small-as-possible demo code that exposes the issue. We will have a
> >> look at it.
> >>
> Regards
>
> Anders
>

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

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

* Re: [Xenomai-help] Make error
  2007-02-15 10:11                         ` Anders Blomdell
  2007-02-15 10:16                           ` Preetam Joshi
@ 2007-02-15 10:17                           ` Jan Kiszka
  1 sibling, 0 replies; 20+ messages in thread
From: Jan Kiszka @ 2007-02-15 10:17 UTC (permalink / raw)
  To: Anders Blomdell; +Cc: Xenomai-help

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

Anders Blomdell wrote:
> Preetam Joshi wrote:
>> ok,
>>
>> here is the code.
>> The code essentially cerates two tasks low and high priority task.
>> The low priority task has priority as 3 and high as 98
>>
>> When i execute this initally everything goes smoothly as low priority
>> task
>> starts running with priority thread 3 , it sleeps so then the high
>> priority
>> thread runs with priority 98. But before the high priority thread
>> finishes
>> the for loop for 7 times the low priority thread prempts it and starts
>> running with priority = 98.
> Nope, you just don't read the state (using a global is also a bad idea).
> 

...and the code contains lots of "printf" which switches away from
Xenomai into Linux mode with the potential to screw up the schedule as
well. Don't use printf in RT code unless you can live with potential
priority inversion during its execution.

>>
>> This is what has baffled me?
>>
>> #include <stdio.h>
>> #include <unistd.h>
>> #include <sys/mman.h>
>> #include <native/task.h>
>> #include <native/timer.h>
>>
>> RT_TASK task1;
>> RT_TASK task2;
>> RT_TASK_INFO info;
>>
>> void low_task(void *arg)
>> {
>          RT_TASK_INFO info;
>>        rt_task_inquire(&task1, &info);
>>        printf("Priority of low task %d\n", info.cprio);
>>
>>        rt_task_sleep(3000000000);
>>
>>       while(1)
>>        {
>                  rt_task_inquire(&task1, &info);
>>                printf("Priority of Low task %d\n",info.cprio);
>>        }
>>
>> }
>>
>> void high_task(void *arg)
>> {
>>        unsigned int i;
>>        rt_task_inquire(&task2, &info);
>>        printf("Priority of high task before sleep %d\n", info.cprio);
>>        for(i=0;i<7;i++)
>>        {
>>
>>                printf("Priority of High Priotity task1 %d\n",info.cprio);
>>                rt_task_sleep(1000000000);
>>        }
>>
>>        printf("High priority thread goin to sleep %d\n",info.cprio);
>>        rt_task_sleep(3000000000);
>>
>>        for(i=0;i<100;i++)
>>        {
>>                printf("Priority of High task2 %d\n",info.cprio);
>>        }
>>
>>       int main(int argc, char* argv[])
>> {
>>        mlockall(MCL_CURRENT|MCL_FUTURE);
>>
>>        rt_task_create(&task1, "Low Priority Task", 0, 3, 0);
>>        rt_task_create(&task2, "High Priority Task", 0, 98, 0);
>>
>>        rt_task_start(&task1, &low_task, NULL);
>>        rt_task_start(&task2, &high_task, NULL);
>>
>>        pause();
>>
>>        rt_task_join(&task1);
>>        rt_task_join(&task2);
>>
>> }
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> On 2/15/07, Jan Kiszka <jan.kiszka@domain.hid> wrote:
>>>
>>> Preetam Joshi wrote:
>>> > Hi,
>>> >
>>> > Do u mean to say that if i have created my tasks using native xenomai
>>> API's
>>> > like rt_task_create , then inside those tasks i will have to use posix
>>> skin
>>> > calls like pthread_setschedpolicy, etc...?
>>> >
>>> > Is that so.
>>>
>>> Nope. If you picked the native skin API, all scheduler setup for a RT
>>> task should be done through that interface.
>>>
>>> >
>>> > Cant i just have context switch between the tasks themselves say low
>>> > priority and a high priority task created by rt_task_create.
>>> >
>>> > Reason being i have created two tasks using the rt_task_create API and
>>> my
>>> > high priority task is runnning and my low priority task has slept,
>>> so as
>>> > soon as my low priority task has expired its sleep time and gets ready
>>> to
>>> > run,
>>> >
>>> > The low priority task preempts my high priority task and even its
>>> priority
>>> > gets raised to that of the high priority task and starts executing.
>>> The
>>> > higgh priority task gets suspended altogether amidst its running.
>>> Simply
>>> > baffled by the behavior?
>>>
>>> If you have found a weird behaviour of Xenomai, please post some
>>> as-small-as-possible demo code that exposes the issue. We will have a
>>> look at it.
>>>
> Regards
> 
> Anders



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

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

* Re: [Xenomai-help] Make error
  2007-02-15 10:16                           ` Preetam Joshi
@ 2007-02-15 10:30                             ` Gilles Chanteperdrix
  2007-02-15 12:00                             ` Philippe Gerum
  1 sibling, 0 replies; 20+ messages in thread
From: Gilles Chanteperdrix @ 2007-02-15 10:30 UTC (permalink / raw)
  To: Preetam Joshi; +Cc: Xenomai-help, Jan Kiszka

Preetam Joshi wrote:
> Hi using it inside the task loop wwud give me RT_TASK_info as undeclared
> its a global structure even as mentioned in the API documentation and
> the behavior wud neways still remain the same as i mentioned in the code?
> 
> Please execute the code and comment.

I see nothing in rt_task_inquire documentation which suggests that info
should be a global variable. Please make the variable info local to each
thread, and call rt_task_inquire every time you want to get a task's
priority. If you still observe something abnormal, please report.

-- 
                                                 Gilles Chanteperdrix


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

* Re: [Xenomai-help] Make error
  2007-02-15 10:16                           ` Preetam Joshi
  2007-02-15 10:30                             ` Gilles Chanteperdrix
@ 2007-02-15 12:00                             ` Philippe Gerum
  2007-02-21  8:12                               ` Preetam Joshi
  1 sibling, 1 reply; 20+ messages in thread
From: Philippe Gerum @ 2007-02-15 12:00 UTC (permalink / raw)
  To: Preetam Joshi; +Cc: Xenomai-help, Jan Kiszka

On Thu, 2007-02-15 at 15:46 +0530, Preetam Joshi wrote:
> Hi using it inside the task loop wwud give me RT_TASK_info as
> undeclared its a global structure even as mentioned in the API
> documentation

This is stated nowhere in the doc. Please read again.

>  and the behavior wud neways still remain the same as i mentioned in
> the code?
> 

Of course not, that's why Anders showed you the way.

> Please execute the code and comment.

Your code does not compile properly. There's a missing brace to close
the high priority task's body to start with. Additionally, 3000000000
only starts to be an implicitely unsigned value with the ISO C90
standard, so adding the 'ULL' qualifier would be a nice hint given to
the compiler that you really now what your are doing here.

Now, aside of those basic issues, the trivial one that bugs you is that:

1) the low priority task starts first, sets "info", then sleeps
2) the high priority task starts next while the low one is aslept,
overwrites "info", then sleeps,
3) which in turn causes the low priority task to print out the
overwritten value indefinitely after wakeup, which relates to the high
priority one, because it does this without ever reloading this variable
with its own priority information.

Please read your code again, make the "info" variable a local one for
both threads, then post anew if anything remains unclear.

> 
> Thanks.
> 
> On 2/15/07, Anders Blomdell <anders.blomdell@domain.hid> wrote:
>         Preetam Joshi wrote:
>         > ok,
>         >
>         > here is the code.
>         > The code essentially cerates two tasks low and high priority
>         task.
>         > The low priority task has priority as 3 and high as 98
>         >
>         > When i execute this initally everything goes smoothly as low
>         priority task 
>         > starts running with priority thread 3 , it sleeps so then
>         the high priority
>         > thread runs with priority 98. But before the high priority
>         thread finishes
>         > the for loop for 7 times the low priority thread prempts it
>         and starts 
>         > running with priority = 98.
>         Nope, you just don't read the state (using a global is also a
>         bad idea).
>         
>         >
>         > This is what has baffled me?
>         >
>         > #include <stdio.h>
>         > #include < unistd.h>
>         > #include <sys/mman.h>
>         > #include <native/task.h>
>         > #include <native/timer.h>
>         >
>         > RT_TASK task1;
>         > RT_TASK task2;
>         > RT_TASK_INFO info;
>         >
>         > void low_task(void *arg) 
>         > {
>                   RT_TASK_INFO info;
>         >        rt_task_inquire(&task1, &info);
>         >        printf("Priority of low task %d\n", info.cprio);
>         >
>         >        rt_task_sleep(3000000000); 
>         >
>         >       while(1)
>         >        {
>                           rt_task_inquire(&task1, &info);
>         >                printf("Priority of Low task %d
>         \n",info.cprio);
>         >        }
>         >
>         > } 
>         >
>         > void high_task(void *arg)
>         > {
>         >        unsigned int i;
>         >        rt_task_inquire(&task2, &info);
>         >        printf("Priority of high task before sleep %d\n",
>         info.cprio );
>         >        for(i=0;i<7;i++)
>         >        {
>         >
>         >                printf("Priority of High Priotity task1 %d
>         \n",info.cprio);
>         >                rt_task_sleep(1000000000);
>         >        } 
>         >
>         >        printf("High priority thread goin to sleep %d
>         \n",info.cprio);
>         >        rt_task_sleep(3000000000);
>         >
>         >        for(i=0;i<100;i++)
>         >        {
>         >                printf("Priority of High task2 %d\n",
>         info.cprio);
>         >        }
>         >
>         >       int main(int argc, char* argv[])
>         > {
>         >        mlockall(MCL_CURRENT|MCL_FUTURE);
>         >
>         >        rt_task_create(&task1, "Low Priority Task", 0, 3,
>         0); 
>         >        rt_task_create(&task2, "High Priority Task", 0, 98,
>         0);
>         >
>         >        rt_task_start(&task1, &low_task, NULL);
>         >        rt_task_start(&task2, &high_task, NULL);
>         >
>         >        pause();
>         >
>         >        rt_task_join(&task1);
>         >        rt_task_join(&task2);
>         >
>         > }
>         >
>         >
>         >
>         >
>         >
>         >
>         >
>         >
>         >
>         >
>         > 
>         >
>         >
>         > On 2/15/07, Jan Kiszka <jan.kiszka@domain.hid> wrote:
>         >>
>         >> Preetam Joshi wrote:
>         >> > Hi,
>         >> >
>         >> > Do u mean to say that if i have created my tasks using
>         native xenomai 
>         >> API's
>         >> > like rt_task_create , then inside those tasks i will have
>         to use posix
>         >> skin
>         >> > calls like pthread_setschedpolicy, etc...?
>         >> >
>         >> > Is that so. 
>         >>
>         >> Nope. If you picked the native skin API, all scheduler
>         setup for a RT
>         >> task should be done through that interface.
>         >>
>         >> >
>         >> > Cant i just have context switch between the tasks
>         themselves say low 
>         >> > priority and a high priority task created by
>         rt_task_create.
>         >> >
>         >> > Reason being i have created two tasks using the
>         rt_task_create API and
>         >> my
>         >> > high priority task is runnning and my low priority task
>         has slept, 
>         >> so as
>         >> > soon as my low priority task has expired its sleep time
>         and gets ready
>         >> to
>         >> > run,
>         >> >
>         >> > The low priority task preempts my high priority task and
>         even its 
>         >> priority
>         >> > gets raised to that of the high priority task and starts
>         executing. The
>         >> > higgh priority task gets suspended altogether amidst its
>         running.
>         >> Simply
>         >> > baffled by the behavior? 
>         >>
>         >> If you have found a weird behaviour of Xenomai, please post
>         some
>         >> as-small-as-possible demo code that exposes the issue. We
>         will have a
>         >> look at it.
>         >>
>         Regards
>         
>         Anders
> 
> _______________________________________________
> Xenomai-help mailing list
> Xenomai-help@domain.hid
> https://mail.gna.org/listinfo/xenomai-help
-- 
Philippe.




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

* Re: [Xenomai-help] Make error
  2007-02-15 12:00                             ` Philippe Gerum
@ 2007-02-21  8:12                               ` Preetam Joshi
  2007-02-21  8:18                                 ` Preetam Joshi
  0 siblings, 1 reply; 20+ messages in thread
From: Preetam Joshi @ 2007-02-21  8:12 UTC (permalink / raw)
  To: rpm; +Cc: Xenomai-help, Jan Kiszka

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

 cd ../../.. && /bin/sh ./config.status src/testsuite/mytask/Makefile
depfiles
config.status: error: invalid argument: src/testsuite/mytask/Makefile
make: *** [Makefile] Error 1
What dows this error mean n how do i solve it?

On 2/15/07, Philippe Gerum <rpm@xenomai.org> wrote:
>
> On Thu, 2007-02-15 at 15:46 +0530, Preetam Joshi wrote:
> > Hi using it inside the task loop wwud give me RT_TASK_info as
> > undeclared its a global structure even as mentioned in the API
> > documentation
>
> This is stated nowhere in the doc. Please read again.
>
> >  and the behavior wud neways still remain the same as i mentioned in
> > the code?
> >
>
> Of course not, that's why Anders showed you the way.
>
> > Please execute the code and comment.
>
> Your code does not compile properly. There's a missing brace to close
> the high priority task's body to start with. Additionally, 3000000000
> only starts to be an implicitely unsigned value with the ISO C90
> standard, so adding the 'ULL' qualifier would be a nice hint given to
> the compiler that you really now what your are doing here.
>
> Now, aside of those basic issues, the trivial one that bugs you is that:
>
> 1) the low priority task starts first, sets "info", then sleeps
> 2) the high priority task starts next while the low one is aslept,
> overwrites "info", then sleeps,
> 3) which in turn causes the low priority task to print out the
> overwritten value indefinitely after wakeup, which relates to the high
> priority one, because it does this without ever reloading this variable
> with its own priority information.
>
> Please read your code again, make the "info" variable a local one for
> both threads, then post anew if anything remains unclear.
>
> >
> > Thanks.
> >
> > On 2/15/07, Anders Blomdell <anders.blomdell@domain.hid> wrote:
> >         Preetam Joshi wrote:
> >         > ok,
> >         >
> >         > here is the code.
> >         > The code essentially cerates two tasks low and high priority
> >         task.
> >         > The low priority task has priority as 3 and high as 98
> >         >
> >         > When i execute this initally everything goes smoothly as low
> >         priority task
> >         > starts running with priority thread 3 , it sleeps so then
> >         the high priority
> >         > thread runs with priority 98. But before the high priority
> >         thread finishes
> >         > the for loop for 7 times the low priority thread prempts it
> >         and starts
> >         > running with priority = 98.
> >         Nope, you just don't read the state (using a global is also a
> >         bad idea).
> >
> >         >
> >         > This is what has baffled me?
> >         >
> >         > #include <stdio.h>
> >         > #include < unistd.h>
> >         > #include <sys/mman.h>
> >         > #include <native/task.h>
> >         > #include <native/timer.h>
> >         >
> >         > RT_TASK task1;
> >         > RT_TASK task2;
> >         > RT_TASK_INFO info;
> >         >
> >         > void low_task(void *arg)
> >         > {
> >                   RT_TASK_INFO info;
> >         >        rt_task_inquire(&task1, &info);
> >         >        printf("Priority of low task %d\n", info.cprio);
> >         >
> >         >        rt_task_sleep(3000000000);
> >         >
> >         >       while(1)
> >         >        {
> >                           rt_task_inquire(&task1, &info);
> >         >                printf("Priority of Low task %d
> >         \n",info.cprio);
> >         >        }
> >         >
> >         > }
> >         >
> >         > void high_task(void *arg)
> >         > {
> >         >        unsigned int i;
> >         >        rt_task_inquire(&task2, &info);
> >         >        printf("Priority of high task before sleep %d\n",
> >         info.cprio );
> >         >        for(i=0;i<7;i++)
> >         >        {
> >         >
> >         >                printf("Priority of High Priotity task1 %d
> >         \n",info.cprio);
> >         >                rt_task_sleep(1000000000);
> >         >        }
> >         >
> >         >        printf("High priority thread goin to sleep %d
> >         \n",info.cprio);
> >         >        rt_task_sleep(3000000000);
> >         >
> >         >        for(i=0;i<100;i++)
> >         >        {
> >         >                printf("Priority of High task2 %d\n",
> >         info.cprio);
> >         >        }
> >         >
> >         >       int main(int argc, char* argv[])
> >         > {
> >         >        mlockall(MCL_CURRENT|MCL_FUTURE);
> >         >
> >         >        rt_task_create(&task1, "Low Priority Task", 0, 3,
> >         0);
> >         >        rt_task_create(&task2, "High Priority Task", 0, 98,
> >         0);
> >         >
> >         >        rt_task_start(&task1, &low_task, NULL);
> >         >        rt_task_start(&task2, &high_task, NULL);
> >         >
> >         >        pause();
> >         >
> >         >        rt_task_join(&task1);
> >         >        rt_task_join(&task2);
> >         >
> >         > }
> >         >
> >         >
> >         >
> >         >
> >         >
> >         >
> >         >
> >         >
> >         >
> >         >
> >         >
> >         >
> >         >
> >         > On 2/15/07, Jan Kiszka <jan.kiszka@domain.hid> wrote:
> >         >>
> >         >> Preetam Joshi wrote:
> >         >> > Hi,
> >         >> >
> >         >> > Do u mean to say that if i have created my tasks using
> >         native xenomai
> >         >> API's
> >         >> > like rt_task_create , then inside those tasks i will have
> >         to use posix
> >         >> skin
> >         >> > calls like pthread_setschedpolicy, etc...?
> >         >> >
> >         >> > Is that so.
> >         >>
> >         >> Nope. If you picked the native skin API, all scheduler
> >         setup for a RT
> >         >> task should be done through that interface.
> >         >>
> >         >> >
> >         >> > Cant i just have context switch between the tasks
> >         themselves say low
> >         >> > priority and a high priority task created by
> >         rt_task_create.
> >         >> >
> >         >> > Reason being i have created two tasks using the
> >         rt_task_create API and
> >         >> my
> >         >> > high priority task is runnning and my low priority task
> >         has slept,
> >         >> so as
> >         >> > soon as my low priority task has expired its sleep time
> >         and gets ready
> >         >> to
> >         >> > run,
> >         >> >
> >         >> > The low priority task preempts my high priority task and
> >         even its
> >         >> priority
> >         >> > gets raised to that of the high priority task and starts
> >         executing. The
> >         >> > higgh priority task gets suspended altogether amidst its
> >         running.
> >         >> Simply
> >         >> > baffled by the behavior?
> >         >>
> >         >> If you have found a weird behaviour of Xenomai, please post
> >         some
> >         >> as-small-as-possible demo code that exposes the issue. We
> >         will have a
> >         >> look at it.
> >         >>
> >         Regards
> >
> >         Anders
> >
> > _______________________________________________
> > Xenomai-help mailing list
> > Xenomai-help@domain.hid
> > https://mail.gna.org/listinfo/xenomai-help
> --
> Philippe.
>
>
>

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

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

* Re: [Xenomai-help] Make error
  2007-02-21  8:12                               ` Preetam Joshi
@ 2007-02-21  8:18                                 ` Preetam Joshi
  0 siblings, 0 replies; 20+ messages in thread
From: Preetam Joshi @ 2007-02-21  8:18 UTC (permalink / raw)
  To: rpm; +Cc: Xenomai-help, Jan Kiszka

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

I got the solution to it


On 2/21/07, Preetam Joshi <j.preetam@domain.hid> wrote:
>
>  cd ../../.. && /bin/sh ./config.status src/testsuite/mytask/Makefile
> depfiles
> config.status: error: invalid argument: src/testsuite/mytask/Makefile
> make: *** [Makefile] Error 1
> What dows this error mean n how do i solve it?
>
> On 2/15/07, Philippe Gerum <rpm@xenomai.org> wrote:
> >
> > On Thu, 2007-02-15 at 15:46 +0530, Preetam Joshi wrote:
> > > Hi using it inside the task loop wwud give me RT_TASK_info as
> > > undeclared its a global structure even as mentioned in the API
> > > documentation
> >
> > This is stated nowhere in the doc. Please read again.
> >
> > >  and the behavior wud neways still remain the same as i mentioned in
> > > the code?
> > >
> >
> > Of course not, that's why Anders showed you the way.
> >
> > > Please execute the code and comment.
> >
> > Your code does not compile properly. There's a missing brace to close
> > the high priority task's body to start with. Additionally, 3000000000
> > only starts to be an implicitely unsigned value with the ISO C90
> > standard, so adding the 'ULL' qualifier would be a nice hint given to
> > the compiler that you really now what your are doing here.
> >
> > Now, aside of those basic issues, the trivial one that bugs you is that:
> >
> >
> > 1) the low priority task starts first, sets "info", then sleeps
> > 2) the high priority task starts next while the low one is aslept,
> > overwrites "info", then sleeps,
> > 3) which in turn causes the low priority task to print out the
> > overwritten value indefinitely after wakeup, which relates to the high
> > priority one, because it does this without ever reloading this variable
> > with its own priority information.
> >
> > Please read your code again, make the "info" variable a local one for
> > both threads, then post anew if anything remains unclear.
> >
> > >
> > > Thanks.
> > >
> > > On 2/15/07, Anders Blomdell <anders.blomdell@domain.hid> wrote:
> > >         Preetam Joshi wrote:
> > >         > ok,
> > >         >
> > >         > here is the code.
> > >         > The code essentially cerates two tasks low and high priority
> > >         task.
> > >         > The low priority task has priority as 3 and high as 98
> > >         >
> > >         > When i execute this initally everything goes smoothly as low
> > >         priority task
> > >         > starts running with priority thread 3 , it sleeps so then
> > >         the high priority
> > >         > thread runs with priority 98. But before the high priority
> > >         thread finishes
> > >         > the for loop for 7 times the low priority thread prempts it
> > >         and starts
> > >         > running with priority = 98.
> > >         Nope, you just don't read the state (using a global is also a
> > >         bad idea).
> > >
> > >         >
> > >         > This is what has baffled me?
> > >         >
> > >         > #include <stdio.h>
> > >         > #include < unistd.h>
> > >         > #include <sys/mman.h>
> > >         > #include <native/task.h>
> > >         > #include <native/timer.h>
> > >         >
> > >         > RT_TASK task1;
> > >         > RT_TASK task2;
> > >         > RT_TASK_INFO info;
> > >         >
> > >         > void low_task(void *arg)
> > >         > {
> > >                   RT_TASK_INFO info;
> > >         >        rt_task_inquire(&task1, &info);
> > >         >        printf("Priority of low task %d\n", info.cprio);
> > >         >
> > >         >        rt_task_sleep(3000000000);
> > >         >
> > >         >       while(1)
> > >         >        {
> > >                           rt_task_inquire(&task1, &info);
> > >         >                printf("Priority of Low task %d
> > >         \n",info.cprio);
> > >         >        }
> > >         >
> > >         > }
> > >         >
> > >         > void high_task(void *arg)
> > >         > {
> > >         >        unsigned int i;
> > >         >        rt_task_inquire(&task2, &info);
> > >         >        printf("Priority of high task before sleep %d\n",
> > >         info.cprio );
> > >         >        for(i=0;i<7;i++)
> > >         >        {
> > >         >
> > >         >                printf("Priority of High Priotity task1 %d
> > >         \n",info.cprio);
> > >         >                rt_task_sleep(1000000000);
> > >         >        }
> > >         >
> > >         >        printf("High priority thread goin to sleep %d
> > >         \n",info.cprio);
> > >         >        rt_task_sleep(3000000000);
> > >         >
> > >         >        for(i=0;i<100;i++)
> > >         >        {
> > >         >                printf("Priority of High task2 %d\n",
> > >         info.cprio);
> > >         >        }
> > >         >
> > >         >       int main(int argc, char* argv[])
> > >         > {
> > >         >        mlockall(MCL_CURRENT|MCL_FUTURE);
> > >         >
> > >         >        rt_task_create(&task1, "Low Priority Task", 0, 3,
> > >         0);
> > >         >        rt_task_create(&task2, "High Priority Task", 0, 98,
> > >         0);
> > >         >
> > >         >        rt_task_start(&task1, &low_task, NULL);
> > >         >        rt_task_start(&task2, &high_task, NULL);
> > >         >
> > >         >        pause();
> > >         >
> > >         >        rt_task_join(&task1);
> > >         >        rt_task_join(&task2);
> > >         >
> > >         > }
> > >         >
> > >         >
> > >         >
> > >         >
> > >         >
> > >         >
> > >         >
> > >         >
> > >         >
> > >         >
> > >         >
> > >         >
> > >         >
> > >         > On 2/15/07, Jan Kiszka <jan.kiszka@domain.hid> wrote:
> > >         >>
> > >         >> Preetam Joshi wrote:
> > >         >> > Hi,
> > >         >> >
> > >         >> > Do u mean to say that if i have created my tasks using
> > >         native xenomai
> > >         >> API's
> > >         >> > like rt_task_create , then inside those tasks i will have
> > >         to use posix
> > >         >> skin
> > >         >> > calls like pthread_setschedpolicy, etc...?
> > >         >> >
> > >         >> > Is that so.
> > >         >>
> > >         >> Nope. If you picked the native skin API, all scheduler
> > >         setup for a RT
> > >         >> task should be done through that interface.
> > >         >>
> > >         >> >
> > >         >> > Cant i just have context switch between the tasks
> > >         themselves say low
> > >         >> > priority and a high priority task created by
> > >         rt_task_create.
> > >         >> >
> > >         >> > Reason being i have created two tasks using the
> > >         rt_task_create API and
> > >         >> my
> > >         >> > high priority task is runnning and my low priority task
> > >         has slept,
> > >         >> so as
> > >         >> > soon as my low priority task has expired its sleep time
> > >         and gets ready
> > >         >> to
> > >         >> > run,
> > >         >> >
> > >         >> > The low priority task preempts my high priority task and
> > >         even its
> > >         >> priority
> > >         >> > gets raised to that of the high priority task and starts
> > >         executing. The
> > >         >> > higgh priority task gets suspended altogether amidst its
> > >         running.
> > >         >> Simply
> > >         >> > baffled by the behavior?
> > >         >>
> > >         >> If you have found a weird behaviour of Xenomai, please post
> > >         some
> > >         >> as-small-as-possible demo code that exposes the issue. We
> > >         will have a
> > >         >> look at it.
> > >         >>
> > >         Regards
> > >
> > >         Anders
> > >
> > > _______________________________________________
> > > Xenomai-help mailing list
> > > Xenomai-help@domain.hid
> > > https://mail.gna.org/listinfo/xenomai-help
> > --
> > Philippe.
> >
> >
> >
>

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

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

end of thread, other threads:[~2007-02-21  8:18 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-12  5:24 [Xenomai-help] Make error Preetam Joshi
2007-02-12  7:20 ` Markus Franke
2007-02-12  8:47 ` Jan Kiszka
     [not found]   ` <e45fe62b0702120448i7b23bd24o4fa88a05237a69a@domain.hid>
2007-02-12 13:06     ` Jan Kiszka
2007-02-13  7:19       ` Preetam Joshi
2007-02-13  8:08         ` Jan Kiszka
     [not found]           ` <e45fe62b0702130021i5ec6c345m699a9abcc2e665c0@domain.hid>
2007-02-13 10:28             ` Jan Kiszka
2007-02-14  5:57               ` Preetam Joshi
2007-02-14  8:53                 ` Jan Kiszka
2007-02-15  7:19                   ` Preetam Joshi
2007-02-15  9:03                     ` Jan Kiszka
2007-02-15  9:58                       ` Preetam Joshi
2007-02-15 10:11                         ` Anders Blomdell
2007-02-15 10:16                           ` Preetam Joshi
2007-02-15 10:30                             ` Gilles Chanteperdrix
2007-02-15 12:00                             ` Philippe Gerum
2007-02-21  8:12                               ` Preetam Joshi
2007-02-21  8:18                                 ` Preetam Joshi
2007-02-15 10:17                           ` Jan Kiszka
2007-02-13  9:00         ` 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.