All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-help] Question on periodic task
@ 2011-01-15 15:01 Wong Sheng Chao
  2011-01-15 23:03 ` Gilles Chanteperdrix
  2011-01-17 15:45 ` Gilles Chanteperdrix
  0 siblings, 2 replies; 9+ messages in thread
From: Wong Sheng Chao @ 2011-01-15 15:01 UTC (permalink / raw)
  To: xenomai


Hi

I'm a newbie in real time programming and I recently came to know of 
Xenomai. After patching the Xenomai to the linux kernel, I ran some 
examples that I found from the Internet to get a better understanding of 
the periodic task. Everything seems to run fine when I start two tasks 
with period of 1s and 2s, but the system freezes when I added more tasks 
( more than 2 tasks). The period is at 1s, 2s and 3s so i think the 
processor has more than enough time to process the tasks.

I also read that the periodic mode is emulated by a software driver 
which uses one-shot mode programming. Thus i did not enable periodic 
timing when I compile the Linux kernel, is this the cause of the problem?

I'm using a system with Core i7, ubuntu 10.04, linux kernel 2.6.32.15, 
xenomai 2.5.4

Do let me know what I did wrong in the code, thanks in advance!!


void demo (void *arg)
{
  //take in argument
  int num = (int *)arg;

  RT_TASK *curtask;
  RT_TASK_INFO curtaskinfo;

  curtask=rt_task_self();
  rt_task_inquire(curtask,&curtaskinfo);

  // task period in seconds
  rt_task_set_periodic(NULL, TM_NOW, (1000000000 * num));

  while(1)
  {
     rt_printf("Task name: %s \n", curtaskinfo.name);
     rt_task_wait_period(NULL);
   }

}

int main(int argc, char **argv)
{
   rt_print_auto_init(1);

   mlockall(MCL_CURRENT|MCL_FUTURE);

   rt_task_create(&demo_task1, "task1", 0, 1, 0);
   rt_task_create(&demo_task2, "task2", 0, 1, 0);
   rt_task_create(&demo_task3, "task3", 0, 1, 0);

   rt_task_start(&demo_task1, &demo, 1);
   rt_task_start(&demo_task2, &demo, 2);
   rt_task_start(&demo_task3, &demo, 3);

   pause();

   return 0;
}



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

* Re: [Xenomai-help] Question on periodic task
  2011-01-15 15:01 [Xenomai-help] Question on periodic task Wong Sheng Chao
@ 2011-01-15 23:03 ` Gilles Chanteperdrix
  2011-01-17 11:06   ` Wong Sheng Chao
  2011-01-17 15:45 ` Gilles Chanteperdrix
  1 sibling, 1 reply; 9+ messages in thread
From: Gilles Chanteperdrix @ 2011-01-15 23:03 UTC (permalink / raw)
  To: Wong Sheng Chao; +Cc: xenomai

Wong Sheng Chao wrote:
> Hi
> 
> I'm a newbie in real time programming and I recently came to know of 
> Xenomai. After patching the Xenomai to the linux kernel, I ran some 
> examples that I found from the Internet to get a better understanding of 
> the periodic task. Everything seems to run fine when I start two tasks 
> with period of 1s and 2s, but the system freezes when I added more tasks 
> ( more than 2 tasks). The period is at 1s, 2s and 3s so i think the 
> processor has more than enough time to process the tasks.
> 
> I also read that the periodic mode is emulated by a software driver 
> which uses one-shot mode programming. Thus i did not enable periodic 
> timing when I compile the Linux kernel, is this the cause of the problem?
> 
> I'm using a system with Core i7, ubuntu 10.04, linux kernel 2.6.32.15, 
> xenomai 2.5.4
> 
> Do let me know what I did wrong in the code, thanks in advance!!

You almost send us all the information we ask on this page:
http://www.xenomai.org/index.php/Request_for_information

We lack:
- the version of the Adeos patch you use
- the kernel logs from the boot up to the bug itself.

-- 
                                                                Gilles.


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

* Re: [Xenomai-help] Question on periodic task
  2011-01-15 23:03 ` Gilles Chanteperdrix
@ 2011-01-17 11:06   ` Wong Sheng Chao
  2011-01-17 13:34     ` Gilles Chanteperdrix
  0 siblings, 1 reply; 9+ messages in thread
From: Wong Sheng Chao @ 2011-01-17 11:06 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: xenomai

On 01/16/2011 12:03 AM, Gilles Chanteperdrix wrote:
> Wong Sheng Chao wrote:
>> Hi
>>
>> I'm a newbie in real time programming and I recently came to know of
>> Xenomai. After patching the Xenomai to the linux kernel, I ran some
>> examples that I found from the Internet to get a better understanding of
>> the periodic task. Everything seems to run fine when I start two tasks
>> with period of 1s and 2s, but the system freezes when I added more tasks
>> ( more than 2 tasks). The period is at 1s, 2s and 3s so i think the
>> processor has more than enough time to process the tasks.
>>
>> I also read that the periodic mode is emulated by a software driver
>> which uses one-shot mode programming. Thus i did not enable periodic
>> timing when I compile the Linux kernel, is this the cause of the problem?
>>
>> I'm using a system with Core i7, ubuntu 10.04, linux kernel 2.6.32.15,
>> xenomai 2.5.4
>>
>> Do let me know what I did wrong in the code, thanks in advance!!
> You almost send us all the information we ask on this page:
> http://www.xenomai.org/index.php/Request_for_information
>
> We lack:
> - the version of the Adeos patch you use
> - the kernel logs from the boot up to the bug itself.
>

- the version of the Adeos patch you use

I'm using the Adeos patch 2.6.32.15-x86-2.7-01.patch

- the kernel logs from the boot up to the bug itself.

I was not sure how to do this, so I google online and it seems that 
there are two ways of doing this, through serial port or ethernet. 
However I have only one linux system setup. Any suggestion on how I can 
provide the kernel logs?

After the kernel freezes, I reboot the system and went to /var/log to 
check the kern.log file at the time of the bug, but no logs were made on 
that particular time, is netconsole or serial port the only method of 
troubleshooting?





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

* Re: [Xenomai-help] Question on periodic task
  2011-01-17 11:06   ` Wong Sheng Chao
@ 2011-01-17 13:34     ` Gilles Chanteperdrix
  2011-01-17 15:30       ` Wong Sheng Chao
  0 siblings, 1 reply; 9+ messages in thread
From: Gilles Chanteperdrix @ 2011-01-17 13:34 UTC (permalink / raw)
  To: Wong Sheng Chao; +Cc: xenomai

Wong Sheng Chao wrote:
> On 01/16/2011 12:03 AM, Gilles Chanteperdrix wrote:
>> Wong Sheng Chao wrote:
>>> Hi
>>>
>>> I'm a newbie in real time programming and I recently came to know of
>>> Xenomai. After patching the Xenomai to the linux kernel, I ran some
>>> examples that I found from the Internet to get a better understanding of
>>> the periodic task. Everything seems to run fine when I start two tasks
>>> with period of 1s and 2s, but the system freezes when I added more tasks
>>> ( more than 2 tasks). The period is at 1s, 2s and 3s so i think the
>>> processor has more than enough time to process the tasks.
>>>
>>> I also read that the periodic mode is emulated by a software driver
>>> which uses one-shot mode programming. Thus i did not enable periodic
>>> timing when I compile the Linux kernel, is this the cause of the problem?
>>>
>>> I'm using a system with Core i7, ubuntu 10.04, linux kernel 2.6.32.15,
>>> xenomai 2.5.4
>>>
>>> Do let me know what I did wrong in the code, thanks in advance!!
>> You almost send us all the information we ask on this page:
>> http://www.xenomai.org/index.php/Request_for_information
>>
>> We lack:
>> - the version of the Adeos patch you use
>> - the kernel logs from the boot up to the bug itself.
>>
> 
> - the version of the Adeos patch you use
> 
> I'm using the Adeos patch 2.6.32.15-x86-2.7-01.patch
> 
> - the kernel logs from the boot up to the bug itself.
> 
> I was not sure how to do this, so I google online and it seems that 
> there are two ways of doing this, through serial port or ethernet. 
> However I have only one linux system setup. Any suggestion on how I can 
> provide the kernel logs?
> 
> After the kernel freezes, I reboot the system and went to /var/log to 
> check the kern.log file at the time of the bug, but no logs were made on 
> that particular time, is netconsole or serial port the only method of 
> troubleshooting?

You can try booting in text mode, and set the vga mode to have a lot of
lines, then run the test in text mode, to at least see if the reason of
the freeze you observe is a kernel oops.

If you do not see anything, then enable all the I-pipe and Xenomai
debugs, and try again.

-- 
                                                                Gilles.


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

* Re: [Xenomai-help] Question on periodic task
  2011-01-17 13:34     ` Gilles Chanteperdrix
@ 2011-01-17 15:30       ` Wong Sheng Chao
  2011-01-17 15:34         ` Gilles Chanteperdrix
  2011-01-17 15:35         ` Philippe Gerum
  0 siblings, 2 replies; 9+ messages in thread
From: Wong Sheng Chao @ 2011-01-17 15:30 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: xenomai


You can try booting in text mode, and set the vga mode to have a lot of
lines, then run the test in text mode, to at least see if the reason of
the freeze you observe is a kernel oops.

I tried booting it in text mode and the program still freezes after i 
execute the user-space program. There were no error messages.

If you do not see anything, then enable all the I-pipe and Xenomai
debugs, and try again.

How do I enable I-pipe and Xenomai debugs? Do I need to set these 
options during kernel configuration time? Will enabling I-pipe let me 
know if it's a kernel-oops?

Thanks again for your help!

Regards
Wong



On 01/17/2011 02:34 PM, Gilles Chanteperdrix wrote:
> Wong Sheng Chao wrote:
>> On 01/16/2011 12:03 AM, Gilles Chanteperdrix wrote:
>>> Wong Sheng Chao wrote:
>>>> Hi
>>>>
>>>> I'm a newbie in real time programming and I recently came to know of
>>>> Xenomai. After patching the Xenomai to the linux kernel, I ran some
>>>> examples that I found from the Internet to get a better understanding of
>>>> the periodic task. Everything seems to run fine when I start two tasks
>>>> with period of 1s and 2s, but the system freezes when I added more tasks
>>>> ( more than 2 tasks). The period is at 1s, 2s and 3s so i think the
>>>> processor has more than enough time to process the tasks.
>>>>
>>>> I also read that the periodic mode is emulated by a software driver
>>>> which uses one-shot mode programming. Thus i did not enable periodic
>>>> timing when I compile the Linux kernel, is this the cause of the problem?
>>>>
>>>> I'm using a system with Core i7, ubuntu 10.04, linux kernel 2.6.32.15,
>>>> xenomai 2.5.4
>>>>
>>>> Do let me know what I did wrong in the code, thanks in advance!!
>>> You almost send us all the information we ask on this page:
>>> http://www.xenomai.org/index.php/Request_for_information
>>>
>>> We lack:
>>> - the version of the Adeos patch you use
>>> - the kernel logs from the boot up to the bug itself.
>>>
>> - the version of the Adeos patch you use
>>
>> I'm using the Adeos patch 2.6.32.15-x86-2.7-01.patch
>>
>> - the kernel logs from the boot up to the bug itself.
>>
>> I was not sure how to do this, so I google online and it seems that
>> there are two ways of doing this, through serial port or ethernet.
>> However I have only one linux system setup. Any suggestion on how I can
>> provide the kernel logs?
>>
>> After the kernel freezes, I reboot the system and went to /var/log to
>> check the kern.log file at the time of the bug, but no logs were made on
>> that particular time, is netconsole or serial port the only method of
>> troubleshooting?
> You can try booting in text mode, and set the vga mode to have a lot of
> lines, then run the test in text mode, to at least see if the reason of
> the freeze you observe is a kernel oops.
>
> If you do not see anything, then enable all the I-pipe and Xenomai
> debugs, and try again.
>



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

* Re: [Xenomai-help] Question on periodic task
  2011-01-17 15:30       ` Wong Sheng Chao
@ 2011-01-17 15:34         ` Gilles Chanteperdrix
  2011-01-17 15:35         ` Philippe Gerum
  1 sibling, 0 replies; 9+ messages in thread
From: Gilles Chanteperdrix @ 2011-01-17 15:34 UTC (permalink / raw)
  To: Wong Sheng Chao; +Cc: xenomai

Wong Sheng Chao wrote:
> You can try booting in text mode, and set the vga mode to have a lot of
> lines, then run the test in text mode, to at least see if the reason of
> the freeze you observe is a kernel oops.
> 
> I tried booting it in text mode and the program still freezes after i 
> execute the user-space program. There were no error messages.
> 
> If you do not see anything, then enable all the I-pipe and Xenomai
> debugs, and try again.
> 
> How do I enable I-pipe and Xenomai debugs? Do I need to set these 
> options during kernel configuration time?

Yes. What about trying things first, and then ask questions if it does
not work?


> Will enabling I-pipe let me know if it's a kernel-oops?

No, it will allow you to see if something else went wrong.

-- 
                                                                Gilles.


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

* Re: [Xenomai-help] Question on periodic task
  2011-01-17 15:30       ` Wong Sheng Chao
  2011-01-17 15:34         ` Gilles Chanteperdrix
@ 2011-01-17 15:35         ` Philippe Gerum
  1 sibling, 0 replies; 9+ messages in thread
From: Philippe Gerum @ 2011-01-17 15:35 UTC (permalink / raw)
  To: Wong Sheng Chao; +Cc: xenomai

On Mon, 2011-01-17 at 16:30 +0100, Wong Sheng Chao wrote:
> You can try booting in text mode, and set the vga mode to have a lot of
> lines, then run the test in text mode, to at least see if the reason of
> the freeze you observe is a kernel oops.
> 
> I tried booting it in text mode and the program still freezes after i 
> execute the user-space program. There were no error messages.
> 
> If you do not see anything, then enable all the I-pipe and Xenomai
> debugs, and try again.
> 
> How do I enable I-pipe and Xenomai debugs? Do I need to set these 
> options during kernel configuration time? Will enabling I-pipe let me 
> know if it's a kernel-oops?

Before anything else, you should really start testing the return code of
your syscalls, specifically for rt_task_wait_period(), and break from
your while() loop if something went wrong.

> 
> Thanks again for your help!
> 
> Regards
> Wong
> 
> 
> 
> On 01/17/2011 02:34 PM, Gilles Chanteperdrix wrote:
> > Wong Sheng Chao wrote:
> >> On 01/16/2011 12:03 AM, Gilles Chanteperdrix wrote:
> >>> Wong Sheng Chao wrote:
> >>>> Hi
> >>>>
> >>>> I'm a newbie in real time programming and I recently came to know of
> >>>> Xenomai. After patching the Xenomai to the linux kernel, I ran some
> >>>> examples that I found from the Internet to get a better understanding of
> >>>> the periodic task. Everything seems to run fine when I start two tasks
> >>>> with period of 1s and 2s, but the system freezes when I added more tasks
> >>>> ( more than 2 tasks). The period is at 1s, 2s and 3s so i think the
> >>>> processor has more than enough time to process the tasks.
> >>>>
> >>>> I also read that the periodic mode is emulated by a software driver
> >>>> which uses one-shot mode programming. Thus i did not enable periodic
> >>>> timing when I compile the Linux kernel, is this the cause of the problem?
> >>>>
> >>>> I'm using a system with Core i7, ubuntu 10.04, linux kernel 2.6.32.15,
> >>>> xenomai 2.5.4
> >>>>
> >>>> Do let me know what I did wrong in the code, thanks in advance!!
> >>> You almost send us all the information we ask on this page:
> >>> http://www.xenomai.org/index.php/Request_for_information
> >>>
> >>> We lack:
> >>> - the version of the Adeos patch you use
> >>> - the kernel logs from the boot up to the bug itself.
> >>>
> >> - the version of the Adeos patch you use
> >>
> >> I'm using the Adeos patch 2.6.32.15-x86-2.7-01.patch
> >>
> >> - the kernel logs from the boot up to the bug itself.
> >>
> >> I was not sure how to do this, so I google online and it seems that
> >> there are two ways of doing this, through serial port or ethernet.
> >> However I have only one linux system setup. Any suggestion on how I can
> >> provide the kernel logs?
> >>
> >> After the kernel freezes, I reboot the system and went to /var/log to
> >> check the kern.log file at the time of the bug, but no logs were made on
> >> that particular time, is netconsole or serial port the only method of
> >> troubleshooting?
> > You can try booting in text mode, and set the vga mode to have a lot of
> > lines, then run the test in text mode, to at least see if the reason of
> > the freeze you observe is a kernel oops.
> >
> > If you do not see anything, then enable all the I-pipe and Xenomai
> > debugs, and try again.
> >
> 
> 
> _______________________________________________
> Xenomai-help mailing list
> Xenomai-help@domain.hid
> https://mail.gna.org/listinfo/xenomai-help

-- 
Philippe.




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

* Re: [Xenomai-help] Question on periodic task
  2011-01-15 15:01 [Xenomai-help] Question on periodic task Wong Sheng Chao
  2011-01-15 23:03 ` Gilles Chanteperdrix
@ 2011-01-17 15:45 ` Gilles Chanteperdrix
  2011-01-17 20:35   ` [Xenomai-help] [SOLVED] " WONG Sheng Chao
  1 sibling, 1 reply; 9+ messages in thread
From: Gilles Chanteperdrix @ 2011-01-17 15:45 UTC (permalink / raw)
  To: Wong Sheng Chao; +Cc: xenomai

Wong Sheng Chao wrote:
> Hi
> 
> I'm a newbie in real time programming and I recently came to know of 
> Xenomai. After patching the Xenomai to the linux kernel, I ran some 
> examples that I found from the Internet to get a better understanding of 
> the periodic task. Everything seems to run fine when I start two tasks 
> with period of 1s and 2s, but the system freezes when I added more tasks 
> ( more than 2 tasks). The period is at 1s, 2s and 3s so i think the 
> processor has more than enough time to process the tasks.
> 
> I also read that the periodic mode is emulated by a software driver 
> which uses one-shot mode programming. Thus i did not enable periodic 
> timing when I compile the Linux kernel, is this the cause of the problem?
> 
> I'm using a system with Core i7, ubuntu 10.04, linux kernel 2.6.32.15, 
> xenomai 2.5.4
> 
> Do let me know what I did wrong in the code, thanks in advance!!
> 
> 
> void demo (void *arg)
> {
>   //take in argument
>   int num = (int *)arg;
> 
>   RT_TASK *curtask;
>   RT_TASK_INFO curtaskinfo;
> 
>   curtask=rt_task_self();
>   rt_task_inquire(curtask,&curtaskinfo);
> 
>   // task period in seconds
>   rt_task_set_periodic(NULL, TM_NOW, (1000000000 * num));

Should be 1000000000ULL * num here.

-- 
                                                                Gilles.


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

* [Xenomai-help] [SOLVED] Re:  Question on periodic task
  2011-01-17 15:45 ` Gilles Chanteperdrix
@ 2011-01-17 20:35   ` WONG Sheng Chao
  0 siblings, 0 replies; 9+ messages in thread
From: WONG Sheng Chao @ 2011-01-17 20:35 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: xenomai

Problem solved, it was a problem with unsigned long long (ULL). Thanks 
Gilles and Philippe.

On 1/17/2011 4:45 PM, Gilles Chanteperdrix wrote:
> Wong Sheng Chao wrote:
>> Hi
>>
>> I'm a newbie in real time programming and I recently came to know of
>> Xenomai. After patching the Xenomai to the linux kernel, I ran some
>> examples that I found from the Internet to get a better understanding of
>> the periodic task. Everything seems to run fine when I start two tasks
>> with period of 1s and 2s, but the system freezes when I added more tasks
>> ( more than 2 tasks). The period is at 1s, 2s and 3s so i think the
>> processor has more than enough time to process the tasks.
>>
>> I also read that the periodic mode is emulated by a software driver
>> which uses one-shot mode programming. Thus i did not enable periodic
>> timing when I compile the Linux kernel, is this the cause of the problem?
>>
>> I'm using a system with Core i7, ubuntu 10.04, linux kernel 2.6.32.15,
>> xenomai 2.5.4
>>
>> Do let me know what I did wrong in the code, thanks in advance!!
>>
>>
>> void demo (void *arg)
>> {
>>    //take in argument
>>    int num = (int *)arg;
>>
>>    RT_TASK *curtask;
>>    RT_TASK_INFO curtaskinfo;
>>
>>    curtask=rt_task_self();
>>    rt_task_inquire(curtask,&curtaskinfo);
>>
>>    // task period in seconds
>>    rt_task_set_periodic(NULL, TM_NOW, (1000000000 * num));
> Should be 1000000000ULL * num here.
>



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

end of thread, other threads:[~2011-01-17 20:35 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-15 15:01 [Xenomai-help] Question on periodic task Wong Sheng Chao
2011-01-15 23:03 ` Gilles Chanteperdrix
2011-01-17 11:06   ` Wong Sheng Chao
2011-01-17 13:34     ` Gilles Chanteperdrix
2011-01-17 15:30       ` Wong Sheng Chao
2011-01-17 15:34         ` Gilles Chanteperdrix
2011-01-17 15:35         ` Philippe Gerum
2011-01-17 15:45 ` Gilles Chanteperdrix
2011-01-17 20:35   ` [Xenomai-help] [SOLVED] " WONG Sheng Chao

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.