All of lore.kernel.org
 help / color / mirror / Atom feed
From: Philippe Gerum <rpm@xenomai.org>
To: alex alex <duch.alexandre@gmail.com>
Cc: Xenomai <xenomai@xenomai.org>
Subject: Re: [Xenomai] [QUESTION] thread creation and hook function
Date: Mon, 15 Apr 2013 15:08:47 +0200	[thread overview]
Message-ID: <516BFBDF.1060109@xenomai.org> (raw)
In-Reply-To: <516BFB28.9050409@xenomai.org>

On 04/15/2013 03:05 PM, Philippe Gerum wrote:
> On 04/15/2013 02:36 PM, Philippe Gerum wrote:
>> 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.
>>
>
> Note: the _get_time() routine in your driver looks broken.

No I'm wrong, it's probably not, assuming the first shot is ok to return 
a close-to-null figure.

  In addition,
> calling rtdm_printk services from the hook is strongly discouraged
> unless you don't care for timings.
>


-- 
Philippe.


  reply	other threads:[~2013-04-15 13:08 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-13 16:58 [Xenomai] [QUESTION] thread creation and hook function alex alex
2013-04-13 17:41 ` Gilles Chanteperdrix
2013-04-13 18:20   ` alex alex
2013-04-13 20:55     ` Gilles Chanteperdrix
2013-04-13 22:41       ` alex alex
2013-04-13 23:05         ` Gilles Chanteperdrix
2013-04-13 23:07           ` Gilles Chanteperdrix
2013-04-13 23:37         ` Gilles Chanteperdrix
2013-04-15  8:47           ` alex alex
2013-04-15  9:14             ` Philippe Gerum
2013-04-15 10:25               ` alex alex
2013-04-15 12:36                 ` Philippe Gerum
2013-04-15 13:05                   ` Philippe Gerum
2013-04-15 13:08                     ` Philippe Gerum [this message]
2013-04-15 13:43                   ` alex alex
2013-04-15 13:48                     ` alex alex
2013-04-15 14:06                     ` Philippe Gerum
     [not found]                       ` <CAPpP=rMsqp5SOfq8_dNUOZ5UFugNa-YwsLyT5WT4d01_UTWRMA@mail.gmail.com>
2013-04-15 14:27                         ` Philippe Gerum
2013-04-15 19:45                           ` Gilles Chanteperdrix
2013-04-16  7:03                             ` Philippe Gerum
2013-04-15 19:43             ` Gilles Chanteperdrix

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=516BFBDF.1060109@xenomai.org \
    --to=rpm@xenomai.org \
    --cc=duch.alexandre@gmail.com \
    --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.