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

2008-08-29 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 out of sync with the real

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 the xnsynch_owner is easily out of sync

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 problem comes from the fact that the

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 to the issue. Our actual problem comes from the

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: ... I think I'm getting closer to the issue. Our

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: Jan Kiszka wrote: ... I think I'm getting closer to

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: Gilles Chanteperdrix wrote: Jan Kiszka wrote: ... I

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: Gilles Chanteperdrix wrote: Jan Kiszka wrote: ... I

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: Jan Kiszka wrote: Gilles Chanteperdrix wrote:

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 not

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 Chanteperdrix wrote: Jan Kiszka wrote: Gilles

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: Philippe Gerum wrote: Gilles Chanteperdrix wrote: Jan

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 wrote: Gilles Chanteperdrix wrote: Philippe Gerum

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 former owner:

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 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)) { + 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: @@ -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 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 former owner:

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, it even sometimes points

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 with the real owner, it even

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, it even sometimes points

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) so that

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_current

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_SPARE3

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

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) -#define clear_claimed(owner) ((xnthread_t *) ((long)

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 object pointer.

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 *) ((long) (owner) ~1)) -#define

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) ((long) (owner) 1) -#define 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: -#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

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

2008-08-27 Thread Jan Kiszka
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_handle(current_thread). It

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 pointer etc.

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-sleepers

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 __CLAIMED_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: + 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

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 object_b * and

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 start assuming

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 different internal layout. If

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 arbitrary objects with

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, this patch

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_t *) ((long)

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 you have spotted a bug

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))); Ok. I think you have

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)) -#define set_claimed(owner, bit) \

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 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: 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 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 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: +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: ... 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 B pends.

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: Gilles Chanteperdrix wrote: Jan Kiszka wrote: +

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: 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: 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: Gilles

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 releases a mutex on

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 releases a mutex on

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: 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

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 object pointer.