All of lore.kernel.org
 help / color / mirror / Atom feed
From: Philippe Gerum <rpm@xenomai.org>
To: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-core] [Patch 5/7] Define new syscalls for the system skin
Date: Sun, 18 May 2008 23:52:13 +0200	[thread overview]
Message-ID: <4830A50D.8040507@domain.hid> (raw)
In-Reply-To: <18480.34204.426031.862047@domain.hid>

Gilles Chanteperdrix wrote:
> Philippe Gerum wrote:
>  > Gilles Chanteperdrix wrote:
>  > > Philippe Gerum wrote:
>  > >  > Gilles Chanteperdrix wrote:
>  > >  > > The two syscalls defined in the posix skin now moved to the sys skin, they are
>  > >  > > used in user-space by include/asm-generic/bits/bind.h and the new header
>  > >  > > include/asm-generic/bits/current.h. The global and process-specific shared heaps
>  > >  > > are now part of this patch.
>  > >  > >
>  > >  > 
>  > >  > Is there any reason why the nucleus should not implement a full-fledged "RT
>  > >  > futex" support, instead of a toolbox to build them? I'm concerned by skins
>  > >  > reinventing their own wheel uselessly to get to the same point at the end of the
>  > >  > day; e.g. cb_lock ops seem to me fairly generic when it comes to handling
>  > >  > futexes, so I would move them upstream one level more.
>  > >  > 
>  > >  > In that respect, talking about "semaphore heaps" at nucleus level looks a bit of
>  > >  > a misnomer: if we mostly bring a service to map non-cacheable memory to
>  > >  > user-space, then we don't actually provide semaphore support.
>  > > 
>  > > If I understand correctly, a futex is, in xenomai terms, a way to
>  > > associate a user-space address, with an xnsynch object.
>  > 
>  > I would specialize it more actually so that it really resembles the vanilla
>  > futex support, i.e. a basic object implementing the required operations to
>  > provide mutually exclusive access, working on a pinned memory area shared
>  > between kernel and userland. AFAICS, the current patchset implements the pinned
>  > memory support in the nucleus, but not the operations, which remain a per-skin
>  > issue.
> 
> As far as I understood, the user-space atomic operations, used to
> acquire a free mutex in user-space, are not part of the futex API. In
> our case, we are using xnarch_atomic_* operations to implement portably
> this user-space locking stuff. I think that even setting the bit saying
> that the mutex is currently owned is done in pthread_mutexes
> implementation, not in the Futex API.

I would fully agree if the futex API did not define PI-based ops, which are
needed for proper real-time operations from userland. You will certainly agree
that PI implies that some kind of ownership exists; and because there can't be
more than a single owner in that case, you end up with an object that can't be
held by more than a single task. So you do have a mutex in disguise, whatever
the way to keep its state is (a bit, an integer, whatever). So there is stronger
semantics attached to that API than to simply manage an event notification scheme.

 Now, what remains is
> sys_futex(FUTEX_WAIT) and sys_futex(FUTEX_WAKE), this terribly looks like
> xnsync_sleep_on and xnsynch_wakeup_one_sleeper.
> 

Yes, here again I partially agree, except for a significant issue: xnsynch is a
stateless object (that's why we can use it for different syncobjs which are
totally unrelated in their semantics - mutex, queue, region, counting sems,
whatever). I was just wondering if we could make the *tex thingy a bit more
stateful to ease the job for the skins, just in case we would use it for mutexes
only. I have no immediate answer to this question, just asking -- this is my
contribution as a senior member of the peanut gallery.

>  > 
>  >  I feel this
>  > > would complicate things: currently, the way I implemented user-space
>  > > mutexes for the posix skin kept the old association between the
>  > > user-space mutex, and its kernel-space companion, also used by
>  > > kernel-space operations.
>  > > 
>  > 
>  > My concern boils down to: how much of the POSIX implementation, beyond the
>  > cb_lock stuff, would have to be duplicated to get the same support ported to,
>  > say the VxWorks semM services?
> 
> The initialization code, and the additional calls to
> xnarch_atomic_cmpxchg in user-space. If xnarch_atomic_cmpxchg fails we
> call kernel-space, which is mostly unchanged.
> 
> Because of the cb_lock stuff, I also needed to implement the
> kernel-space syscalls in two versions: one if user-space has
> xnarch_atomic_cmpxchg and could lock the mutex control block, the other
> if the mutex control block needs to be locked by kernel-space.
> 

This is the part my laziness would very much like to factor as much as possible.
If ever possible.

-- 
Philippe.


  reply	other threads:[~2008-05-18 21:52 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-02 22:27 [Xenomai-core] [Patch 0/7] Posix skin user-space mutexes, second take Gilles Chanteperdrix
2008-05-02 22:30 ` [Xenomai-core] [Patch 1/7] Support for non cached memory mappings Gilles Chanteperdrix
2008-05-02 22:32   ` [Xenomai-core] [Patch 2/7] Define XNARCH_SHARED_HEAP_FLAGS Gilles Chanteperdrix
2008-05-02 22:33     ` [Xenomai-core] [Patch 3/7] Define more atomic operations in user-space Gilles Chanteperdrix
2008-05-02 22:34       ` [Xenomai-core] [Patch 4/7] Define ARM " Gilles Chanteperdrix
2008-05-02 22:35         ` [Xenomai-core] [Patch 5/7] Define new syscalls for the system skin Gilles Chanteperdrix
2008-05-02 22:36           ` [Xenomai-core] [Patch 6/7] Re-implementation of mutexes, kernel-space support Gilles Chanteperdrix
2008-05-02 22:38             ` [Xenomai-core] [Patch 7/7] Re-implementation of mutexes, user-space support Gilles Chanteperdrix
2008-05-18 16:42               ` Philippe Gerum
2008-05-18 17:05                 ` Gilles Chanteperdrix
2008-05-18 17:29                   ` Jan Kiszka
2008-05-18 17:41                     ` Gilles Chanteperdrix
2008-05-18 17:52                       ` Jan Kiszka
2008-05-18 18:09                         ` Gilles Chanteperdrix
2008-05-18 18:56                           ` Philippe Gerum
2008-05-19 22:49                             ` Gilles Chanteperdrix
2008-05-20  6:53                               ` Philippe Gerum
2008-05-20  7:07                                 ` Jan Kiszka
2008-05-20  7:23                                   ` Gilles Chanteperdrix
2008-05-18 16:40           ` [Xenomai-core] [Patch 5/7] Define new syscalls for the system skin Philippe Gerum
2008-05-18 17:21             ` Gilles Chanteperdrix
2008-05-18 18:37             ` Gilles Chanteperdrix
2008-05-18 19:10               ` Philippe Gerum
2008-05-18 19:38                 ` Gilles Chanteperdrix
2008-05-18 21:52                   ` Philippe Gerum [this message]
2008-05-18 22:52                     ` Gilles Chanteperdrix
2008-05-19 12:56                       ` Philippe Gerum
2008-05-19 13:16                         ` Gilles Chanteperdrix
2008-05-19 22:44                           ` Gilles Chanteperdrix
2008-05-05 16:33         ` [Xenomai-core] [Patch 4/7] Define ARM atomic operations in user-space Gilles Chanteperdrix
2008-05-05 16:39           ` Philippe Gerum
2008-05-05 16:44             ` Gilles Chanteperdrix
2008-05-18 16:30   ` [Xenomai-core] [Patch 1/7] Support for non cached memory mappings Philippe Gerum
2008-05-03 19:18 ` [Xenomai-core] [Patch 0/7] Posix skin user-space mutexes, second take 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=4830A50D.8040507@domain.hid \
    --to=rpm@xenomai.org \
    --cc=gilles.chanteperdrix@xenomai.org \
    --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.