All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-help] Page-fault, switch to secondary mode
@ 2010-08-25  9:12 Bharath Achuta Bhat
  2010-08-25  9:42 ` Gilles Chanteperdrix
  2010-08-25  9:53 ` Philippe Gerum
  0 siblings, 2 replies; 7+ messages in thread
From: Bharath Achuta Bhat @ 2010-08-25  9:12 UTC (permalink / raw)
  To: xenomai

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

Hello Xenomai experts,

I am running a xenomai-2.5.1 patched kernel (v 2.6.30.3) with ipipe
version 2.7-06.
The target is powerpc (MPC8533E).
My application is switching to the secondary mode (I guess because of a
page-fault) when ntohl() is called.
This is a libc function and I am wondering why only this function (ntohl())
is causing a page-fault.

Here is how the application looks like

main ()
{
...
...
/* Avoids memory swapping for this program */
mlockall(MCL_CURRENT | MCL_FUTURE);

......
......
/* signal handlers */
.....
.....
/* create communication pipes */
rt_pipe_create(&tPipe1, .....
rt_pipe_create(&tPipe2,.......

/* create RT tasks */
rt_task_create(&tTask1,.....
rt_task_create(&tTask2,......
...........
..........

/* start the RT tasks */
rt_task_start(&tTask1,.....
..............
..............

/* turn the current thread into RT function */
ret = rt_task_shadow(NULL, "RT main function", 1, T_SUSP);

....
....

}

One of the rt tasks created calls ntohl() and switches to secondary mode.
Is there a way to avoid it ?

-- 
Thanks and regards
Bharath

[-- Attachment #2: Type: text/html, Size: 2190 bytes --]

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

* Re: [Xenomai-help] Page-fault, switch to secondary mode
  2010-08-25  9:12 [Xenomai-help] Page-fault, switch to secondary mode Bharath Achuta Bhat
@ 2010-08-25  9:42 ` Gilles Chanteperdrix
  2010-08-25  9:53 ` Philippe Gerum
  1 sibling, 0 replies; 7+ messages in thread
From: Gilles Chanteperdrix @ 2010-08-25  9:42 UTC (permalink / raw)
  To: Bharath Achuta Bhat; +Cc: xenomai

Bharath Achuta Bhat wrote:
> Hello Xenomai experts,
> 
> I am running a xenomai-2.5.1 patched kernel (v 2.6.30.3) with ipipe
> version 2.7-06.
> The target is powerpc (MPC8533E).
> My application is switching to the secondary mode (I guess because of a
> page-fault) when ntohl() is called.
> This is a libc function and I am wondering why only this function (ntohl())
> is causing a page-fault.

Before anything, could you try xenomai 2.5.3 ?

-- 
					    Gilles.


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

* Re: [Xenomai-help] Page-fault, switch to secondary mode
  2010-08-25  9:12 [Xenomai-help] Page-fault, switch to secondary mode Bharath Achuta Bhat
  2010-08-25  9:42 ` Gilles Chanteperdrix
@ 2010-08-25  9:53 ` Philippe Gerum
  2010-08-25  9:59   ` Gilles Chanteperdrix
  2010-08-25 10:06   ` Bharath Achuta Bhat
  1 sibling, 2 replies; 7+ messages in thread
From: Philippe Gerum @ 2010-08-25  9:53 UTC (permalink / raw)
  To: Bharath Achuta Bhat; +Cc: xenomai

On Wed, 2010-08-25 at 11:12 +0200, Bharath Achuta Bhat wrote:
> Hello Xenomai experts,
> 
> 
> I am running a xenomai-2.5.1 patched kernel (v 2.6.30.3) with ipipe
> version 2.7-06.
> The target is powerpc (MPC8533E).
> My application is switching to the secondary mode (I guess because of
> a page-fault) when ntohl() is called.
> This is a libc function and I am wondering why only this function
> (ntohl()) is causing a page-fault.

What memory are you reading from / writing to in the statement involving
ntohl()? Is this plain RAM, or mapped I/O memory?

> 
> 
> Here is how the application looks like
> 
> 
> main ()
> {
> ...
> ...
> /* Avoids memory swapping for this program */
> mlockall(MCL_CURRENT | MCL_FUTURE);
> 
> 
> ......
> ......
> /* signal handlers */
> .....
> .....
> /* create communication pipes */
> rt_pipe_create(&tPipe1, .....
> rt_pipe_create(&tPipe2,.......
> 
> 
> /* create RT tasks */
> rt_task_create(&tTask1,.....
> rt_task_create(&tTask2,......
> ...........
> ..........
> 
> 
> /* start the RT tasks */
> rt_task_start(&tTask1,.....
> ..............
> ..............
> 
> 
> /* turn the current thread into RT function */
> ret = rt_task_shadow(NULL, "RT main function", 1, T_SUSP);
> 
> 
> ....
> ....
> 
> 
> }
> 
> 
> One of the rt tasks created calls ntohl() and switches to secondary
> mode.
> Is there a way to avoid it ? 
> 
> 
> -- 
> Thanks and regards
> Bharath
> 
> _______________________________________________
> Xenomai-help mailing list
> Xenomai-help@domain.hid
> https://mail.gna.org/listinfo/xenomai-help

-- 
Philippe.




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

* Re: [Xenomai-help] Page-fault, switch to secondary mode
  2010-08-25  9:53 ` Philippe Gerum
@ 2010-08-25  9:59   ` Gilles Chanteperdrix
  2010-08-25 10:06   ` Bharath Achuta Bhat
  1 sibling, 0 replies; 7+ messages in thread
From: Gilles Chanteperdrix @ 2010-08-25  9:59 UTC (permalink / raw)
  To: Philippe Gerum; +Cc: Bharath Achuta Bhat, xenomai

Philippe Gerum wrote:
> On Wed, 2010-08-25 at 11:12 +0200, Bharath Achuta Bhat wrote:
>> Hello Xenomai experts,
>>
>>
>> I am running a xenomai-2.5.1 patched kernel (v 2.6.30.3) with ipipe
>> version 2.7-06.
>> The target is powerpc (MPC8533E).
>> My application is switching to the secondary mode (I guess because of
>> a page-fault) when ntohl() is called.
>> This is a libc function and I am wondering why only this function
>> (ntohl()) is causing a page-fault.
> 
> What memory are you reading from / writing to in the statement involving
> ntohl()? Is this plain RAM, or mapped I/O memory?

And if it is plain RAM, is it correctly aligned?

-- 
					    Gilles.


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

* Re: [Xenomai-help] Page-fault, switch to secondary mode
  2010-08-25  9:53 ` Philippe Gerum
  2010-08-25  9:59   ` Gilles Chanteperdrix
@ 2010-08-25 10:06   ` Bharath Achuta Bhat
  2010-08-25 14:22     ` Philippe Gerum
  1 sibling, 1 reply; 7+ messages in thread
From: Bharath Achuta Bhat @ 2010-08-25 10:06 UTC (permalink / raw)
  To: Philippe Gerum; +Cc: xenomai

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

Hi  Philippe,
It is an mmap-ed I/O memory.

Regards
Bharath

On Wed, Aug 25, 2010 at 11:53 AM, Philippe Gerum <rpm@xenomai.org> wrote:

> On Wed, 2010-08-25 at 11:12 +0200, Bharath Achuta Bhat wrote:
> > Hello Xenomai experts,
> >
> >
> > I am running a xenomai-2.5.1 patched kernel (v 2.6.30.3) with ipipe
> > version 2.7-06.
> > The target is powerpc (MPC8533E).
> > My application is switching to the secondary mode (I guess because of
> > a page-fault) when ntohl() is called.
> > This is a libc function and I am wondering why only this function
> > (ntohl()) is causing a page-fault.
>
> What memory are you reading from / writing to in the statement involving
> ntohl()? Is this plain RAM, or mapped I/O memory?
>
> >
> >
> > Here is how the application looks like
> >
> >
> > main ()
> > {
> > ...
> > ...
> > /* Avoids memory swapping for this program */
> > mlockall(MCL_CURRENT | MCL_FUTURE);
> >
> >
> > ......
> > ......
> > /* signal handlers */
> > .....
> > .....
> > /* create communication pipes */
> > rt_pipe_create(&tPipe1, .....
> > rt_pipe_create(&tPipe2,.......
> >
> >
> > /* create RT tasks */
> > rt_task_create(&tTask1,.....
> > rt_task_create(&tTask2,......
> > ...........
> > ..........
> >
> >
> > /* start the RT tasks */
> > rt_task_start(&tTask1,.....
> > ..............
> > ..............
> >
> >
> > /* turn the current thread into RT function */
> > ret = rt_task_shadow(NULL, "RT main function", 1, T_SUSP);
> >
> >
> > ....
> > ....
> >
> >
> > }
> >
> >
> > One of the rt tasks created calls ntohl() and switches to secondary
> > mode.
> > Is there a way to avoid it ?
> >
> >
> > --
> > Thanks and regards
> > Bharath
> >
> > _______________________________________________
> > Xenomai-help mailing list
> > Xenomai-help@domain.hid
> > https://mail.gna.org/listinfo/xenomai-help
>
> --
> Philippe.
>
>
>


-- 
Thanks and regards
Bharath

[-- Attachment #2: Type: text/html, Size: 3275 bytes --]

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

* Re: [Xenomai-help] Page-fault, switch to secondary mode
  2010-08-25 10:06   ` Bharath Achuta Bhat
@ 2010-08-25 14:22     ` Philippe Gerum
  2010-08-26  7:20       ` Bharath Achuta Bhat
  0 siblings, 1 reply; 7+ messages in thread
From: Philippe Gerum @ 2010-08-25 14:22 UTC (permalink / raw)
  To: Bharath Achuta Bhat; +Cc: xenomai

On Wed, 2010-08-25 at 12:06 +0200, Bharath Achuta Bhat wrote:
> Hi  Philippe,
> It is an mmap-ed I/O memory.

This is a TLB miss which ends up in a heavyweight call to fill the linux
page table entry. Try to pre-fault the I/O memory region if possible,
reading some bytes within the same 4k page.

> 
> 
> Regards
> Bharath
> 
> On Wed, Aug 25, 2010 at 11:53 AM, Philippe Gerum <rpm@xenomai.org>
> wrote:
>         On Wed, 2010-08-25 at 11:12 +0200, Bharath Achuta Bhat wrote:
>         > Hello Xenomai experts,
>         >
>         >
>         > I am running a xenomai-2.5.1 patched kernel (v 2.6.30.3)
>         with ipipe
>         > version 2.7-06.
>         > The target is powerpc (MPC8533E).
>         > My application is switching to the secondary mode (I guess
>         because of
>         > a page-fault) when ntohl() is called.
>         > This is a libc function and I am wondering why only this
>         function
>         > (ntohl()) is causing a page-fault.
>         
>         
>         What memory are you reading from / writing to in the statement
>         involving
>         ntohl()? Is this plain RAM, or mapped I/O memory?
>         
>         >
>         >
>         > Here is how the application looks like
>         >
>         >
>         > main ()
>         > {
>         > ...
>         > ...
>         > /* Avoids memory swapping for this program */
>         > mlockall(MCL_CURRENT | MCL_FUTURE);
>         >
>         >
>         > ......
>         > ......
>         > /* signal handlers */
>         > .....
>         > .....
>         > /* create communication pipes */
>         > rt_pipe_create(&tPipe1, .....
>         > rt_pipe_create(&tPipe2,.......
>         >
>         >
>         > /* create RT tasks */
>         > rt_task_create(&tTask1,.....
>         > rt_task_create(&tTask2,......
>         > ...........
>         > ..........
>         >
>         >
>         > /* start the RT tasks */
>         > rt_task_start(&tTask1,.....
>         > ..............
>         > ..............
>         >
>         >
>         > /* turn the current thread into RT function */
>         > ret = rt_task_shadow(NULL, "RT main function", 1, T_SUSP);
>         >
>         >
>         > ....
>         > ....
>         >
>         >
>         > }
>         >
>         >
>         > One of the rt tasks created calls ntohl() and switches to
>         secondary
>         > mode.
>         > Is there a way to avoid it ?
>         >
>         >
>         > --
>         > Thanks and regards
>         > Bharath
>         >
>         
>         > _______________________________________________
>         > Xenomai-help mailing list
>         > Xenomai-help@domain.hid
>         > https://mail.gna.org/listinfo/xenomai-help
>         
>         --
>         Philippe.
>         
>         
> 
> 
> 
> -- 
> Thanks and regards
> Bharath
> 

-- 
Philippe.




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

* Re: [Xenomai-help] Page-fault, switch to secondary mode
  2010-08-25 14:22     ` Philippe Gerum
@ 2010-08-26  7:20       ` Bharath Achuta Bhat
  0 siblings, 0 replies; 7+ messages in thread
From: Bharath Achuta Bhat @ 2010-08-26  7:20 UTC (permalink / raw)
  To: Philippe Gerum; +Cc: xenomai

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

Hi Philippe,
Thank you for the suggestion. I will give it a try and let you know.

Regards
Bharath

On Wed, Aug 25, 2010 at 4:22 PM, Philippe Gerum <rpm@xenomai.org> wrote:

> On Wed, 2010-08-25 at 12:06 +0200, Bharath Achuta Bhat wrote:
> > Hi  Philippe,
> > It is an mmap-ed I/O memory.
>
> This is a TLB miss which ends up in a heavyweight call to fill the linux
> page table entry. Try to pre-fault the I/O memory region if possible,
> reading some bytes within the same 4k page.
>
> >
> >
> > Regards
> > Bharath
> >
> > On Wed, Aug 25, 2010 at 11:53 AM, Philippe Gerum <rpm@xenomai.org>
> > wrote:
> >         On Wed, 2010-08-25 at 11:12 +0200, Bharath Achuta Bhat wrote:
> >         > Hello Xenomai experts,
> >         >
> >         >
> >         > I am running a xenomai-2.5.1 patched kernel (v 2.6.30.3)
> >         with ipipe
> >         > version 2.7-06.
> >         > The target is powerpc (MPC8533E).
> >         > My application is switching to the secondary mode (I guess
> >         because of
> >         > a page-fault) when ntohl() is called.
> >         > This is a libc function and I am wondering why only this
> >         function
> >         > (ntohl()) is causing a page-fault.
> >
> >
> >         What memory are you reading from / writing to in the statement
> >         involving
> >         ntohl()? Is this plain RAM, or mapped I/O memory?
> >
> >         >
> >         >
> >         > Here is how the application looks like
> >         >
> >         >
> >         > main ()
> >         > {
> >         > ...
> >         > ...
> >         > /* Avoids memory swapping for this program */
> >         > mlockall(MCL_CURRENT | MCL_FUTURE);
> >         >
> >         >
> >         > ......
> >         > ......
> >         > /* signal handlers */
> >         > .....
> >         > .....
> >         > /* create communication pipes */
> >         > rt_pipe_create(&tPipe1, .....
> >         > rt_pipe_create(&tPipe2,.......
> >         >
> >         >
> >         > /* create RT tasks */
> >         > rt_task_create(&tTask1,.....
> >         > rt_task_create(&tTask2,......
> >         > ...........
> >         > ..........
> >         >
> >         >
> >         > /* start the RT tasks */
> >         > rt_task_start(&tTask1,.....
> >         > ..............
> >         > ..............
> >         >
> >         >
> >         > /* turn the current thread into RT function */
> >         > ret = rt_task_shadow(NULL, "RT main function", 1, T_SUSP);
> >         >
> >         >
> >         > ....
> >         > ....
> >         >
> >         >
> >         > }
> >         >
> >         >
> >         > One of the rt tasks created calls ntohl() and switches to
> >         secondary
> >         > mode.
> >         > Is there a way to avoid it ?
> >         >
> >         >
> >         > --
> >         > Thanks and regards
> >         > Bharath
> >         >
> >
> >         > _______________________________________________
> >         > Xenomai-help mailing list
> >         > Xenomai-help@domain.hid
> >         > https://mail.gna.org/listinfo/xenomai-help
> >
> >         --
> >         Philippe.
> >
> >
> >
> >
> >
> > --
> > Thanks and regards
> > Bharath
> >
>
> --
> Philippe.
>
>
>


-- 
Thanks and regards
Bharath

[-- Attachment #2: Type: text/html, Size: 4712 bytes --]

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

end of thread, other threads:[~2010-08-26  7:20 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-25  9:12 [Xenomai-help] Page-fault, switch to secondary mode Bharath Achuta Bhat
2010-08-25  9:42 ` Gilles Chanteperdrix
2010-08-25  9:53 ` Philippe Gerum
2010-08-25  9:59   ` Gilles Chanteperdrix
2010-08-25 10:06   ` Bharath Achuta Bhat
2010-08-25 14:22     ` Philippe Gerum
2010-08-26  7:20       ` Bharath Achuta Bhat

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.