[Rtai] Behavior in the kernel space - rtai 3.3
Djamel Louar
djamel.louar at inria.fr
Thu May 22 13:43:05 CEST 2008
Paolo Mantegazza wrote:
> Djamel Louar wrote:
>>
>>
>> Paolo Mantegazza wrote:
>>
>>> Djamel Louar wrote:
>>>
>>>> Suessmilch Bernd wrote:
>>>>
>>>>>
>>>>>
>>>>>
>>>>>> -----Original Message-----
>>>>>> From: rtai-bounces at rtai.org [mailto:rtai-bounces at rtai.org]On
>>>>>> Behalf Of
>>>>>> Suessmilch Bernd
>>>>>> Sent: Mittwoch, 21. Mai 2008 15:13
>>>>>> To: Djamel Louar
>>>>>> Cc: rtai at rtai.org
>>>>>> Subject: Re: [Rtai] Behavior in the kernel space - rtai 3.3
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>> -----Original Message-----
>>>>>>> From: rtai-bounces at rtai.org
>>>>>>
>>>>>>
>>>>>> [mailto:rtai-bounces at rtai.org]On Behalf Of
>>>>>>
>>>>>>
>>>>>>> Djamel Louar
>>>>>>> Sent: Mittwoch, 21. Mai 2008 14:24
>>>>>>> To: rtai at rtai.org
>>>>>>> Subject: [Rtai] Behavior in the kernel space - rtai 3.3
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Hi all,
>>>>>>>
>>>>>>> I used an ancient program which works with rtai 24 (two years
>>>>>>> ago) with a more recent version : rtai 3.3.
>>>>>>> This is a very basic program for beginners.
>>>>>>> It's seem a different behavior of the execution between the
>>>>>>> version 24 of rtai and the 3.3ver.
>>>>>>> In fact with rtai 3.3, i can stop the program before its end
>>>>>>> and i don't think that it is correct for real time systems.
>>>>>>>
>>>>>>
>>>>>>
>>>>>> Compared to RTAI-24, RTAI-3.3 has an improved signal handling. In
>>>>>> 3.3
>>>>>> signals are proper delivered even to RT-tasks. Due to this
>>>>>> improved signal
>>>>>> handling you can interrupt or terminate RT-tasks the same way as
>>>>>> ordinary Linux
>>>>>> tasks.
>>>>>>
>>>>>> If you don't want a signal to affect your RT-task you have to
>>>>>> provide a proper
>>>>>> setting of the task's signal mask.
>>>>>>
>>>>>
>>>>>
>>>>> Sorry, I did not notice that you are in KS. Sometimes it is
>>>>> better to finish reading first... ;-)
>>>>> What is said above relates only to US, of course.
>>>>>
>>>>
>>>>
>>>>
>>>> So, in KS, it is not possible to interrupt a module until its end ?
>>>> I would like to know if it is normal that my module can be
>>>> interrupted before its end ?
>>>>
>>>
>>> What you mean for interrupting your module?
>>>
>>> Paolo.
>>>
>> Sorry for my english !! - I resume :
>> After compiling, i obtain the task_rt.ko file (that i call module).
>> Then i make an "insmod task_rt.ko".
>> At this moment, the modules loaded are :
>> task_rt.ko,rtai_up, rtai_hal
>> In my comprehension, once the module task_rt loaded, the task
>> called hello_world ends after 10 periods (10 seconds).
>> But i can make a "rmmod task_rt.ko" before the 10 periods of the task
>> "hello_world". Is it normal ? I though that we can't do anything
>> until the end of the "hello_world" task also means until the end of
>> the "task_rt" module.
>> This is what i mean by "interrupting my module (while its execution)"
>>
>> I hope that i was clear - Thanks.
>>
>
> There was no english problem. Your answer conferm that it is you that
> remove the module, as I thought. The fact the the task in the module
> is running in real time has nothing to do with using rmmod. In my mind
> at least it has been so always, 24 and 3.3 are alike in that respect
> because it is Linux that has not changed for that. With Linux 2.6.xx
> there is even an option to force module unloading anyhow. To preven
> that I think you can increase the module usage count in your task
> decreasing it when the task finishes.
>
> Paolo.
>
OK, now I understand. I'm going to do what you said.
Thanks a lot
>>>> Djamel
>>>>
>>>>>
>>>>>
>>>>>
>>>>>>> Moroever, i remember that with rtai 24, the system "freezes"
>>>>>>> during an execution of an RTAI application in the kernel space.
>>>>>>>
>>>>>>
>>>>>>
>>>>>> Even with RTAI-24 the system only freezes, when your RT-task
>>>>>> consumes
>>>>>> too much CPU time.
>>>>>>
>>>>>> Best regards,
>>>>>> Bernd
>>>>>>
>>>>>>
>>>>>>> So i think that i do a mistake, could someone tell me where i'm
>>>>>>> wrong ?
>>>>>>>
>>>>>>> Thanks Djamel.
>>>>>>>
>>>>>>> My code: task.c
>>>>>>>
>>>>>>> #include <linux/module.h>
>>>>>>> #include <rtai.h>
>>>>>>> #include <rtai_sched.h>
>>>>>>> #define NUMERO 1
>>>>>>> #define PRIORITE 1
>>>>>>> #define STACK_SIZE 2000
>>>>>>> #define PERIODE 1000000000 // 1 s
>>>>>>> #define TICK_PERIOD 1000000 // 1 ms
>>>>>>> #define N_BOUCLE 10
>>>>>>>
>>>>>>> static RT_TASK hello_world;
>>>>>>> int ierr=0;
>>>>>>> RTIME now;
>>>>>>>
>>>>>>> static void fun(long arg)
>>>>>>> {
>>>>>>> int boucle = N_BOUCLE ;
>>>>>>> while(boucle--){
>>>>>>> rt_task_wait_period();
>>>>>>> }
>>>>>>> }
>>>>>>> int init_module(void)
>>>>>>> {
>>>>>>> rt_task_init(&hello_world, fun, 0, 4000, 0, 0, 0);
>>>>>>> rt_set_oneshot_mode();
>>>>>>> start_rt_timer(nano2count(1000));
>>>>>>> now=rt_get_time()+TICK_PERIOD;
>>>>>>> rt_task_make_periodic(&hello_world,now,nano2count(PERIODE));
>>>>>>> return 0;
>>>>>>> }
>>>>>>> void cleanup_module(void) {
>>>>>>> rt_task_delete(&hello_world);
>>>>>>> stop_rt_timer();
>>>>>>> }
>>>>>>>
>>>>>>> Makefiles:
>>>>>>> GNUmakefile:
>>>>>>> ----------------------------------------------------------------
>>>>>>> prefix := $(shell rtai-config --prefix)
>>>>>>> ifeq ($(prefix),)
>>>>>>> $(error Please add <rtai-install>/bin to your PATH variable)
>>>>>>> endif
>>>>>>> CC = $(shell rtai-config --cc)
>>>>>>> ifneq ($(findstring 2.6.,$(shell rtai-config --linux-version
>>>>>>> 2>/dev/null)),)
>>>>>>> LINUX_DIR = $(shell rtai-config --linux-dir)
>>>>>>> all:
>>>>>>> $(MAKE) -C $(LINUX_DIR) CC=$(CC) SUBDIRS=$$PWD V=$(V) modules
>>>>>>> clean:
>>>>>>> $(RM) $(LINUX_DIR)/.tmp_versions/*_rt.mod *.o *.ko
>>>>>>
>>>>>>
>>>>>> *.mod.c .*.cmd
>>>>>>
>>>>>>
>>>>>>> else
>>>>>>> MODULE_CFLAGS = $(shell rtai-config --module-cflags)
>>>>>>> all: task_rt.o
>>>>>>> task_rt.o: task.c
>>>>>>> $(CC) $(MODULE_CFLAGS) -c $<
>>>>>>> clean:
>>>>>>> rm -f *.o
>>>>>>> endif
>>>>>>> .PHONY: clean
>>>>>>> --------------------------------------------------------------
>>>>>>> -------------
>>>>>>> makefile:
>>>>>>>
>>>>>>> EXTRA_CFLAGS += $(shell rtai-config --module-cxxflags)
>>>>>>> obj-m += task_rt.o
>>>>>>> task_rt-objs := task.o
>>>>>>> --------------------------------------------------------------
>>>>>>> -------------------
>>>>>>> _______________________________________________
>>>>>>> Rtai mailing list
>>>>>>> Rtai at rtai.org
>>>>>>> https://mail.rtai.org/cgi-bin/mailman/listinfo/rtai
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> Rtai mailing list
>>>>>> Rtai at rtai.org
>>>>>> https://mail.rtai.org/cgi-bin/mailman/listinfo/rtai
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>
>>
>
>
>
--
_________________________________________________________________________
Djamel Louar,
INRIA, Domaine de Voluceau, Rocquencourt Phone: (33) 1 39 63 53 00
BP 105 Fax: (33) 1 39 63 51 93
78153 LE CHESNAY CEDEX, FRANCE Email: djamel.louar at inria.fr
_________________________________________________________________________
More information about the Rtai
mailing list