All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-help] process memory not locked
@ 2007-03-06 17:49 Saiful Khan
  2007-03-06 17:56 ` Gilles Chanteperdrix
  0 siblings, 1 reply; 7+ messages in thread
From: Saiful Khan @ 2007-03-06 17:49 UTC (permalink / raw)
  To: xenomai

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

Hello,

I have ported my normal GNU/Linux (Posix) application in Xenomai, and I have
used Xenomai POSIX skin to do the same. In my application main() function is
spawning a thread using
pthread_attr_init()
pthread_attr_setdetachstate()
pthread_create()

But as soon as it spawn the thread the following message comes
*Xenomai*: process *memory not locked* (missing mlockall?), and I do not get
any message from that thread.

I have already  locked the paging  in main() as well as in the spawned
thread using  mlockall(MCL_CURRENT | MCL_FUTURE). After google search I
didnt found any solution to solve my problem.

1. Please tell me the reason? Is there anything I am doing wrong while
spawning thread?
2. What to do so that the thread also run in highest priority?

Thanks and regards
Saiful

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

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

* Re: [Xenomai-help] process memory not locked
  2007-03-06 17:49 [Xenomai-help] process memory not locked Saiful Khan
@ 2007-03-06 17:56 ` Gilles Chanteperdrix
  2007-03-06 18:04   ` Gilles Chanteperdrix
  0 siblings, 1 reply; 7+ messages in thread
From: Gilles Chanteperdrix @ 2007-03-06 17:56 UTC (permalink / raw)
  To: Saiful Khan; +Cc: xenomai

Saiful Khan wrote:
> Hello,
> 
> I have ported my normal GNU/Linux (Posix) application in Xenomai, and I
> have used Xenomai POSIX skin to do the same. In my application main()
> function is spawning a thread using
> pthread_attr_init()
> pthread_attr_setdetachstate()
> pthread_create()
> 
> But as soon as it spawn the thread the following message comes
> *Xenomai*: process *memory not locked* (missing mlockall?), and I do not
> get any message from that thread.
> 
> I have already  locked the paging  in main() as well as in the spawned
> thread using  mlockall(MCL_CURRENT | MCL_FUTURE). After google search I
> didnt found any solution to solve my problem.
> 
> 1. Please tell me the reason? Is there anything I am doing wrong while
> spawning thread?

Are you sure mlockall suceeded ? Check its return value to know.

> 2. What to do so that the thread also run in highest priority?

Use pthread_attr_setschedparam, or pthread_setschedparam.

-- 
                                                 Gilles Chanteperdrix


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

* Re: [Xenomai-help] process memory not locked
  2007-03-06 17:56 ` Gilles Chanteperdrix
@ 2007-03-06 18:04   ` Gilles Chanteperdrix
  2007-03-06 18:59     ` Saiful Khan
  0 siblings, 1 reply; 7+ messages in thread
From: Gilles Chanteperdrix @ 2007-03-06 18:04 UTC (permalink / raw)
  To: Saiful Khan; +Cc: xenomai

Gilles Chanteperdrix wrote:
>>2. What to do so that the thread also run in highest priority?
> 
> 
> Use pthread_attr_setschedparam, or pthread_setschedparam.
> 

Start here and follow the links:

http://www.xenomai.org/documentation/branches/v2.3.x/html/api/group__posix__sched.html

-- 
                                                 Gilles Chanteperdrix


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

* Re: [Xenomai-help] process memory not locked
  2007-03-06 18:04   ` Gilles Chanteperdrix
@ 2007-03-06 18:59     ` Saiful Khan
  2007-03-06 19:41       ` Gilles Chanteperdrix
  2007-03-06 20:55       ` Dmitry Adamushko
  0 siblings, 2 replies; 7+ messages in thread
From: Saiful Khan @ 2007-03-06 18:59 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: xenomai

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

Hello,

First of all thank you a lot. For the last several days I am getting lots of
help from you. As well as I achived some positive results also. By the way
my observation now is -

mlockall is successfull
pthread_attr_init() - is successfull
pthread_attr_setdetachstate() - successfull
Here I am getting the message "Xenomai - process memory not locked (missing
mlockall?)" and its stuck.
pthread_create()  - this is returning nothing not success(0) nor failure.

What can be the possible reason?

Thanks and regards
Saiful




On 3/6/07, Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org> wrote:
>
> Gilles Chanteperdrix wrote:
> >>2. What to do so that the thread also run in highest priority?
> >
> >
> > Use pthread_attr_setschedparam, or pthread_setschedparam.
> >
>
> Start here and follow the links:
>
>
> http://www.xenomai.org/documentation/branches/v2.3.x/html/api/group__posix__sched.html
>
> --
>                                                  Gilles Chanteperdrix
>

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

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

* Re: [Xenomai-help] process memory not locked
  2007-03-06 18:59     ` Saiful Khan
@ 2007-03-06 19:41       ` Gilles Chanteperdrix
       [not found]         ` <38b44d590703102107l159cda49rdf7ad7c1dc435b3@domain.hid>
  2007-03-06 20:55       ` Dmitry Adamushko
  1 sibling, 1 reply; 7+ messages in thread
From: Gilles Chanteperdrix @ 2007-03-06 19:41 UTC (permalink / raw)
  To: Saiful Khan; +Cc: xenomai

Saiful Khan wrote:
 > Hello,
 > 
 > First of all thank you a lot. For the last several days I am getting lots of
 > help from you. As well as I achived some positive results also. By the way
 > my observation now is -
 > 
 > mlockall is successfull
 > pthread_attr_init() - is successfull
 > pthread_attr_setdetachstate() - successfull
 > Here I am getting the message "Xenomai - process memory not locked (missing
 > mlockall?)" and its stuck.
 > pthread_create()  - this is returning nothing not success(0) nor failure.
 > 
 > What can be the possible reason?

Maybe a bug, could you tell us what version of the Adeos patch and of
Xenomai you are using, and send a short program that exhibits this
behaviour ?

-- 


					    Gilles Chanteperdrix.


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

* Re: [Xenomai-help] process memory not locked
  2007-03-06 18:59     ` Saiful Khan
  2007-03-06 19:41       ` Gilles Chanteperdrix
@ 2007-03-06 20:55       ` Dmitry Adamushko
  1 sibling, 0 replies; 7+ messages in thread
From: Dmitry Adamushko @ 2007-03-06 20:55 UTC (permalink / raw)
  To: Saiful Khan; +Cc: Xenomai help

On 06/03/07, Saiful Khan <saiful.etc@domain.hid> wrote:
> Hello,
>
> First of all thank you a lot. For the last several days I am getting lots of
> help from you. As well as I achived some positive results also. By the way
> my observation now is -
>
> mlockall is successfull
>  pthread_attr_init() - is successfull
> pthread_attr_setdetachstate() - successfull
> Here I am getting the message "Xenomai - process memory not locked (missing
> mlockall?) " and its stuck.

Do I understand ("stuck") right that the following pthread_create() is
never executed?

> pthread_create()  - this is returning nothing not success(0) nor failure.

Could you insert additional debugging lines in your code as shown
below and let us know of the outcome?

// btw does "attr" in your case allocated on stack?

pthread_attr_init(&attr);
printf("step 1\n");

memset(&attr, 0, sizeof(pthread_attr_t)); // <--- touch the "attr" here
printf("step 2\n")

pthread_attr_setdetachstate(&attr, ...);

printf("step 3\n");

pthread_create(.., &attr, ...);

So what's the last "step" printed?


-- 
Best regards,
Dmitry Adamushko


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

* Re: [Xenomai-help] process memory not locked
       [not found]         ` <38b44d590703102107l159cda49rdf7ad7c1dc435b3@domain.hid>
@ 2007-03-11 18:53           ` Gilles Chanteperdrix
  0 siblings, 0 replies; 7+ messages in thread
From: Gilles Chanteperdrix @ 2007-03-11 18:53 UTC (permalink / raw)
  To: Saiful Khan

Saiful Khan wrote:
 > Sorry for late reply. Actualy what I saw that in that application one
 > fork() is there, so basically child process is trying to create the thread
 > and fails. I removed the fork() and spawned the thread from the main and
 > succeed. But the application is so large that, if i remove the fork() then I
 > need to change the entire architecture of the application, another big
 > task... Can u please tell me what is the alternative of fork()?
 > 
 > Thanks and regards
 > Saiful

To quote mlockall manual page: "Memory  locks  are not inherited by a
child created via fork(2) and are automatically removed (unlocked)
during an execve(2) or when  the  process terminates."

So, a forked child has to call mlockall to lock its memory.

Beware, however, that calling fork in a real-time application raises
some issues which have been solved recently: only trunk and latest
branch v2.3.x contain the fixes needed to safely call fork in a
real-time application.

-- 


					    Gilles Chanteperdrix.


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

end of thread, other threads:[~2007-03-11 18:53 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-06 17:49 [Xenomai-help] process memory not locked Saiful Khan
2007-03-06 17:56 ` Gilles Chanteperdrix
2007-03-06 18:04   ` Gilles Chanteperdrix
2007-03-06 18:59     ` Saiful Khan
2007-03-06 19:41       ` Gilles Chanteperdrix
     [not found]         ` <38b44d590703102107l159cda49rdf7ad7c1dc435b3@domain.hid>
2007-03-11 18:53           ` Gilles Chanteperdrix
2007-03-06 20:55       ` Dmitry Adamushko

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.