[Xenomai] imx6q xenomai ipipe-3.0-imx6q

eric ericvic at 163.com
Wed Apr 23 06:40:28 CEST 2014










在 2014-04-20 18:46:21,eric <ericvic at 163.com> 写道:

>在 2014-04-20 17:23:19,"Gilles Chanteperdrix" <gilles.chanteperdrix at xenomai.org> 写道:
>Le 20/04/2014 11:03, Gilles Chanteperdrix a écrit :
>> Le 20/04/2014 07:06, eric a écrit :
>>> So if my program use lots of memory operations  for a long time it maybe
>>> gives non real-time activities opportunity to thrash the cache?
>> 
>> It is unrelated, but on a multi-core processor even when one core is
>> running a real-time task, other cores can thrash the cache at will, or
>> slow down the real-time task by using a shared ressource (for instance
>> DDR) and starving the core where the real-time task runs. By default the
>> L2 cache is shared between all cores, you can try and reserve parts of
>> the cache for each core (check the l2x0 registers documentation to see
>> how), I tried this on omap4, but it results on worse latencies,
>> situation may be different on imx6 though. Another problem is that since
>> the L1 cache is per-core, I believe, and we disable L2 write allocate,
>> reading on one core memory written on another core results in accesses
>> at the DDR speed, and not at the cache speed.
>> 
>> All this to say that Xenomai focuses on trying to schedule your driver
>> interrupts and application threads in a deterministic fashion but it is
>> your job to make sure that these interrupts and threads do not take too
>> long a time to execute, because if they do, yes, your application will
>> not meet its deadlines, but it is not Xenomai's fault.
>
>I do not mean to say that you do not have a problem with Xenomai on
>imx6q, but so far, I have not understood what this problem was.
>
>
>-- 
>Gilles.





Hello Gilles I found the same test on x86 double cores and enble smp  with rtai will not have the max delay ,it is just 50us latencies ,this is my test with rtai , the multi-core processor with  shared cache can be thrashed just appears on imx6 and omap4 or all arm with multi-core has the same problems? thank you
#include <linux/module.h>
#include <rtai.h>
#include <rtai_sched.h>
 #include <asm/timex.h>
#define LPT1_BASE 0x378
#define STACK_SIZE 4096
#define TIMERTICKS 1000000 

static RT_TASK tasks;
char logo[40*1024]={0};
char mem_spvm[40*1024];
RTIME previous,pprevious,now,pnow,pmax;
long long tmp=0;
long i=0;
unsigned long start,stop,task_max;
static void task(int t)
{
	previous = rt_get_time_ns();
	while(1){
	rt_task_wait_period();
	start=get_cycles();
	
	memset(mem_spvm,0,sizeof(logo));
		memcpy(mem_spvm,logo,sizeof(logo));
		memset(mem_spvm,127,sizeof(logo));
		memcpy(mem_spvm,logo,sizeof(logo));
		memset(mem_spvm,0,sizeof(logo));
		memcpy(mem_spvm,logo,sizeof(logo));
		memset(mem_spvm,127,sizeof(logo));
		memcpy(mem_spvm,logo,sizeof(logo));
		memset(mem_spvm,0,sizeof(logo));
		memcpy(mem_spvm,logo,sizeof(logo));
		memset(mem_spvm,127,sizeof(logo));
		memcpy(mem_spvm,logo,sizeof(logo));
		memset(mem_spvm,0,sizeof(logo));
		memcpy(mem_spvm,logo,sizeof(logo));
		memset(mem_spvm,127,sizeof(logo));
		memcpy(mem_spvm,logo,sizeof(logo));
		memset(mem_spvm,0,sizeof(logo));
		memcpy(mem_spvm,logo,sizeof(logo));
		memset(mem_spvm,127,sizeof(logo));
		memcpy(mem_spvm,logo,sizeof(logo));
		memset(mem_spvm,0,sizeof(logo));
		memcpy(mem_spvm,logo,sizeof(logo));
		memset(mem_spvm,127,sizeof(logo));
		memcpy(mem_spvm,logo,sizeof(logo));
		memset(mem_spvm,127,sizeof(logo));
		memset(mem_spvm,0,sizeof(logo));
		memcpy(mem_spvm,logo,sizeof(logo));
		memset(mem_spvm,127,sizeof(logo));
		memcpy(mem_spvm,logo,sizeof(logo));
	
		pnow=rt_get_time_ns();
		stop=get_cycles();
		pmax=(pnow-previous);
		pmax=pmax<0?-pmax:pmax;
		if(task_max<(stop-start))
		task_max=stop-start;
		if(i++<10000)
		task_max=0;
		printk("otime: %ld.%06ld ms\n",(long)pmax/1000000,(long)pmax%1000000);//the max delay about 154 us
		printk("stime: %ld.%06ld ms\n",(long)task_max/1000000,(long)task_max%1000000);//the max delay about 154 us
		//previous=pnow;
		previous=previous+1000000;
	
	}
}



int init_module(void)
{
	RTIME tick_period, now;

	rt_set_periodic_mode();
        rt_task_init(&task, task, 0, STACK_SIZE, 0, 0, 0);


	tick_period = start_rt_timer(nano2count (TIMERTICKS));
	now = rt_get_time();
	rt_task_make_periodic(&tasks, now + tick_period, tick_period);
	return 0;
}

void cleanup_module(void)
{
	stop_rt_timer();
	rt_busy_sleep(10000000);

	rt_task_delete(&tasks[0]);
	rt_task_delete(&tasks[1]);
	
}



More information about the Xenomai mailing list