Re: [Xenomai-core] [RFC][PATCH 2/3] Switch to handle-based fast mutex owners

2008-08-29 Thread Jan Kiszka
Philippe Gerum wrote: > Jan Kiszka wrote: >> Philippe Gerum wrote: >>> Jan Kiszka wrote: Philippe Gerum wrote: > Gilles Chanteperdrix wrote: >> Jan Kiszka wrote: >>> Gilles Chanteperdrix wrote: Jan Kiszka wrote: > Gilles Chanteperdrix wrote: >> Jan Kiszka w

Re: [Xenomai-core] [RFC][PATCH 2/3] Switch to handle-based fast mutex owners

2008-08-29 Thread Philippe Gerum
Jan Kiszka wrote: > Philippe Gerum wrote: >> Jan Kiszka wrote: >>> Philippe Gerum wrote: Gilles Chanteperdrix wrote: > Jan Kiszka wrote: >> Gilles Chanteperdrix wrote: >>> Jan Kiszka wrote: Gilles Chanteperdrix wrote: > Jan Kiszka wrote: >> Gilles Chanteper

Re: [Xenomai-core] [RFC][PATCH 2/3] Switch to handle-based fast mutex owners

2008-08-29 Thread Jan Kiszka
Philippe Gerum wrote: > Jan Kiszka wrote: >> Philippe Gerum wrote: >>> Gilles Chanteperdrix wrote: Jan Kiszka wrote: > Gilles Chanteperdrix wrote: >> Jan Kiszka wrote: >>> Gilles Chanteperdrix wrote: Jan Kiszka wrote: > Gilles Chanteperdrix wrote: >> Philip

Re: [Xenomai-core] [RFC][PATCH 2/3] Switch to handle-based fast mutex owners

2008-08-29 Thread Philippe Gerum
Jan Kiszka wrote: > Philippe Gerum wrote: >> Gilles Chanteperdrix wrote: >>> Jan Kiszka wrote: Gilles Chanteperdrix wrote: > Jan Kiszka wrote: >> Gilles Chanteperdrix wrote: >>> Jan Kiszka wrote: Gilles Chanteperdrix wrote: > Philippe Gerum wrote: >> Gilles

Re: [Xenomai-core] [RFC][PATCH 2/3] Switch to handle-based fast mutex owners

2008-08-29 Thread Gilles Chanteperdrix
Jan Kiszka wrote: > Probably. But it will definitely need full fast locking support inside > xnsynch, which is basically about defining and maintaining a generic > user-shared lock word from within xnsynch services that has at least a > 'claimed' and a 'assignment pending' bit. Looks like we will n

Re: [Xenomai-core] [RFC][PATCH 2/3] Switch to handle-based fast mutex owners

2008-08-29 Thread Jan Kiszka
Philippe Gerum wrote: > Gilles Chanteperdrix wrote: >> Jan Kiszka wrote: >>> Gilles Chanteperdrix wrote: Jan Kiszka wrote: > Gilles Chanteperdrix wrote: >> Jan Kiszka wrote: >>> Gilles Chanteperdrix wrote: Philippe Gerum wrote: > Gilles Chanteperdrix wrote: >>>

Re: [Xenomai-core] [RFC][PATCH 2/3] Switch to handle-based fast mutex owners

2008-08-29 Thread Philippe Gerum
Gilles Chanteperdrix wrote: > Jan Kiszka wrote: >> Gilles Chanteperdrix wrote: >>> Jan Kiszka wrote: Gilles Chanteperdrix wrote: > Jan Kiszka wrote: >> Gilles Chanteperdrix wrote: >>> Philippe Gerum wrote: Gilles Chanteperdrix wrote: > Jan Kiszka wrote: >>

Re: [Xenomai-core] [RFC][PATCH 2/3] Switch to handle-based fast mutex owners

2008-08-29 Thread Jan Kiszka
Gilles Chanteperdrix wrote: > Jan Kiszka wrote: >> Gilles Chanteperdrix wrote: >>> Jan Kiszka wrote: Gilles Chanteperdrix wrote: > Jan Kiszka wrote: >> Gilles Chanteperdrix wrote: >>> Philippe Gerum wrote: Gilles Chanteperdrix wrote: > Jan Kiszka wrote: >>

Re: [Xenomai-core] [RFC][PATCH 2/3] Switch to handle-based fast mutex owners

2008-08-29 Thread Gilles Chanteperdrix
Jan Kiszka wrote: > Gilles Chanteperdrix wrote: >> Jan Kiszka wrote: >>> Gilles Chanteperdrix wrote: Jan Kiszka wrote: > Gilles Chanteperdrix wrote: >> Philippe Gerum wrote: >>> Gilles Chanteperdrix wrote: Jan Kiszka wrote: > Gilles Chanteperdrix wrote: >>

Re: [Xenomai-core] [RFC][PATCH 2/3] Switch to handle-based fast mutex owners

2008-08-29 Thread Jan Kiszka
Gilles Chanteperdrix wrote: > Jan Kiszka wrote: >> Gilles Chanteperdrix wrote: >>> Jan Kiszka wrote: Gilles Chanteperdrix wrote: > Philippe Gerum wrote: >> Gilles Chanteperdrix wrote: >>> Jan Kiszka wrote: Gilles Chanteperdrix wrote: > Jan Kiszka wrote: ..

Re: [Xenomai-core] [RFC][PATCH 2/3] Switch to handle-based fast mutex owners

2008-08-29 Thread Gilles Chanteperdrix
Jan Kiszka wrote: > Gilles Chanteperdrix wrote: >> Jan Kiszka wrote: >>> Gilles Chanteperdrix wrote: Philippe Gerum wrote: > Gilles Chanteperdrix wrote: >> Jan Kiszka wrote: >>> Gilles Chanteperdrix wrote: Jan Kiszka wrote: >>> ... > I think I'm getting closer

Re: [Xenomai-core] [RFC][PATCH 2/3] Switch to handle-based fast mutex owners

2008-08-29 Thread Jan Kiszka
Gilles Chanteperdrix wrote: > Jan Kiszka wrote: >> Gilles Chanteperdrix wrote: >>> Philippe Gerum wrote: Gilles Chanteperdrix wrote: > Jan Kiszka wrote: >> Gilles Chanteperdrix wrote: >>> Jan Kiszka wrote: >> ... I think I'm getting closer to the issue. Our actual prob

Re: [Xenomai-core] [RFC][PATCH 2/3] Switch to handle-based fast mutex owners

2008-08-29 Thread Gilles Chanteperdrix
Jan Kiszka wrote: > Gilles Chanteperdrix wrote: >> Philippe Gerum wrote: >>> Gilles Chanteperdrix wrote: Jan Kiszka wrote: > Gilles Chanteperdrix wrote: >> Jan Kiszka wrote: > ... >>> I think I'm getting closer to the issue. Our actual problem comes from >>> the fact that t

Re: [Xenomai-core] [RFC][PATCH 2/3] Switch to handle-based fast mutex owners

2008-08-28 Thread Jan Kiszka
Gilles Chanteperdrix wrote: > Philippe Gerum wrote: >> Gilles Chanteperdrix wrote: >>> Jan Kiszka wrote: Gilles Chanteperdrix wrote: > Jan Kiszka wrote: ... >> I think I'm getting closer to the issue. Our actual problem comes from >> the fact that the xnsynch_owner is easily o

Re: [Xenomai-core] [RFC][PATCH 2/3] Switch to handle-based fast mutex owners

2008-08-28 Thread Gilles Chanteperdrix
Philippe Gerum wrote: > Gilles Chanteperdrix wrote: >> Jan Kiszka wrote: >>> Gilles Chanteperdrix wrote: Jan Kiszka wrote: >>> ... > I think I'm getting closer to the issue. Our actual problem comes from > the fact that the xnsynch_owner is easily out of sync with the real > owner,

Re: [Xenomai-core] [RFC][PATCH 2/3] Switch to handle-based fast mutex owners

2008-08-28 Thread Philippe Gerum
Jan Kiszka wrote: > Philippe Gerum wrote: >> Gilles Chanteperdrix wrote: >>> Jan Kiszka wrote: Gilles Chanteperdrix wrote: > Jan Kiszka wrote: ... >> I think I'm getting closer to the issue. Our actual problem comes from >> the fact that the xnsynch_owner is easily out of sync

Re: [Xenomai-core] [RFC][PATCH 2/3] Switch to handle-based fast mutex owners

2008-08-28 Thread Jan Kiszka
Philippe Gerum wrote: > Gilles Chanteperdrix wrote: >> Jan Kiszka wrote: >>> Gilles Chanteperdrix wrote: Jan Kiszka wrote: >>> ... > I think I'm getting closer to the issue. Our actual problem comes from > the fact that the xnsynch_owner is easily out of sync with the real > owner,

Re: [Xenomai-core] [RFC][PATCH 2/3] Switch to handle-based fast mutex owners

2008-08-28 Thread Philippe Gerum
Gilles Chanteperdrix wrote: > Jan Kiszka wrote: >> Gilles Chanteperdrix wrote: >>> Jan Kiszka wrote: >> ... I think I'm getting closer to the issue. Our actual problem comes from the fact that the xnsynch_owner is easily out of sync with the real owner, it even sometimes points to a

Re: [Xenomai-core] [RFC][PATCH 2/3] Switch to handle-based fast mutex owners

2008-08-28 Thread Jan Kiszka
Gilles Chanteperdrix wrote: > Jan Kiszka wrote: >> Gilles Chanteperdrix wrote: >>> Jan Kiszka wrote: @@ -329,6 +326,13 @@ int pse51_mutex_timedlock_break(struct _ break; } } + if (!xnsynch_nsleepers(&mutex->s

Re: [Xenomai-core] [RFC][PATCH 2/3] Switch to handle-based fast mutex owners

2008-08-28 Thread Gilles Chanteperdrix
Jan Kiszka wrote: > Gilles Chanteperdrix wrote: >> Jan Kiszka wrote: >>> @@ -329,6 +326,13 @@ int pse51_mutex_timedlock_break(struct _ >>> break; >>> } >>> } >>> + if (!xnsynch_nsleepers(&mutex->synchbase)) { >>> +

Re: [Xenomai-core] [RFC][PATCH 2/3] Switch to handle-based fast mutex owners

2008-08-28 Thread Gilles Chanteperdrix
Jan Kiszka wrote: > Gilles Chanteperdrix wrote: >> Jan Kiszka wrote: >>> Gilles Chanteperdrix wrote: Jan Kiszka wrote: >>> ... > I think I'm getting closer to the issue. Our actual problem comes from > the fact that the xnsynch_owner is easily out of sync with the real > owner, it

Re: [Xenomai-core] [RFC][PATCH 2/3] Switch to handle-based fast mutex owners

2008-08-28 Thread Jan Kiszka
Gilles Chanteperdrix wrote: > Jan Kiszka wrote: >> @@ -329,6 +326,13 @@ int pse51_mutex_timedlock_break(struct _ >> break; >> } >> } >> +if (!xnsynch_nsleepers(&mutex->synchbase)) { >> +xnarch_atomic_set

Re: [Xenomai-core] [RFC][PATCH 2/3] Switch to handle-based fast mutex owners

2008-08-28 Thread Jan Kiszka
Gilles Chanteperdrix wrote: > Jan Kiszka wrote: >> Gilles Chanteperdrix wrote: >>> Jan Kiszka wrote: >> ... I think I'm getting closer to the issue. Our actual problem comes from the fact that the xnsynch_owner is easily out of sync with the real owner, it even sometimes points to a

Re: [Xenomai-core] [RFC][PATCH 2/3] Switch to handle-based fast mutex owners

2008-08-27 Thread Gilles Chanteperdrix
Jan Kiszka wrote: > Gilles Chanteperdrix wrote: >> Jan Kiszka wrote: >>> Gilles Chanteperdrix wrote: Jan Kiszka wrote: > To improve robustness of the fast mutex implementation in POSIX (and > later on in native), it is better to track the mutex owner by handle > instead of kernel o

Re: [Xenomai-core] [RFC][PATCH 2/3] Switch to handle-based fast mutex owners

2008-08-27 Thread Gilles Chanteperdrix
Jan Kiszka wrote: > Gilles Chanteperdrix wrote: >> Jan Kiszka wrote: >>> Gilles Chanteperdrix wrote: Jan Kiszka wrote: > Gilles Chanteperdrix wrote: >> Jan Kiszka wrote: >>> File descriptors are all identically structured objects, so at worst you >>> ruin some other app's day.

Re: [Xenomai-core] [RFC][PATCH 2/3] Switch to handle-based fast mutex owners

2008-08-27 Thread Gilles Chanteperdrix
Jan Kiszka wrote: > @@ -329,6 +326,13 @@ int pse51_mutex_timedlock_break(struct _ > break; > } > } > + if (!xnsynch_nsleepers(&mutex->synchbase)) { > + xnarch_atomic_set > +

Re: [Xenomai-core] [RFC][PATCH 2/3] Switch to handle-based fast mutex owners

2008-08-27 Thread Gilles Chanteperdrix
Jan Kiszka wrote: > Gilles Chanteperdrix wrote: >> Jan Kiszka wrote: > ... >>> I think I'm getting closer to the issue. Our actual problem comes from >>> the fact that the xnsynch_owner is easily out of sync with the real >>> owner, it even sometimes points to a former owner: >>> >>> Thread A relea

Re: [Xenomai-core] [RFC][PATCH 2/3] Switch to handle-based fast mutex owners

2008-08-27 Thread Gilles Chanteperdrix
Jan Kiszka wrote: > Gilles Chanteperdrix wrote: >> Jan Kiszka wrote: > ... >>> I think I'm getting closer to the issue. Our actual problem comes from >>> the fact that the xnsynch_owner is easily out of sync with the real >>> owner, it even sometimes points to a former owner: >>> >>> Thread A relea

Re: [Xenomai-core] [RFC][PATCH 2/3] Switch to handle-based fast mutex owners

2008-08-27 Thread Gilles Chanteperdrix
Jan Kiszka wrote: > Gilles Chanteperdrix wrote: >> Jan Kiszka wrote: >>> Gilles Chanteperdrix wrote: Gilles Chanteperdrix wrote: > Jan Kiszka wrote: >> Gilles Chanteperdrix wrote: >>> Jan Kiszka wrote: Gilles Chanteperdrix wrote: > Jan Kiszka wrote: >> Gill

Re: [Xenomai-core] [RFC][PATCH 2/3] Switch to handle-based fast mutex owners

2008-08-27 Thread Jan Kiszka
Gilles Chanteperdrix wrote: > Jan Kiszka wrote: >> Gilles Chanteperdrix wrote: >>> Gilles Chanteperdrix wrote: Jan Kiszka wrote: > Gilles Chanteperdrix wrote: >> Jan Kiszka wrote: >>> Gilles Chanteperdrix wrote: Jan Kiszka wrote: > Gilles Chanteperdrix wrote: >

Re: [Xenomai-core] [RFC][PATCH 2/3] Switch to handle-based fast mutex owners

2008-08-27 Thread Gilles Chanteperdrix
Jan Kiszka wrote: > Gilles Chanteperdrix wrote: >> Gilles Chanteperdrix wrote: >>> Jan Kiszka wrote: Gilles Chanteperdrix wrote: > Jan Kiszka wrote: >> Gilles Chanteperdrix wrote: >>> Jan Kiszka wrote: Gilles Chanteperdrix wrote: > Jan Kiszka wrote: >> Gill

Re: [Xenomai-core] [RFC][PATCH 2/3] Switch to handle-based fast mutex owners

2008-08-27 Thread Jan Kiszka
Gilles Chanteperdrix wrote: > Jan Kiszka wrote: ... >> I think I'm getting closer to the issue. Our actual problem comes from >> the fact that the xnsynch_owner is easily out of sync with the real >> owner, it even sometimes points to a former owner: >> >> Thread A releases a mutex on which thread

Re: [Xenomai-core] [RFC][PATCH 2/3] Switch to handle-based fast mutex owners

2008-08-27 Thread Jan Kiszka
Gilles Chanteperdrix wrote: > Gilles Chanteperdrix wrote: >> Jan Kiszka wrote: >>> Gilles Chanteperdrix wrote: Jan Kiszka wrote: > Gilles Chanteperdrix wrote: >> Jan Kiszka wrote: >>> Gilles Chanteperdrix wrote: Jan Kiszka wrote: > Gilles Chanteperdrix wrote: >

Re: [Xenomai-core] [RFC][PATCH 2/3] Switch to handle-based fast mutex owners

2008-08-27 Thread Gilles Chanteperdrix
Gilles Chanteperdrix wrote: > Jan Kiszka wrote: >> Gilles Chanteperdrix wrote: >>> Jan Kiszka wrote: Gilles Chanteperdrix wrote: > Jan Kiszka wrote: >> Gilles Chanteperdrix wrote: >>> Jan Kiszka wrote: Gilles Chanteperdrix wrote: > Jan Kiszka wrote: >> +

Re: [Xenomai-core] [RFC][PATCH 2/3] Switch to handle-based fast mutex owners

2008-08-27 Thread Gilles Chanteperdrix
Jan Kiszka wrote: > Gilles Chanteperdrix wrote: >> Jan Kiszka wrote: >>> Gilles Chanteperdrix wrote: Jan Kiszka wrote: > Gilles Chanteperdrix wrote: >> Jan Kiszka wrote: >>> Gilles Chanteperdrix wrote: Jan Kiszka wrote: > + xnarch_atomic_set(mutex->owner, >

Re: [Xenomai-core] [RFC][PATCH 2/3] Switch to handle-based fast mutex owners

2008-08-27 Thread Jan Kiszka
Gilles Chanteperdrix wrote: > Jan Kiszka wrote: >> Gilles Chanteperdrix wrote: >>> Jan Kiszka wrote: Gilles Chanteperdrix wrote: > Jan Kiszka wrote: >> Gilles Chanteperdrix wrote: >>> Jan Kiszka wrote: + xnarch_atomic_set(mutex->owner, +

Re: [Xenomai-core] [RFC][PATCH 2/3] Switch to handle-based fast mutex owners

2008-08-27 Thread Gilles Chanteperdrix
Jan Kiszka wrote: > Gilles Chanteperdrix wrote: >> Jan Kiszka wrote: >>> Gilles Chanteperdrix wrote: Jan Kiszka wrote: > Gilles Chanteperdrix wrote: >> Jan Kiszka wrote: >>> + xnarch_atomic_set(mutex->owner, >>> + set_claimed(xnthread_handle(owner)

Re: [Xenomai-core] [RFC][PATCH 2/3] Switch to handle-based fast mutex owners

2008-08-27 Thread Jan Kiszka
Gilles Chanteperdrix wrote: > Jan Kiszka wrote: >> Gilles Chanteperdrix wrote: >>> Jan Kiszka wrote: Gilles Chanteperdrix wrote: > Jan Kiszka wrote: >> +xnarch_atomic_set(mutex->owner, >> + set_claimed(xnthread_handle(owner), >> +

Re: [Xenomai-core] [RFC][PATCH 2/3] Switch to handle-based fast mutex owners

2008-08-27 Thread Jan Kiszka
Gilles Chanteperdrix wrote: > Jan Kiszka wrote: >> Gilles Chanteperdrix wrote: >>> Jan Kiszka wrote: Gilles Chanteperdrix wrote: > Jan Kiszka wrote: > >> -#define test_claimed(owner) ((long) (owner) & 1) >> -#define clear_claimed(owner) ((xnthread_t *) ((long) (owner) & ~1)) >>

Re: [Xenomai-core] [RFC][PATCH 2/3] Switch to handle-based fast mutex owners

2008-08-27 Thread Gilles Chanteperdrix
Jan Kiszka wrote: > Gilles Chanteperdrix wrote: >> Jan Kiszka wrote: >>> Gilles Chanteperdrix wrote: Jan Kiszka wrote: > + xnarch_atomic_set(mutex->owner, > + set_claimed(xnthread_handle(owner), > + xnsynch_nsleepers(&mutex->synchbase

Re: [Xenomai-core] [RFC][PATCH 2/3] Switch to handle-based fast mutex owners

2008-08-27 Thread Jan Kiszka
Gilles Chanteperdrix wrote: > Jan Kiszka wrote: >> Gilles Chanteperdrix wrote: >>> Jan Kiszka wrote: + xnarch_atomic_set(mutex->owner, +set_claimed(xnthread_handle(owner), +xnsynch_nsleepers(&mutex->synchbase))); >>> Ok. I think yo

Re: [Xenomai-core] [RFC][PATCH 2/3] Switch to handle-based fast mutex owners

2008-08-27 Thread Jan Kiszka
Gilles Chanteperdrix wrote: > Jan Kiszka wrote: >> Gilles Chanteperdrix wrote: >>> Jan Kiszka wrote: >>> -#define test_claimed(owner) ((long) (owner) & 1) -#define clear_claimed(owner) ((xnthread_t *) ((long) (owner) & ~1)) -#define set_claimed(owner, bit) \ -((xnthread_

Re: [Xenomai-core] [RFC][PATCH 2/3] Switch to handle-based fast mutex owners

2008-08-27 Thread Jan Kiszka
Gilles Chanteperdrix wrote: > Jan Kiszka wrote: >> Gilles Chanteperdrix wrote: >>> Jan Kiszka wrote: To improve robustness of the fast mutex implementation in POSIX (and later on in native), it is better to track the mutex owner by handle instead of kernel object pointer. Therefore,

Re: [Xenomai-core] [RFC][PATCH 2/3] Switch to handle-based fast mutex owners

2008-08-27 Thread Jan Kiszka
Gilles Chanteperdrix wrote: > Jan Kiszka wrote: >> Gilles Chanteperdrix wrote: >>> Jan Kiszka wrote: Gilles Chanteperdrix wrote: > Jan Kiszka wrote: >> File descriptors are all identically structured objects, so at worst you >> ruin some other app's day. But the registry contains a

Re: [Xenomai-core] [RFC][PATCH 2/3] Switch to handle-based fast mutex owners

2008-08-27 Thread Gilles Chanteperdrix
Jan Kiszka wrote: > Gilles Chanteperdrix wrote: >> Jan Kiszka wrote: >>> Gilles Chanteperdrix wrote: Jan Kiszka wrote: > File descriptors are all identically structured objects, so at worst you > ruin some other app's day. But the registry contains arbitrary objects > with differen

Re: [Xenomai-core] [RFC][PATCH 2/3] Switch to handle-based fast mutex owners

2008-08-27 Thread Jan Kiszka
Gilles Chanteperdrix wrote: > Jan Kiszka wrote: >> Gilles Chanteperdrix wrote: >>> Jan Kiszka wrote: File descriptors are all identically structured objects, so at worst you ruin some other app's day. But the registry contains arbitrary objects with different internal layout. If you

Re: [Xenomai-core] [RFC][PATCH 2/3] Switch to handle-based fast mutex owners

2008-08-27 Thread Gilles Chanteperdrix
Jan Kiszka wrote: > Gilles Chanteperdrix wrote: >> Jan Kiszka wrote: >>> File descriptors are all identically structured objects, so at worst you >>> ruin some other app's day. But the registry contains arbitrary objects >>> with different internal layout. If you start assuming object_a * is >>> ob

Re: [Xenomai-core] [RFC][PATCH 2/3] Switch to handle-based fast mutex owners

2008-08-27 Thread Gilles Chanteperdrix
Jan Kiszka wrote: > Gilles Chanteperdrix wrote: >> Jan Kiszka wrote: >>> + xnarch_atomic_set(mutex->owner, >>> + set_claimed(xnthread_handle(owner), >>> + xnsynch_nsleepers(&mutex->synchbase))); >> Ok. I think you have spotted a bug here. This s

Re: [Xenomai-core] [RFC][PATCH 2/3] Switch to handle-based fast mutex owners

2008-08-27 Thread Jan Kiszka
Gilles Chanteperdrix wrote: > Jan Kiszka wrote: > >> -#define test_claimed(owner) ((long) (owner) & 1) >> -#define clear_claimed(owner) ((xnthread_t *) ((long) (owner) & ~1)) >> -#define set_claimed(owner, bit) \ >> -((xnthread_t *) ((long) clear_claimed(owner) | !!(bit))) >> +#define __CL

Re: [Xenomai-core] [RFC][PATCH 2/3] Switch to handle-based fast mutex owners

2008-08-27 Thread Jan Kiszka
Gilles Chanteperdrix wrote: > Jan Kiszka wrote: >> +xnarch_atomic_set(mutex->owner, >> + set_claimed(xnthread_handle(owner), >> + xnsynch_nsleepers(&mutex->synchbase))); > > Ok. I think you have spotted a bug here. This should be mutex->sle

Re: [Xenomai-core] [RFC][PATCH 2/3] Switch to handle-based fast mutex owners

2008-08-27 Thread Jan Kiszka
Gilles Chanteperdrix wrote: > Jan Kiszka wrote: >> File descriptors are all identically structured objects, so at worst you >> ruin some other app's day. But the registry contains arbitrary objects >> with different internal layout. If you start assuming object_a * is >> object_b * and use the poin

Re: [Xenomai-core] [RFC][PATCH 2/3] Switch to handle-based fast mutex owners

2008-08-27 Thread Gilles Chanteperdrix
Jan Kiszka wrote: > File descriptors are all identically structured objects, so at worst you > ruin some other app's day. But the registry contains arbitrary objects > with different internal layout. If you start assuming object_a * is > object_b * and use the pointer etc. included in a as if they

Re: [Xenomai-core] [RFC][PATCH 2/3] Switch to handle-based fast mutex owners

2008-08-27 Thread Gilles Chanteperdrix
Jan Kiszka wrote: > Gilles Chanteperdrix wrote: >> Jan Kiszka wrote: >> >>> -#define test_claimed(owner) ((long) (owner) & 1) >>> -#define clear_claimed(owner) ((xnthread_t *) ((long) (owner) & ~1)) >>> -#define set_claimed(owner, bit) \ >>> -((xnthread_t *) ((long) clear_claimed(owner) | !

Re: [Xenomai-core] [RFC][PATCH 2/3] Switch to handle-based fast mutex owners

2008-08-27 Thread Gilles Chanteperdrix
Jan Kiszka wrote: > Gilles Chanteperdrix wrote: >> Jan Kiszka wrote: >>> Gilles Chanteperdrix wrote: Jan Kiszka wrote: > -#define test_claimed(owner) ((long) (owner) & 1) > -#define clear_claimed(owner) ((xnthread_t *) ((long) (owner) & ~1)) > -#define set_claimed(owner, bit)

Re: [Xenomai-core] [RFC][PATCH 2/3] Switch to handle-based fast mutex owners

2008-08-27 Thread Gilles Chanteperdrix
Jan Kiszka wrote: > Gilles Chanteperdrix wrote: >> Jan Kiszka wrote: >> >>> -#define test_claimed(owner) ((long) (owner) & 1) >>> -#define clear_claimed(owner) ((xnthread_t *) ((long) (owner) & ~1)) >>> -#define set_claimed(owner, bit) \ >>> -((xnthread_t *) ((long) clear_claimed(owner) | !

Re: [Xenomai-core] [RFC][PATCH 2/3] Switch to handle-based fast mutex owners

2008-08-27 Thread Gilles Chanteperdrix
Jan Kiszka wrote: > Gilles Chanteperdrix wrote: >> Jan Kiszka wrote: >>> Gilles Chanteperdrix wrote: Jan Kiszka wrote: > Gilles Chanteperdrix wrote: >> Jan Kiszka wrote: >>> Gilles Chanteperdrix wrote: Jan Kiszka wrote: > -#define test_claimed(owner) ((lon

Re: [Xenomai-core] [RFC][PATCH 2/3] Switch to handle-based fast mutex owners

2008-08-27 Thread Gilles Chanteperdrix
Jan Kiszka wrote: > Gilles Chanteperdrix wrote: >> Jan Kiszka wrote: >>> Gilles Chanteperdrix wrote: Jan Kiszka wrote: > Gilles Chanteperdrix wrote: >> Jan Kiszka wrote: >> >>> -#define test_claimed(owner) ((long) (owner) & 1) >>> -#define clear_claimed(owner) ((xnthread_t

Re: [Xenomai-core] [RFC][PATCH 2/3] Switch to handle-based fast mutex owners

2008-08-27 Thread Gilles Chanteperdrix
Jan Kiszka wrote: > Gilles Chanteperdrix wrote: >> Jan Kiszka wrote: >>> Gilles Chanteperdrix wrote: Jan Kiszka wrote: > To improve robustness of the fast mutex implementation in POSIX (and > later on in native), it is better to track the mutex owner by handle > instead of kernel o

Re: [Xenomai-core] [RFC][PATCH 2/3] Switch to handle-based fast mutex owners

2008-08-27 Thread Jan Kiszka
Gilles Chanteperdrix wrote: > Jan Kiszka wrote: >> Gilles Chanteperdrix wrote: >>> Jan Kiszka wrote: Gilles Chanteperdrix wrote: > Jan Kiszka wrote: >> Gilles Chanteperdrix wrote: >>> Jan Kiszka wrote: >>> -#define test_claimed(owner) ((long) (owner) & 1) -#de

Re: [Xenomai-core] [RFC][PATCH 2/3] Switch to handle-based fast mutex owners

2008-08-27 Thread Gilles Chanteperdrix
Jan Kiszka wrote: > Gilles Chanteperdrix wrote: >> Jan Kiszka wrote: >> >>> -#define test_claimed(owner) ((long) (owner) & 1) >>> -#define clear_claimed(owner) ((xnthread_t *) ((long) (owner) & ~1)) >>> -#define set_claimed(owner, bit) \ >>> -((xnthread_t *) ((long) clear_claimed(owner) | !

Re: [Xenomai-core] [RFC][PATCH 2/3] Switch to handle-based fast mutex owners

2008-08-27 Thread Gilles Chanteperdrix
Jan Kiszka wrote: > To improve robustness of the fast mutex implementation in POSIX (and > later on in native), it is better to track the mutex owner by handle > instead of kernel object pointer. Therefore, this patch changes > __xn_sys_current (xeno_set_current) so that it returns > xnthread_handl

Re: [Xenomai-core] [RFC][PATCH 2/3] Switch to handle-based fast mutex owners

2008-08-27 Thread Gilles Chanteperdrix
Jan Kiszka wrote: > -#define test_claimed(owner) ((long) (owner) & 1) > -#define clear_claimed(owner) ((xnthread_t *) ((long) (owner) & ~1)) > -#define set_claimed(owner, bit) \ > -((xnthread_t *) ((long) clear_claimed(owner) | !!(bit))) > +#define __CLAIMED_BITXN_HANDLE_SP

Re: [Xenomai-core] [RFC][PATCH 2/3] Switch to handle-based fast mutex owners

2008-08-27 Thread Gilles Chanteperdrix
Jan Kiszka wrote: > Gilles Chanteperdrix wrote: >> Jan Kiszka wrote: >>> To improve robustness of the fast mutex implementation in POSIX (and >>> later on in native), it is better to track the mutex owner by handle >>> instead of kernel object pointer. Therefore, this patch changes >>> __xn_sys_cur

Re: [Xenomai-core] [RFC][PATCH 2/3] Switch to handle-based fast mutex owners

2008-08-27 Thread Jan Kiszka
Gilles Chanteperdrix wrote: > Jan Kiszka wrote: >> To improve robustness of the fast mutex implementation in POSIX (and >> later on in native), it is better to track the mutex owner by handle >> instead of kernel object pointer. Therefore, this patch changes >> __xn_sys_current (xeno_set_current) s