All of lore.kernel.org
 help / color / mirror / Atom feed
From: eric  <ericvic@163.com>
To: eric <ericvic@163.com>
Cc: huang.c.h@lynuc.cn, liu.h.f@lynuc.cn,
	"xenomai@xenomai.org" <xenomai@xenomai.org>
Subject: Re: [Xenomai] imx6q xenomai ipipe-3.0-imx6q
Date: Wed, 23 Apr 2014 12:40:28 +0800 (CST)	[thread overview]
Message-ID: <13c7e4f5.789a.1458ce28c87.Coremail.ericvic@163.com> (raw)
In-Reply-To: <410c61f.2e6bb.1457ebe7220.Coremail.ericvic@163.com>










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

>在 2014-04-20 17:23:19,"Gilles Chanteperdrix" <gilles.chanteperdrix@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]);
	
}


  reply	other threads:[~2014-04-23  4:40 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-18 10:28 [Xenomai] imx6q xenomai ipipe-3.0-imx6q 嵌入式工程师
2014-04-18 11:47 ` Gilles Chanteperdrix
2014-04-20  5:06   ` eric
2014-04-20  9:03     ` Gilles Chanteperdrix
2014-04-20  9:23       ` Gilles Chanteperdrix
2014-04-20 10:46         ` eric
2014-04-23  4:40           ` eric [this message]
2014-04-23 12:24             ` Gilles Chanteperdrix
  -- strict thread matches above, loose matches on Subject: below --
2014-04-17  8:13 嵌入式工程师
2014-04-17  7:58 嵌入式工程师
2014-04-17  7:43 嵌入式工程师
2014-04-17 11:42 ` Gilles Chanteperdrix
2014-04-01  2:35 嵌入式工程师
2014-04-01 10:49 ` Gilles Chanteperdrix
2014-04-02  0:53   ` 嵌入式工程师
2014-04-02  7:28     ` Gilles Chanteperdrix
2014-04-03 10:25       ` 嵌入式工程师
2014-03-26 11:36 嵌入式工程师
2014-03-26 11:50 ` Gilles Chanteperdrix
2014-03-26 13:31   ` 嵌入式工程师
2014-03-26 13:34     ` Gilles Chanteperdrix
2014-03-26 14:29       ` 嵌入式工程师
2014-03-26 23:09         ` Gilles Chanteperdrix
2014-03-27  1:41           ` 嵌入式工程师
2014-03-27  5:24           ` 嵌入式工程师
2014-03-27 12:27             ` Gilles Chanteperdrix
2014-03-28  5:02               ` 嵌入式工程师
2014-03-28 17:35                 ` Gilles Chanteperdrix
2014-03-29  5:54                   ` 嵌入式工程师
2014-03-28  8:19               ` 嵌入式工程师
2014-03-28 17:37                 ` Gilles Chanteperdrix
2014-03-28  9:08               ` 嵌入式工程师
2014-03-28 17:38                 ` Gilles Chanteperdrix
2014-03-29  6:21                   ` 嵌入式工程师
2014-03-29 13:51                     ` Gilles Chanteperdrix

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=13c7e4f5.789a.1458ce28c87.Coremail.ericvic@163.com \
    --to=ericvic@163.com \
    --cc=huang.c.h@lynuc.cn \
    --cc=liu.h.f@lynuc.cn \
    --cc=xenomai@xenomai.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.