[riot-notifications] [RIOT-OS/RIOT] core: Add fault_exception_recovery (#15854)

Koen Zandberg notifications at github.com
Mon Jan 25 13:24:36 CET 2021


### Contribution description

This PR adds a way to mark a thread as non-essential and allow it to be marked as crashed when it triggers an fault exception on the MCU. This way non-critical threads can fail gracefully without affecting the rest of the system by triggering a reboot.

`core/thread` is extended with the logic and state to initialize a thread as `THREAD_CONFIG_KILL_ON_CRASH`, where the thread will be put into the `STATUS_CRASHED` state if it triggers an exception. Afterwards the scheduler continues as usual and the system will not panic.

the fault_exception_recovery is added to signal that a CPU implements the necessary logic to catch crashed threads. This PR contains an implementation for the cortex-m platform, covering all current cortex-m CPUs.

This module does not protect against lockups where a thread crashes after locking a mutex or crashes inside a critical section.

### Testing procedure

A test application is supplied to test and demo the functionality.

### Issues/PRs references

None
You can view, comment on, or merge this pull request online at:

  https://github.com/RIOT-OS/RIOT/pull/15854

-- Commit Summary --

  * makefiles/kconfig: Add fault_exception_recovery feature
  * core/thread: Add module to mark thread as crashed after fault
  * cpu/cortexm: Add simple feature macros for thumb and exceptions
  * cpu/cortexm: Add epilogue to hard fault handler
  * cpu/cortexm: Implement fault_exception_recovery feature
  * thread_crash: Add test application

-- File Changes --

    M Makefile.dep (4)
    M core/include/sched.h (1)
    M core/include/thread.h (40)
    M core/thread.c (21)
    M cpu/cortexm_common/Makefile.features (1)
    M cpu/cortexm_common/vectors_cortexm.c (148)
    M kconfigs/Kconfig.features (6)
    M makefiles/features_modules.inc.mk (3)
    M makefiles/pseudomodules.inc.mk (2)
    A tests/thread_crash/Makefile (7)
    A tests/thread_crash/main.c (66)
    A tests/thread_crash/tests/01-run.py (20)

-- Patch Links --

https://github.com/RIOT-OS/RIOT/pull/15854.patch
https://github.com/RIOT-OS/RIOT/pull/15854.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/15854
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210125/36935972/attachment-0001.htm>


More information about the notifications mailing list