Skip to contentSkip to conversation

Question on periodic task

Xenomai-help Wong Sheng Chao 3 participants 9 messages Jan 15, 2011 – Jan 17, 2011

lore
Share & tools
lore
#0 lore raw

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;
}

#1 lore raw
Quoted 10 lines · Wong Sheng Chao

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.

Quoted 8 lines

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.

Signature · 1 line
                                                                Gilles.
#2 lore raw
Quoted 18 lines · Gilles Chanteperdrix
Quoted 17 lines · Wong Sheng Chao

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

Quoted 8 lines
Quoted 1 line

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?

#3 lore raw
Quoted 39 lines · Wong Sheng Chao
Quoted 18 lines · Gilles Chanteperdrix
Quoted 17 lines · Wong Sheng Chao

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

Quoted 8 lines
Quoted 1 line

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?

Quoted 4 lines

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.

Signature · 1 line
                                                                Gilles.
#4 lore raw

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

Quoted 50 lines · Gilles Chanteperdrix
Quoted 38 lines · Wong Sheng Chao
Quoted 18 lines · Gilles Chanteperdrix
Quoted 17 lines · Wong Sheng Chao

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

Quoted 8 lines
Quoted 1 line

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?

Quoted 4 lines

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.

#5 lore raw
Quoted 4 lines · Wong Sheng Chao

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.

Quoted 8 lines

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?

Quoted 1 line

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.

Signature · 1 line
                                                                Gilles.
#6 lore raw
In reply to Wong Sheng Chao
Quoted 7 lines · Wong Sheng Chao

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.

Quoted 6 lines

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.

Quoted 65 lines

Thanks again for your help!

Regards
Wong

Quoted 43 lines · Gilles Chanteperdrix
Quoted 38 lines · Wong Sheng Chao
Quoted 18 lines · Gilles Chanteperdrix
Quoted 17 lines · Wong Sheng Chao

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

Quoted 8 lines
Quoted 1 line

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?

Quoted 4 lines

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?

Quoted 7 lines

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
[email protected]
https://mail.gna.org/listinfo/xenomai-help

Signature · 1 line
Philippe.
#7 lore raw
In reply to Wong Sheng Chao
Quoted 25 lines · Wong Sheng Chao

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;

Quoted 8 lines

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.

Signature · 1 line
                                                                Gilles.
#8 lore raw

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

Quoted 36 lines · Gilles Chanteperdrix
Quoted 21 lines · Wong Sheng Chao

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)

Quoted 12 lines
{
   //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.