All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@domain.hid>
To: "Charlton, John" <john.charlton@domain.hid>
Cc: "xenomai@xenomai.org" <xenomai@xenomai.org>
Subject: Re: [Xenomai-help] mlockall error after calling mlockall()
Date: Thu, 25 Feb 2010 22:38:10 +0100	[thread overview]
Message-ID: <4B86EDC2.7010905@domain.hid> (raw)
In-Reply-To: <CF7FB0793253794F9F45991443E5FE2006483DE98C@us194mx002.tycoelectronics.net>

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

Charlton, John wrote:
> I have a xenomai application that runs without problems with xenomai-2.4.6.1/linux-2.6.27.7. When run under xenomai-2.5.1/linux-2.6.32.7 it fails with the warning: Xenomai: process memory not locked (missing mlockall?).  I verified that mlockall() is being called before any xenomai calls are made as follows with out error:
> 

I'm afraid that warning is misleading.

>   // lock process in memory for xenomai
>   int err = mlockall(MCL_CURRENT | MCL_FUTURE);
>   if (err)
>   {
>     fprintf(stderr, "TimerInit: mlockall failed to lock process into memory: %d\n", err);
>     exit(1);
>   }
>   fprintf(stdout, "TimerInit: Locked process memory\n");
> 
> The relevant message in dmesg output is:
> Xenomai: watchdog triggered -- signaling runaway thread 'timerloop-2166'

That is the actual error message, likely pointing to an application bug.
Try to attach gdb to your application, it will catch the signal and
allow to dump a stack trace that should give some hint what loops
endlessly here.

> 
> This occurs when creating a native xenomai task (created by CanFestival library) with the following code with no errors:
> 
> void StartTimerLoop(TimerCallback_t _init_callback)
> {
>   int ret = 0;
>   stop_timer = 0;
>   init_callback = _init_callback;
> 
>   char taskname[32];
>   snprintf(taskname, sizeof(taskname), "timerloop-%d", getpid());
> 
>   printf("Starting timerloop task %s\n", taskname);
>   /* create timerloop_task */
>   ret = rt_task_create(&timerloop_task, taskname, 0, 50, T_JOINABLE);
>   if (ret) {
>     printf("Failed to create timerloop_task, code %d\n",errno);
>     return;
>   }
> 
>   /* start timerloop_task */
>   ret = rt_task_start(&timerloop_task,&timerloop_task_proc,NULL);
>   if (ret) {
>     printf("Failed to start timerloop_task, code %u\n",errno);
>     goto error;
>   }
> 
>   return;
> 
> error:
>   cleanup_all();
> }
> 
> Debug output is displayed from the timerloop_task indicating that the task starts, but the mlockall warning is displayed before those outputs and the application already begins to shut down.

Way more interesting is how timerloop_task_proc looks like. Can you post
a complete test case? Besides that this would allow us to help you with
the runaway timerloop, I would like to understand why this wrong warning
is dumped in user space.

Jan


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

  parent reply	other threads:[~2010-02-25 21:38 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-25 21:12 [Xenomai-help] mlockall error after calling mlockall() Charlton, John
2010-02-25 21:25 ` Gilles Chanteperdrix
2010-02-25 21:38 ` Jan Kiszka [this message]
2010-02-25 22:42   ` Jan Kiszka
2010-02-25 22:54     ` Gilles Chanteperdrix
2010-02-25 23:01       ` Jan Kiszka
2010-02-26 16:47         ` Charlton, John
2010-02-26 16:53           ` Gilles Chanteperdrix
2010-02-26 17:15             ` Charlton, John
2010-03-01 15:52             ` Charlton, John
2010-03-01 20:30               ` Charlton, John
2010-03-01 20:33                 ` Jan Kiszka
2010-03-01 20:38                   ` Gilles Chanteperdrix
2010-03-01 20:43                     ` Jan Kiszka
2010-03-01 20:46                       ` Jan Kiszka
2010-03-01 20:56                         ` Gilles Chanteperdrix
2010-03-01 21:00                           ` Gilles Chanteperdrix
2010-03-01 21:02                             ` Jan Kiszka
2010-03-01 21:06                               ` Jan Kiszka
2010-03-01 21:01                           ` Jan Kiszka
2010-03-01 21:05                             ` Gilles Chanteperdrix
2010-03-01 21:21                               ` Jan Kiszka
2010-03-01 21:25                                 ` Jan Kiszka
2010-03-01 21:39                                   ` Jan Kiszka
2010-03-01 21:45                                     ` Gilles Chanteperdrix
2010-03-02  8:29                                       ` Jan Kiszka
2010-03-02  8:36                                         ` Jan Kiszka
2010-03-01 21:53                                   ` Charlton, John
2010-03-02 13:26                                     ` Charlton, John
2010-03-02 14:05                                       ` Jan Kiszka
2010-03-01 20:30               ` Jan Kiszka

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=4B86EDC2.7010905@domain.hid \
    --to=jan.kiszka@domain.hid \
    --cc=john.charlton@domain.hid \
    --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.