All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-help] Timer problemm with 2.2.4 release
@ 2006-10-26 10:27 Stephan Zimmermann
  2006-10-26 10:50 ` Jan Kiszka
  0 siblings, 1 reply; 4+ messages in thread
From: Stephan Zimmermann @ 2006-10-26 10:27 UTC (permalink / raw)
  To: xenomai

Hello list,
I recently switched from 2.2.0 on Kernel 2.6.17.6 to more actual 2.2.4  on 
Kernel 2.6.17.14.
After upgrading my periodic tasks won't work at all (task_wait and 
set_periodic functions return errors). I wrote a little testprogram to verify 
it's not a problem with my Software. The code runs fine on my Notebook, still 
under 2.2.0/2.6.17.6, but won't work on my Desktop (AMD X2 / VIA K8T800) with 
the all-new Kernel/Xenomai installation. Maybe there is some config-thing i 
have overseen?

#include <iostream>
#include <sys/mman.h>

#include "native/task.h"
#include "native/timer.h"

RT_TASK maintask;

int main(void){
	std::cout << "xenomai 2.2.4 timer-test" << std::endl;
	mlockall(MCL_CURRENT | MCL_FUTURE);
	
	int err;
	unsigned long overrun = 0; 
	
	err = rt_task_shadow (&maintask,"maintask",10,0);
	std::cout << "task shadow:" << err << std::endl;
	
	err = rt_timer_set_mode(1000000);
	std::cout << "timer set mode:" << err << std::endl;
	
	err = rt_task_sleep(1000);
	std::cout << "task sleep:" << err << std::endl;
	
	err = rt_task_set_periodic(NULL,TM_NOW,1000);  
	std::cout << "task set periodic:" << err << std::endl;
	
	for(int i  = 0; i < 3; i++){
		err = rt_task_wait_period(&overrun);
		std::cout << "task wait period:" << err << " overrunns:" << overrun << 
std::endl;
	}
	
	return 0;
}

Output on my Workstation:
----------------------------------------------
xenomai 2.2.4 timer-test
task shadow:0
timer set mode:0
task sleep:0
task set periodic:-22
task wait period:-11 overrunns:0
task wait period:-11 overrunns:0
task wait period:-11 overrunns:0

Output on my Notebook:
----------------------------------------------
xenomai 2.2.4 timer-test
task shadow:0
timer set mode:0
task sleep:0
task set periodic:0
task wait period:0 overrunns:0
task wait period:0 overrunns:0
task wait period:0 overrunns:0




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

* Re: [Xenomai-help] Timer problemm with 2.2.4 release
  2006-10-26 10:27 [Xenomai-help] Timer problemm with 2.2.4 release Stephan Zimmermann
@ 2006-10-26 10:50 ` Jan Kiszka
  2006-10-26 12:01   ` Stephan Zimmermann
  2006-10-27 18:12   ` Philippe Gerum
  0 siblings, 2 replies; 4+ messages in thread
From: Jan Kiszka @ 2006-10-26 10:50 UTC (permalink / raw)
  To: Stephan Zimmermann; +Cc: xenomai

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

Stephan Zimmermann wrote:
> Hello list,
> I recently switched from 2.2.0 on Kernel 2.6.17.6 to more actual 2.2.4  on 
> Kernel 2.6.17.14.
> After upgrading my periodic tasks won't work at all (task_wait and 
> set_periodic functions return errors). I wrote a little testprogram to verify 
> it's not a problem with my Software. The code runs fine on my Notebook, still 
> under 2.2.0/2.6.17.6, but won't work on my Desktop (AMD X2 / VIA K8T800) with 
> the all-new Kernel/Xenomai installation. Maybe there is some config-thing i 
> have overseen?
> 
> #include <iostream>
> #include <sys/mman.h>
> 
> #include "native/task.h"
> #include "native/timer.h"
> 
> RT_TASK maintask;
> 
> int main(void){
> 	std::cout << "xenomai 2.2.4 timer-test" << std::endl;
> 	mlockall(MCL_CURRENT | MCL_FUTURE);
> 	
> 	int err;
> 	unsigned long overrun = 0; 
> 	
> 	err = rt_task_shadow (&maintask,"maintask",10,0);
> 	std::cout << "task shadow:" << err << std::endl;
> 	
> 	err = rt_timer_set_mode(1000000);
> 	std::cout << "timer set mode:" << err << std::endl;
> 	
> 	err = rt_task_sleep(1000);
> 	std::cout << "task sleep:" << err << std::endl;
> 	
> 	err = rt_task_set_periodic(NULL,TM_NOW,1000);  
> 	std::cout << "task set periodic:" << err << std::endl;
> 	
> 	for(int i  = 0; i < 3; i++){
> 		err = rt_task_wait_period(&overrun);
> 		std::cout << "task wait period:" << err << " overrunns:" << overrun << 
> std::endl;
> 	}
> 	
> 	return 0;
> }
> 
> Output on my Workstation:
> ----------------------------------------------
> xenomai 2.2.4 timer-test
> task shadow:0
> timer set mode:0
> task sleep:0
> task set periodic:-22
> task wait period:-11 overrunns:0
> task wait period:-11 overrunns:0
> task wait period:-11 overrunns:0
> 
> Output on my Notebook:
> ----------------------------------------------
> xenomai 2.2.4 timer-test

I guess this is a typo (2.2.0?).

> task shadow:0
> timer set mode:0
> task sleep:0
> task set periodic:0
> task wait period:0 overrunns:0
> task wait period:0 overrunns:0
> task wait period:0 overrunns:0
> 

Looks like we have a bug here:

http://www.rts.uni-hannover.de/xenomai/lxr/source/ksrc/nucleus/pod.c#L3408

That new LART check doesn't consider the periodic mode where period does
not have the same unit as nkschedlat. Something like this might be
needed (quick hack alarm!):

--- ksrc/nucleus/pod.c  (revision 1747)
+++ ksrc/nucleus/pod.c  (working copy)
@@ -3413,7 +3413,7 @@ int xnpod_set_thread_periodic(xnthread_t
                        xntimer_stop(&thread->ptimer);

                goto unlock_and_exit;
-       } else if (period < nkschedlat) {
+       } else if (nkpod->tickvalue == 1 && period < nkschedlat) {
                /* LART: detect periods which are shorter than the
                 * intrinsic latency figure; this must be a joke... */
                err = -EINVAL;

Jan


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

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

* Re: [Xenomai-help] Timer problemm with 2.2.4 release
  2006-10-26 10:50 ` Jan Kiszka
@ 2006-10-26 12:01   ` Stephan Zimmermann
  2006-10-27 18:12   ` Philippe Gerum
  1 sibling, 0 replies; 4+ messages in thread
From: Stephan Zimmermann @ 2006-10-26 12:01 UTC (permalink / raw)
  To: xenomai

Am Donnerstag, 26. Oktober 2006 12:50 schrieb Jan Kiszka:
> Stephan Zimmermann wrote:
> > Hello list,
> > I recently switched from 2.2.0 on Kernel 2.6.17.6 to more actual 2.2.4 
> > on Kernel 2.6.17.14.
> > After upgrading my periodic tasks won't work at all (task_wait and
> > set_periodic functions return errors). I wrote a little testprogram to
> > verify it's not a problem with my Software. The code runs fine on my
> > Notebook, still under 2.2.0/2.6.17.6, but won't work on my Desktop (AMD
> > X2 / VIA K8T800) with the all-new Kernel/Xenomai installation. Maybe
> > there is some config-thing i have overseen?
> >
> > #include <iostream>
> > #include <sys/mman.h>
> >
> > #include "native/task.h"
> > #include "native/timer.h"
> >
> > RT_TASK maintask;
> >
> > int main(void){
> > 	std::cout << "xenomai 2.2.4 timer-test" << std::endl;
> > 	mlockall(MCL_CURRENT | MCL_FUTURE);
> >
> > 	int err;
> > 	unsigned long overrun = 0;
> >
> > 	err = rt_task_shadow (&maintask,"maintask",10,0);
> > 	std::cout << "task shadow:" << err << std::endl;
> >
> > 	err = rt_timer_set_mode(1000000);
> > 	std::cout << "timer set mode:" << err << std::endl;
> >
> > 	err = rt_task_sleep(1000);
> > 	std::cout << "task sleep:" << err << std::endl;
> >
> > 	err = rt_task_set_periodic(NULL,TM_NOW,1000);
> > 	std::cout << "task set periodic:" << err << std::endl;
> >
> > 	for(int i  = 0; i < 3; i++){
> > 		err = rt_task_wait_period(&overrun);
> > 		std::cout << "task wait period:" << err << " overrunns:" << overrun <<
> > std::endl;
> > 	}
> >
> > 	return 0;
> > }
> >
> > Output on my Workstation:
> > ----------------------------------------------
> > xenomai 2.2.4 timer-test
> > task shadow:0
> > timer set mode:0
> > task sleep:0
> > task set periodic:-22
> > task wait period:-11 overrunns:0
> > task wait period:-11 overrunns:0
> > task wait period:-11 overrunns:0
> >
> > Output on my Notebook:
> > ----------------------------------------------
> > xenomai 2.2.4 timer-test
>
> I guess this is a typo (2.2.0?).
yes, from here on 2.2.0
>
> > task shadow:0
> > timer set mode:0
> > task sleep:0
> > task set periodic:0
> > task wait period:0 overrunns:0
> > task wait period:0 overrunns:0
> > task wait period:0 overrunns:0
>
> Looks like we have a bug here:

I applied your change, now it seems to work. If I should find s.th. weird with 
it, I will inform you. 
Thanks for this really quick reply.

> http://www.rts.uni-hannover.de/xenomai/lxr/source/ksrc/nucleus/pod.c#L3408
>
> That new LART check doesn't consider the periodic mode where period does
> not have the same unit as nkschedlat. Something like this might be
> needed (quick hack alarm!):
>
> --- ksrc/nucleus/pod.c  (revision 1747)
> +++ ksrc/nucleus/pod.c  (working copy)
> @@ -3413,7 +3413,7 @@ int xnpod_set_thread_periodic(xnthread_t
>                         xntimer_stop(&thread->ptimer);
>
>                 goto unlock_and_exit;
> -       } else if (period < nkschedlat) {
> +       } else if (nkpod->tickvalue == 1 && period < nkschedlat) {
>                 /* LART: detect periods which are shorter than the
>                  * intrinsic latency figure; this must be a joke... */
>                 err = -EINVAL;
>
> Jan



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

* Re: [Xenomai-help] Timer problemm with 2.2.4 release
  2006-10-26 10:50 ` Jan Kiszka
  2006-10-26 12:01   ` Stephan Zimmermann
@ 2006-10-27 18:12   ` Philippe Gerum
  1 sibling, 0 replies; 4+ messages in thread
From: Philippe Gerum @ 2006-10-27 18:12 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: xenomai

On Thu, 2006-10-26 at 12:50 +0200, Jan Kiszka wrote:
> Stephan Zimmermann wrote:
> > Hello list,
> > I recently switched from 2.2.0 on Kernel 2.6.17.6 to more actual 2.2.4  on 
> > Kernel 2.6.17.14.
> > After upgrading my periodic tasks won't work at all (task_wait and 
> > set_periodic functions return errors). I wrote a little testprogram to verify 
> > it's not a problem with my Software. The code runs fine on my Notebook, still 
> > under 2.2.0/2.6.17.6, but won't work on my Desktop (AMD X2 / VIA K8T800) with 
> > the all-new Kernel/Xenomai installation. Maybe there is some config-thing i 
> > have overseen?
> > 
> > #include <iostream>
> > #include <sys/mman.h>
> > 
> > #include "native/task.h"
> > #include "native/timer.h"
> > 
> > RT_TASK maintask;
> > 
> > int main(void){
> > 	std::cout << "xenomai 2.2.4 timer-test" << std::endl;
> > 	mlockall(MCL_CURRENT | MCL_FUTURE);
> > 	
> > 	int err;
> > 	unsigned long overrun = 0; 
> > 	
> > 	err = rt_task_shadow (&maintask,"maintask",10,0);
> > 	std::cout << "task shadow:" << err << std::endl;
> > 	
> > 	err = rt_timer_set_mode(1000000);
> > 	std::cout << "timer set mode:" << err << std::endl;
> > 	
> > 	err = rt_task_sleep(1000);
> > 	std::cout << "task sleep:" << err << std::endl;
> > 	
> > 	err = rt_task_set_periodic(NULL,TM_NOW,1000);  
> > 	std::cout << "task set periodic:" << err << std::endl;
> > 	
> > 	for(int i  = 0; i < 3; i++){
> > 		err = rt_task_wait_period(&overrun);
> > 		std::cout << "task wait period:" << err << " overrunns:" << overrun << 
> > std::endl;
> > 	}
> > 	
> > 	return 0;
> > }
> > 
> > Output on my Workstation:
> > ----------------------------------------------
> > xenomai 2.2.4 timer-test
> > task shadow:0
> > timer set mode:0
> > task sleep:0
> > task set periodic:-22
> > task wait period:-11 overrunns:0
> > task wait period:-11 overrunns:0
> > task wait period:-11 overrunns:0
> > 
> > Output on my Notebook:
> > ----------------------------------------------
> > xenomai 2.2.4 timer-test
> 
> I guess this is a typo (2.2.0?).
> 
> > task shadow:0
> > timer set mode:0
> > task sleep:0
> > task set periodic:0
> > task wait period:0 overrunns:0
> > task wait period:0 overrunns:0
> > task wait period:0 overrunns:0
> > 
> 
> Looks like we have a bug here:
> 
> http://www.rts.uni-hannover.de/xenomai/lxr/source/ksrc/nucleus/pod.c#L3408
> 
> That new LART check doesn't consider the periodic mode where period does
> not have the same unit as nkschedlat. Something like this might be
> needed (quick hack alarm!):
> 
> --- ksrc/nucleus/pod.c  (revision 1747)
> +++ ksrc/nucleus/pod.c  (working copy)
> @@ -3413,7 +3413,7 @@ int xnpod_set_thread_periodic(xnthread_t
>                         xntimer_stop(&thread->ptimer);
> 
>                 goto unlock_and_exit;
> -       } else if (period < nkschedlat) {
> +       } else if (nkpod->tickvalue == 1 && period < nkschedlat) {
>                 /* LART: detect periods which are shorter than the
>                  * intrinsic latency figure; this must be a joke... */
>                 err = -EINVAL;

Good catch. Here is the similar fix I'm going to apply.

--- ksrc/nucleus/pod.c	(revision 1759)
+++ ksrc/nucleus/pod.c	(working copy)
@@ -3415,7 +3415,7 @@
 			xntimer_stop(&thread->ptimer);
 
 		goto unlock_and_exit;
-	} else if (period < nkschedlat) {
+	} else if (!testbits(nkpod->status, XNTMPER) && period < nkschedlat) {
 		/* LART: detect periods which are shorter than the
 		 * intrinsic latency figure; this must be a joke... */
 		err = -EINVAL;
-- 
Philippe.




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

end of thread, other threads:[~2006-10-27 18:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-26 10:27 [Xenomai-help] Timer problemm with 2.2.4 release Stephan Zimmermann
2006-10-26 10:50 ` Jan Kiszka
2006-10-26 12:01   ` Stephan Zimmermann
2006-10-27 18:12   ` Philippe Gerum

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.