rt_task_init_schmod() failure reason?

Paolo Mantegazza mantegazza at aero.polimi.it
Thu Nov 29 16:52:16 CET 2007


Aref Taidi wrote:
> When I run the system the first time I don't have this problem. But when I
> kill -9 the system and re-run, consistently same thread fails - does this
> suggest a memory leak problem within RTAI or my code?
> 

I would not think of a memory leak but some registration not cleaned. Do 
you rmmod the modules and reload them again to run a new instance?

> Is "size of global heap" the only memory configuration within RTAI?
> 

No, but the other one is not of interest if you are running in user 
space. From what above I think it might not be a memory size problem.

> Does reconfiguration mean I need to go through the whole process of RTAI
> reinstallation etc.?
> 

No, just re"make menuconfig" (or similar) and a recompilation.

> When I look at the process currently running when I switch on the PC I see
> two copies of rtai_up.ko and three copies of rtai_netrpc.ko as follows - is
> this normal? I only added one insmod for each to /etc/rc.d/rc.local though?
> 
> [root at localhost core]# ps -ef | grep rtai
> root  2318  1    0 16:06 ?      00:00:00 insmod
> /usr/realtime/modules/rtai_up.ko
> root  2319  2318 0 16:06 ?      00:00:00 insmod
> /usr/realtime/modules/rtai_up.ko
> root  2330  1    0 16:06 ?      00:00:00 insmod
> /usr/realtime/modules/rtai_netrpc.ko ThisNode=127.0.0.1
> root  2331  1    0 16:06 ?      00:00:00 insmod
> /usr/realtime/modules/rtai_netrpc.ko ThisNode=127.0.0.1
> root  2332  1    0 16:06 ?      00:00:00 insmod
> /usr/realtime/modules/rtai_netrpc.ko ThisNode=127.0.0.1
> root  2687  2639 0 16:16 pts/4  00:00:00 grep rtai
> 

I do not understand what above, I just know that Linux will not insmode 
a module already installed.

Paolo.
> Many thanks,
> Aref
> 
> 
> 
> -----Original Message-----
> From: Paolo Mantegazza [mailto:mantegazza at aero.polimi.it] 
> Sent: 29 November 2007 10:39
> To: Aref Taidi
> Cc: 'Paolo Mantegazza'; rtai at rtai.org
> Subject: Re: rt_task_init_schmod() failure reason?
> 
> Aref Taidi wrote:
> 
>>Hello Paolo,
>>
>>I am using RTAI 3.3 FC5 with vanilla kernel 2.6.15.6. I am initially
>>registering 14 threads, but need to add 13 more, and some more later -
> 
> they
> 
>>are all in user space. Some of these communicate with and FLTK Linux
> 
> process
> 
>>partially through share memory created through rt_shm_alloc(). I have used
>>the default number, didn't know it is configurable. For creation of each
>>task I am making the following call sequence for every one of them:
>>
>>pthread_t      taskN;
>>unsigned long  taskN_id;
>>RT_TASK       *rtai_taskN;
>>
>>pthread_create( &taskN, NULL, (void *) taskN_entryPoint, NULL)
>>taskN_id = nam2num( "TASK01" );
>>pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
>>rtai_taskN = rt_task_init_schmod(taskN_id, taskNprio, 2048, 1024,
>>SCHED_FIFO, 0xff);
>>mlockall(MCL_CURRENT | MCL_FUTURE);
>>rt_grow_and_lock_stack(60000);
>>rt_make_hard_real_time();
>>rt_task_use_fpu(rtai_ taskN, 1);
>>myTaskMBX = rt_typed_mbx_init(nam2num("MBXNAM"), 2000, FIFO_Q);
>>
>>Many thanks,
>>
> 
> 
> Rt_task_init can return NULL if:
> - there is no more memory to allocate in real time within, the RTAI 
> available heap, what a task needs; for that you should increase the 
> related heap size at RTAI configuration
> - there is a conflicting name identifier; you should find it
> - there is no more space in the table of the registered objects in user 
> space, not only tasks but anything RTAI create/opens (sems, maiboxes, 
> etc. etc.); for that you should increase the related size at RTAI 
> configuration.
> 
> Paolo
> 
> 
>>Aref
>>
>>-----Original Message-----
>>From: Paolo Mantegazza [mailto:mante at aero.polimi.it] 
>>Sent: 29 November 2007 00:28
>>To: Aref Taidi
>>Cc: rtai at rtai.org
>>Subject: Re: rt_task_init_schmod() failure reason?
>>
>>Aref Taidi writes: 
>>
>>
>>
>>>Hello everyone, 
>>>
>>>I am having difficulty finding out why a call to rt_task_init_schmod()
>>
>>fails
>>
>>
>>>and returns NULL.  
>>>
>>>I have many user space hard real-time threads, but one of them fails to
>>>initialise when I make a call to rt_task_init_schmod(). The threads are of
>>>various priority order, call to the above function to initialise each are
>>>made not necessarily in their priority order, but always in the same
>>>sequence. All have unique 6 letter name, there is plenty of memory. But
>>>always same thread initialisation failed. I changed the name of that
>>
>>thread,
>>
>>
>>>it caused another one to fail! 
>>>
>>>Is there a technique to find out exactly why rt_task_init_schmod() has
>>>returned NULL? 
>>>
>>>Many thanks in advance, 
>>>
>>
>>
>>What RTAI version? How many RTAI objects are you registering? Have you 
>>configured the related number or used the default? 
>>
>>Paolo.
>>
>>
>>>Aref 
>>>
>>>
>>>_______________________________________________
>>>RTAI mailing list
>>>RTAI at rtai.org
>>>https://mail.rtai.org/cgi-bin/mailman/listinfo/rtai
>>
>> 
>>
>>
>>--
>>This email has been verified as Virus free
>>Virus Protection and more available at http://www.plus.net
>>
>>
> 
> 
> 
> 
> --
> This email has been verified as Virus free
> Virus Protection and more available at http://www.plus.net
> 
> 






More information about the Rtai mailing list