All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Smarzly <smarzlys@gmail.com>
To: xenomai@xenomai.org, "Steve M. Robbins" <steve@sumost.ca>
Subject: Re: [Xenomai] POSIX application running under xenomai -- what do wrapped functions do?
Date: Fri, 25 Jul 2014 17:17:10 +0200	[thread overview]
Message-ID: <53D274F6.30005@gmail.com> (raw)
In-Reply-To: <1927199.3ixLvlnsCr@riemann>


Am 25.07.2014 16:54, schrieb Steve M. Robbins:
> On July 23, 2014 10:37:35 PM Philippe Gerum wrote:
>
>> RTIPC/xddp and the Message pipe services are based on the very same code
>> in the Xenomai core, it's only a matter of differing interfaces. Over
>> 2.5.6, I would go for the pipes, since the xddp driver in that release
>> might lack a couple of fixes which were merged into 2.6.
> OK, we are now looking a bit more closely at the 2.5 Message Pipe docs and my colleague noticed a small quirk.
>
> For rt_pipe_read(), the doc [1] says:
>
> 		Environments:
>
> 		This service can be called from:
>
> 		 *    Kernel module initialization/cleanup code
> 		 *    Interrupt service routine only if timeout is equal to TM_NONBLOCK.
>
> 		 *    Kernel-based task
> 		 *    User-space task (switches to primary mode)
>
> So a literal reading of the last two bullet points suggest that a call from kernel-based task never switches to primary mode while a call from the user-space task always does.  Naively that seems surprising.  Is it accurate?

As far as I know there is not a mode switch for RT kernel code at all. 
When running a kernel module, you do not have to invoke any syscalls as 
the user space occasionally has to do. You are already in kernel space. 
Thus, it should be primary mode by default.
This is what I am thinking. Maybe one of the officials can correct this 
information.

> Secondly, for a user-space task: will it mode switch if there is data available?  If we use TM_NONBLOCK in a user space task, can we avoid the mode switch?

The task will enter primary mode as soon as you are calling this 
function independent of the flag set to TM_NONBLOCK or not. Otherwise it 
could not test whether data is available at all. And by the way: You 
want to have a task to stay in primary mode as best as you can. 
Otherwise, you do not have any real-time guarantee anymore. So, if the 
task is already in primary mode, there won't be any mode switch.

> Finally, the function rt_pipe_receive() is pretty similar to rt_pipe_read() so much so that I would guess one is implemented using the other.  Thus I'm a bit surprised that its "Environments" documentation [2] differs from the previous in that it doesn't list "User-space task".  Is that accurate?

I do not know, but I think, it should work for both. At least it does 
for RT queues.

>
> [1] http://www.xenomai.org/documentation/xenomai-2.5/html/api/group__pipe.html#g62cb64807c2c843f8e8eebb2dc3a7d4e
> [2] http://www.xenomai.org/documentation/xenomai-2.5/html/api/group__pipe.html#g731e5ef18007dcd58a9346bea66abbc6
>
> Thanks,
> -Steve
>
>
> _______________________________________________
> Xenomai mailing list
> Xenomai@xenomai.org
> http://www.xenomai.org/mailman/listinfo/xenomai

I hope I could help.
Stefan.


  reply	other threads:[~2014-07-25 15:17 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-20 15:48 [Xenomai] POSIX application running under xenomai -- what do wrapped functions do? Steve M. Robbins
2014-06-20 17:38 ` Philippe Gerum
2014-06-23 18:25   ` Steve M. Robbins
2014-07-22  7:17   ` Steve M. Robbins
2014-07-23 20:37     ` Philippe Gerum
2014-07-25 14:54       ` Steve M. Robbins
2014-07-25 15:17         ` Stefan Smarzly [this message]
2014-07-25 15:59           ` Steve M. Robbins
2014-07-25 15:21         ` Philippe Gerum
2014-07-24 18:18     ` Leopold Palomo-Avellaneda

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=53D274F6.30005@gmail.com \
    --to=smarzlys@gmail.com \
    --cc=steve@sumost.ca \
    --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.