From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <516C094F.2050107@xenomai.org> Date: Mon, 15 Apr 2013 16:06:07 +0200 From: Philippe Gerum MIME-Version: 1.0 References: <516998B7.9090901@xenomai.org> <5169C63B.1070406@xenomai.org> <5169EC2C.4000101@xenomai.org> <516BC4DF.3030302@xenomai.org> <516BF43D.7070708@xenomai.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Xenomai] [QUESTION] thread creation and hook function List-Id: Discussions about the Xenomai project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: alex alex Cc: Xenomai On 04/15/2013 03:43 PM, alex alex wrote: > Infact, given that the posix skin can not create named task in user space, > the default name which is assigned is the source file name, in this case hook > (hook.c) pthread_set_name_np > > I add the changes to have the same ouput and I use xeno-config flag. > > > > > 2013/4/15 Philippe Gerum > >> On 04/15/2013 12:25 PM, alex alex wrote: >> >>> linux kernel : 3.2.21 >>> xenomai version : 2.6.2.1 >>> arch: x86 >>> >>> Thank, I add your code and now I have : >>> >>> case 1 : ( without nanosleep(0) ) >>> >>> 6138.151187] TRD: 394830ns - NOM "ROOT/0" - CPU 0 - RT:1 - linux >>> [ 6138.159924] TRD: 9127501ns - NOM "hook" - CPU 0 - RT:0 - shadow >>> [ 6138.159953] TRD: 9163835ns - NOM "ROOT/0" - CPU 0 - RT:1 - linux >>> [ 6138.160014] TRD: 370242723ns - NOM "ROOT/0" - CPU 0 - RT:1 - linux >>> [ 6138.520008] TRD: 370429306ns - NOM "ROOT/0" - CPU 0 - RT:1 - linux >>> [ 6139.521009] TRD: 1370433173ns - NOM "hook" - CPU 0 - RT:1 - user-space >>> shadow in real-time mode >>> [ 6139.521014] TRD: 1370446122ns - NOM "ROOT/0" - CPU 0 - RT:1 - linux >>> [ 6139.521705] TRD: 1371147808ns - NOM "ROOT/0" - CPU 0 - RT:1 - linux >>> [ 6139.521723] TRD: 1371168314ns - NOM "ROOT/0" - CPU 0 - RT:1 - linux >>> >>> case 2 : ( with nanosleep(0) before the loop ) >>> >>> [ 6144.996779] TRD: 382277ns - NOM "ROOT/0" - CPU 0 - RT:1 - linux >>> [ 6145.005024] TRD: 8625148ns - NOM "hook" - CPU 0 - RT:0 - shadow >>> [ 6145.005054] TRD: 8659990ns - NOM "ROOT/0" - CPU 0 - RT:1 - linux >>> [ 6145.008013] TRD: 8730535ns - NOM "ROOT/0" - CPU 0 - RT:1 - linux >>> [ 6145.008013] TRD: 8734846ns - NOM "hook" - CPU 0 - RT:1 - user-space >>> shadow in real-time mode >>> [ 6145.008013] TRD: 367409427ns - NOM "ROOT/0" - CPU 0 - RT:1 - linux >>> [ 6145.363763] TRD: 367634768ns - NOM "ROOT/0" - CPU 0 - RT:1 - linux >>> [ 6146.363810] TRD: 1367637465ns - NOM "hook" - CPU 0 - RT:1 - user-space >>> shadow in real-time mode >>> [ 6146.363815] TRD: 1367646922ns - NOM "ROOT/0" - CPU 0 - RT:1 - linux >>> [ 6146.365055] TRD: 1368896836ns - NOM "ROOT/0" - CPU 0 - RT:1 - linux >>> [ 6146.365073] TRD: 1368916343ns - NOM "ROOT/0" - CPU 0 - RT:1 - linux >>> >>> If I follow these outputs, this means that the loop is made by a linux >>> task >>> and if I add a nanosleep just before, the loop is done by the xenomai >>> task. >>> Moreover, "hook " switch in primary mode only when it is destroyed unless >>> we >>> force a primary switch with nanosleep(0) before the loop. >>> >>> Is a xenomai thread shouldn't start in primary mode >>> >> >> It certainly does. >> >> >> or maybe it wait for a >> >>> rt service to switch in primary mode? >>> >>> >> I can't give you any information. I downloaded your code and can't see any >> "hook" task. There is a "hook" driver, a "tr_sleep" task, but nothing else. >> Besides, your Makefile should use xeno-config for getting the proper build >> flags. Handcrafting this is the fastest path to hell with the POSIX skin. >> >> Until I can make sense of the output you mention looking at the actual >> code, I won't be able to help. >> >> /proc/xenomai/sched and /proc/xenomai/stat may help to determine who is >> running, in which mode. >> >> -- >> Philippe. >> > -------------- next part -------------- > A non-text attachment was scrubbed... > Name: test_switch.tar.bz2 > Type: application/x-bzip2 > Size: 3504 bytes > Desc: not available > URL: > _______________________________________________ > Xenomai mailing list > Xenomai@xenomai.org > http://www.xenomai.org/mailman/listinfo/xenomai > -- Philippe.