Skip to content

Fast mutex rework, native support

Jan Kiszka xenomai 1 version NAK

Status from this message: Nak.

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest9 patches 14 repliesNAK

Patches in v1

#Subject and filesSizeRepliesApplied
1/9Always register threads by their baseksrc/skins/native/syscall.c ksrc/skins/native/task.c ksrc/skins/psos+/syscall.c +3 more+63 -480 replies
2/9Switch to handle-based fast mutex ownersinclude/asm-generic/bits/bind.h include/asm-generic/bits/current.h include/nucleus/types.h +19 more+205 -746 replies
2/9Switch to handle-based fast mutex owners - v2include/asm-generic/bits/bind.h include/asm-generic/bits/current.h include/nucleus/types.h +19 more+201 -765 replies
3/9Remove xnarch_atomic_intptr wrappersinclude/asm-arm/atomic.h include/asm-blackfin/atomic.h include/asm-generic/Makefile.am +5 more+2 -370 replies
4/9Spread xeno_set_currentsrc/skins/native/task.c src/skins/psos+/task.c src/skins/uitron/task.c +2 more+44 -110 replies
5/9Allow lock stealing via pthread_mutex_trylockinclude/posix/syscall.h ksrc/skins/posix/cond.c ksrc/skins/posix/mutex.c +3 more+62 -301 reply
6/9Add XNSYNCH_FWDROBinclude/nucleus/synch.h ksrc/nucleus/pod.c ksrc/nucleus/synch.c+19 -81 reply
7/9Switch POSIX mutexes to XNSYNCH_FWDROBksrc/skins/posix/mutex.c ksrc/skins/posix/mutex.h+31 -211 reply
8/9Native support for fast mutexesinclude/native/mutex.h ksrc/skins/native/cond.c ksrc/skins/native/mutex.c +3 more+422 -1310 replies
8/9Native support for fast mutexes - v2include/native/mutex.h ksrc/skins/native/cond.c ksrc/skins/native/mutex.c +3 more+448 -1410 replies
9/9Optimize xnsynch_sleep_on for XN_NONBLOCKinclude/nucleus/thread.h ksrc/nucleus/pod.c ksrc/nucleus/synch.c +3 more+38 -170 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [Xenomai-core] [PATCH 0/9] Fast mutex rework, native support

Here comes our current patch series to fix and enhance fast mutexes for both the POSIX as well as the native skin. After the long discussion on this list, it is clear that this is not the last word. However, we are currently not aware of regressions or still broken corner cases, so this series may at least serve as a reference for future versions.

Patches 1-4 should already be mergeable. They introduce handle-based owner tracking for the fast locks and clean up some code.

Patch 5 adds lock stealing support to pthread_mutex_trylock (something that the glibc does not provide, BTW...). It "misuses" xnsynch_sleep_on(..., XN_NONBLOCK) for this, but reuses a lot of code this way. To compensate for the overhead if this path, patch 9 optimizes xnsynch_sleep_on for XN_NONBLOCK users. Take this as a reference for one of the three possible approaches. Another one, some dedicated xnsynch_try_acquire (or so), may later be examined as well so that we can compare pros and cons. But first the third one, lock stealing via fast locks, should be analyzed /wrt feasibility.

Patch 6 is an intermediate helper to break out of the lock stealing loop in xnsynch_sleep_on (XNSYNCH_FWDROB). Patch 7 applies it on the POSIX skin, overcoming the duplicated sleeper tracking. XNSYNCH_FWROB will be obsolete once we merge fast lock support into xnsynch.

Patch 8 introduces fast mutexes to the native skin. This approach is built upon the same mechanisms as the POSIX skin (XNSYNCH_FWROB, trylock via xnsynch_sleep_on) to compare both implementations. The reason for differences is mostly the simpler native API. It passes an analogous test case like Gilles wrote for POSIX (augmented with lock stealing tests). The testsuite will be posted later after some refactoring work.

Feedback welcome.

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux