All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 0/6] Xenomai: Real-time Exception Handling
@ 2025-04-08 12:28 Nikolaus Funk
  2025-04-08 12:28 ` [PATCH 1/6] cobalt/x86: Add architecture specific signal code Nikolaus Funk
                   ` (6 more replies)
  0 siblings, 7 replies; 10+ messages in thread
From: Nikolaus Funk @ 2025-04-08 12:28 UTC (permalink / raw)
  To: xenomai; +Cc: richard, Richard Weinberger

From: Richard Weinberger <richard@nod.at>

Currently, any exception that occurs in primary mode triggers a switch
to secondary mode, and Linux posts a signal.
This change allows certain exceptions to be handled directly in the
affected thread while remaining in primary mode.

At present, only SIGILL (for x86, arm32 and arm64) and SIGFPE (for x86)
are supported.
Adding support for additional exceptions is possible but requires
careful consideration, as not all exception types can be analyzed in
real-time.  A notable example is a page fault, determining whether
SIGSEGV is appropriate requires deep traversal into the memory
management code.

Patches 1, 2, 3, and 4 implement the Xenomai-side changes for this
feature.  Dovetail will receive a separate patch set. Patches 5 and 6
introduce tests.

It is important to note that this is not a fully-fledged signal
implementation.  The only supported use case is delivering exceptions
as signals to the affected thread.
There is no support for sending signals or handling block/ignore masks.
The only user visible API so far is cobalt_rt_signal().
It takes a signal number (SIGILL or SIGFPE so far) and a handler
function with the signature fn(int, siginfo_t *, void *).

TODO:
- Better naming, IMHO "signal" is the wrong term and will confuse users.
  Especially since POSIX real-time signals are something different.
  Maybe "umex" for "user mode exception handling"?
- Document new APIs
- Improve tests
- Carefully select more exceptions

Lorenz Kofler (5):
  cobalt/x86: Add architecture specific signal code
  cobalt/arm64: Add architecture specific signal code
  cobalt: Add signal core code
  testsuite: smokey: Add testcases for signals
  utils: Add rt_signal_hist

Richard Weinberger (1):
  cobalt/arm: Add architecture specific signal code

 configure.ac                                  |   3 +
 include/cobalt/kernel/ppd.h                   |   3 +
 include/cobalt/kernel/thread.h                |   8 +
 include/cobalt/signal.h                       |   2 +
 include/cobalt/uapi/syscall.h                 |   2 +
 kernel/cobalt/arch/arm/Makefile               |   2 +-
 kernel/cobalt/arch/arm/signal.c               |  27 ++
 kernel/cobalt/arch/arm64/Makefile             |   2 +-
 kernel/cobalt/arch/arm64/signal.c             |  28 ++
 kernel/cobalt/arch/x86/Makefile               |   2 +-
 kernel/cobalt/arch/x86/signal.c               |  51 +++
 kernel/cobalt/dovetail/kevents.c              |   5 +
 .../include/asm-generic/xenomai/thread.h      |   3 +
 kernel/cobalt/posix/syscall.c                 |  41 ++
 kernel/cobalt/thread.c                        |  59 +++
 kernel/cobalt/trace/cobalt-posix.h            |   4 +-
 .../arch/arm/include/asm/xenomai/syscall.h    |   9 +
 .../arch/arm64/include/asm/xenomai/syscall.h  |   9 +
 .../arch/x86/include/asm/xenomai/syscall.h    |  15 +
 lib/cobalt/signal.c                           |  19 +
 testsuite/smokey/Makefile.am                  |   2 +
 testsuite/smokey/rtsignals/Makefile.am        |  57 +++
 testsuite/smokey/rtsignals/rtsignals.c        |  35 ++
 testsuite/smokey/rtsignals/rtsignals_test.c   | 370 ++++++++++++++++++
 utils/Makefile.am                             |   2 +-
 utils/rt_signal_hist/Makefile.am              |  22 ++
 utils/rt_signal_hist/error.h                  |  15 +
 utils/rt_signal_hist/histo.c                  |  47 +++
 utils/rt_signal_hist/histo.h                  |  14 +
 utils/rt_signal_hist/result.c                 |  17 +
 utils/rt_signal_hist/result.h                 |  13 +
 utils/rt_signal_hist/rt_signal_hist.c         | 237 +++++++++++
 32 files changed, 1120 insertions(+), 5 deletions(-)
 create mode 100644 kernel/cobalt/arch/arm/signal.c
 create mode 100644 kernel/cobalt/arch/arm64/signal.c
 create mode 100644 kernel/cobalt/arch/x86/signal.c
 create mode 100644 testsuite/smokey/rtsignals/Makefile.am
 create mode 100644 testsuite/smokey/rtsignals/rtsignals.c
 create mode 100644 testsuite/smokey/rtsignals/rtsignals_test.c
 create mode 100644 utils/rt_signal_hist/Makefile.am
 create mode 100644 utils/rt_signal_hist/error.h
 create mode 100644 utils/rt_signal_hist/histo.c
 create mode 100644 utils/rt_signal_hist/histo.h
 create mode 100644 utils/rt_signal_hist/result.c
 create mode 100644 utils/rt_signal_hist/result.h
 create mode 100644 utils/rt_signal_hist/rt_signal_hist.c

-- 
2.48.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2025-04-10  9:45 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-08 12:28 [RFC PATCH 0/6] Xenomai: Real-time Exception Handling Nikolaus Funk
2025-04-08 12:28 ` [PATCH 1/6] cobalt/x86: Add architecture specific signal code Nikolaus Funk
2025-04-08 12:28 ` [PATCH 2/6] cobalt/arm64: " Nikolaus Funk
2025-04-08 12:28 ` [PATCH 3/6] cobalt/arm: " Nikolaus Funk
2025-04-08 12:28 ` [PATCH 4/6] cobalt: Add signal core code Nikolaus Funk
2025-04-08 12:28 ` [PATCH 5/6] testsuite: smokey: Add testcases for signals Nikolaus Funk
2025-04-08 12:28 ` [PATCH 6/6] utils: Add rt_signal_hist Nikolaus Funk
2025-04-08 17:32 ` [RFC PATCH 0/6] Xenomai: Real-time Exception Handling Jan Kiszka
2025-04-08 18:39   ` Richard Weinberger
2025-04-10  9:45     ` Philippe Gerum

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.