All of lore.kernel.org
 help / color / mirror / Atom feed
From: Philippe Gerum <rpm@xenomai.org>
To: Jan Kiszka <jan.kiszka@domain.hid>
Cc: Alexis Berlemont <berlemont.hauw@domain.hid>, xenomai@xenomai.org
Subject: Re: [Xenomai-help] Analogy cmd_write example explanation
Date: Thu, 01 Apr 2010 23:59:36 +0200	[thread overview]
Message-ID: <1270159176.2418.431.camel@domain.hid> (raw)
In-Reply-To: <4BB51299.7070500@domain.hid>

On Thu, 2010-04-01 at 23:39 +0200, Jan Kiszka wrote:
> Philippe Gerum wrote:
> > __xn_exec_current is actually carrying a MASSIVE bug potential:
> > - stick __xn_current to your favourite syscall, and implement two
> > versions of that syscall, depending on the current calling mode for the
> > shadow thread.
> > - let people think that they should control the current mode of that
> > thread using rt_task_set_mode() and this freaking horror monster called
> > T_PRIMARY, before calling the syscall in question, to get either
> > implementation A or B.
> > - run the stuff, and surprise, get a linux signal between
> > rt_task_set_mode and the syscall. Your thread is now NRT. Too bad, you
> > wanted the RT side to run. You are toast.
> 
> That's a non-issue if the driver gets informed about the capability of
> the caller to execute a service also in RT. In that case, if an RT
> variant of the invoked service exist, the driver can simply issue the
> well-know ENOSYS, despite the fact that it could handle the call right
> now in NRT as well.

This is not the issue at stake unfortunately. The problem is with
drivers implemented in a way that provides two _different_
implementations of syscalls depending on the current mode. In that case,
-ENOSYS and adaptive won't buy you anything. __xn_exec_current will
cause your syscall to be routed to the wrong handler as previously
illustrated.

Saying that anyone writing such a driver is close to being a good
candidate for the Darwin Awards is likely true, but as a matter of fact,
those driver do exist nonetheless. And the reason why they exist, is
because we have that eager mode switch control available to userland,
that gives a bad signal to people regarding the semantics of the whole
thing.

So, to put things in the right sequence: I'm not saying that forcing
conforming syscalls is the only option, but it's the only option that
_guarantees_ that userland won't shoot itself in the foot in the
presence of the T_PRIMARY crap. At the very least, any solution that
gives more insight to drivers regarding how to manipulate the current
mode should be mated to a converse effort to reduce the nuisance of
T_PRIMARY.

> 
> Jan
> 


-- 
Philippe.




  reply	other threads:[~2010-04-01 21:59 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-10 15:26 [Xenomai-help] Analogy cmd_write example explanation Daniele Nicolodi
2010-03-12 23:40 ` Alexis Berlemont
2010-03-13  9:28   ` Philippe Gerum
2010-03-13 16:13     ` Alexis Berlemont
2010-03-13 16:33       ` Philippe Gerum
2010-03-13 23:34         ` Alexis Berlemont
2010-03-14 16:34           ` Philippe Gerum
2010-03-15  7:50             ` Jan Kiszka
2010-03-15 23:30               ` Alexis Berlemont
2010-03-16  8:59                 ` Jan Kiszka
2010-03-18 20:35                 ` Philippe Gerum
2010-03-18 21:14                   ` Alexis Berlemont
2010-03-18 21:39                     ` Philippe Gerum
2010-04-01 19:47             ` Gilles Chanteperdrix
2010-04-01 21:13               ` Jan Kiszka
2010-04-01 21:22                 ` Philippe Gerum
2010-04-01 21:26                   ` Jan Kiszka
2010-04-01 21:31                     ` Philippe Gerum
2010-04-01 21:36                       ` Jan Kiszka
2010-04-01 21:48                         ` Philippe Gerum
2010-04-01 21:54                           ` Jan Kiszka
2010-04-01 22:00                             ` Philippe Gerum
2010-04-01 22:07                               ` Jan Kiszka
2010-04-01 22:53                                 ` Gilles Chanteperdrix
2010-04-01 22:58                                   ` Jan Kiszka
2010-04-01 23:08                                     ` Gilles Chanteperdrix
2010-04-02  0:04                                       ` Jan Kiszka
2010-04-02 10:39                                         ` [Xenomai-core] " Gilles Chanteperdrix
2010-04-02 11:11                                           ` Jan Kiszka
2010-04-02 11:14                                             ` Gilles Chanteperdrix
2010-04-02 11:28                                               ` Jan Kiszka
2010-04-13 20:41                                                 ` Philippe Gerum
2010-04-13 23:05                                                   ` Jan Kiszka
2010-04-14  7:22                                                     ` Philippe Gerum
2010-04-14  7:37                                                       ` Jan Kiszka
2010-04-14  7:51                                                         ` Jan Kiszka
2010-04-14  9:04                                                         ` Philippe Gerum
2010-04-14 17:13                                                           ` Gilles Chanteperdrix
2010-04-14 19:35                                                           ` Jan Kiszka
2010-04-14  8:24                                                   ` Gilles Chanteperdrix
2010-04-01 21:24               ` Philippe Gerum
2010-04-01 21:39                 ` Jan Kiszka
2010-04-01 21:59                   ` Philippe Gerum [this message]
2010-04-01 22:12                     ` Jan Kiszka
2010-04-01 21:50               ` Jan Kiszka
2010-04-01 21:54                 ` 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=1270159176.2418.431.camel@domain.hid \
    --to=rpm@xenomai.org \
    --cc=berlemont.hauw@domain.hid \
    --cc=jan.kiszka@domain.hid \
    --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.