INTERNAL_ERROR_BAD_THREAD_DISPATCH_ENVIRONMENT

Sebastian Huber sebastian.huber at embedded-brains.de
Tue Feb 20 14:23:22 UTC 2018



----- Am 19. Feb 2018 um 12:41 schrieb Matthew J Fletcher amimjf at gmail.com:

> Hi,
> 
> I've seen this in our application in certain use cases, if my understanding
> is correct (an it might not be), it comes
> from RTEMS_SCORE_ROBUST_THREAD_DISPATCH,
> via CPU_ENABLE_ROBUST_THREAD_DISPATCH.
> 
> It only seems to be TRUE for Arm, which seems a bit inconstant. However i
> dont really understand what its trying to achieve, i see
> https://devel.rtems.org/ticket/2954 but it does more than just optimise the
> context switch, it significantly alters how an application should be
> written, no more freeing memory with interrupts disabled etc,

Originally, the CPU_ENABLE_ROBUST_THREAD_DISPATCH was implemented for the SMP support (inter-processor interrupt delivery MUST be possible during operating system services). On ARMv7-M it catches an undefined behaviour case. On the other ARM variants it simplified the context switch code. In general, we could enable the CPU_ENABLE_ROBUST_THREAD_DISPATCH on all architectures. This would probably break some broken applications. You should never call an operating system service with interrupts disabled in thread context. This would destroy all the work done in the RTEMS implementation to keep the interrupt latency small.

You can free memory via free() in interrupt context since it has special case code for this. You cannot use rtems_region_return_segment().

> 
> Do most people just edit cpu.h to make it false ?

Users should never edit cpu.h.



More information about the users mailing list