Skip to content

Alchemy: Fix calling context checks and documentation

Richard Weinberger (sigma star gmbh) xenomai 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest7 patches 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7lib/alchemy/mutex: Allow any Xenomai thread to acquire a mutexinclude/alchemy/mutex.h lib/alchemy/mutex.c+15 -71 reply
2/7lib/alchemy/task: Allow rt_task_yield() from any threadlib/alchemy/task.c+4 -40 replies
3/7lib/alchemy: Document the actual calling context requirementslib/alchemy/alarm.c lib/alchemy/buffer.c lib/alchemy/cond.c +8 more+85 -700 replies
4/7lib/alchemy/pipe: Do not require a Xenomai task for blocking readslib/alchemy/pipe.c+4 -40 replies
5/7lib/alchemy/event: Require a Xenomai task only for waiting over Mercurylib/alchemy/event.c lib/copperplate/eventobj.c+10 -50 replies
6/7lib/alchemy: Require a Xenomai task only when actually waitinglib/alchemy/buffer.c lib/alchemy/heap.c lib/alchemy/queue.c+35 -251 reply
7/7testsuite/smokey/alchemytests: Test Alchemy services from POSIX threadstestsuite/smokey/alchemytests/Makefile.am testsuite/smokey/alchemytests/alchemytests.c testsuite/smokey/alchemytests/mutex-3.c +1 more+429 -00 replies

Reviews trailers per patch

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

Read the v1 thread

Cover letter [PATCH 0/7] Alchemy: Fix calling context checks and documentation

From: Richard Weinberger <[email protected]>

Several Alchemy services refuse callers which are not Copperplate tasks, although they do not need a Copperplate TCB at all, or only need one when actually waiting. As a result, Cobalt POSIX threads, which are Xenomai threads according to the API documentation, get -EPERM from rt_mutex_acquire(), rt_task_yield(), rt_pipe_read() or rt_event_wait(), and even from queue/buffer/heap calls which could be satisfied immediately.

Also the documentation is inaccurate. It keeps referring to "Xenomai threads" where a Copperplate task, or even an Alchemy task, is actually required.

At first I thought fixing the documentation would be the best way to go. Then I remembered a customer application which does mix the Alchemy and POSIX skins, so I gave improving the Alchemy layer a try.

Patch 6/7 is worthy of discussion, I'm not so sure whether it really brings a real gain.

Thanks,
//richard

Richard Weinberger (7):
lib/alchemy/mutex: Allow any Xenomai thread to acquire a mutex lib/alchemy/task: Allow rt_task_yield() from any thread lib/alchemy: Document the actual calling context requirements lib/alchemy/pipe: Do not require a Xenomai task for blocking reads lib/alchemy/event: Require a Xenomai task only for waiting over
Mercury
lib/alchemy: Require a Xenomai task only when actually waiting testsuite/smokey/alchemytests: Test Alchemy services from POSIX
threads

 include/alchemy/mutex.h                      |   3 +-
 lib/alchemy/alarm.c                          |   9 -
 lib/alchemy/buffer.c                         |  23 +-
 lib/alchemy/cond.c                           |   3 +-
 lib/alchemy/event.c                          |  11 +-
 lib/alchemy/heap.c                           |  13 +-
 lib/alchemy/mutex.c                          |  22 +-
 lib/alchemy/pipe.c                           |  15 +-
 lib/alchemy/queue.c                          |  23 +-
 lib/alchemy/sem.c                            |   3 +-
 lib/alchemy/task.c                           |  86 +++---
 lib/copperplate/eventobj.c                   |   5 +
 lib/copperplate/init.c                       |  10 +
 testsuite/smokey/alchemytests/Makefile.am    |  10 +
 testsuite/smokey/alchemytests/alchemytests.c |   2 +
 testsuite/smokey/alchemytests/mutex-3.c      | 158 +++++++++++
 testsuite/smokey/alchemytests/posix-1.c      | 259 +++++++++++++++++++
 17 files changed, 561 insertions(+), 94 deletions(-)
 create mode 100644 testsuite/smokey/alchemytests/mutex-3.c
 create mode 100644 testsuite/smokey/alchemytests/posix-1.c
Signature · 1 line
2.55.0