change log for rtems (2011-08-22)
Sebastian Huber
sebastian.huber at embedded-brains.de
Wed Sep 26 12:21:20 UTC 2012
On 08/22/2011 09:10 PM, rtems-vc at rtems.org wrote:
> 2011-08-22 Jennifer Averett <Jennifer.Averett at OARcorp.com>
>
> PR 1876
> * score/Makefile.am, score/include/rtems/score/isr.h, score/src/isr.c,
> score/src/smp.c, score/src/smplock.c, score/src/threaddispatch.c,
> score/src/threaddispatchdisablelevel.c: Add smp isr support.
> * score/src/isrsmp.c: New file.
>
[...]
> diff -u rtems/cpukit/score/src/threaddispatch.c:1.25 rtems/cpukit/score/src/threaddispatch.c:1.26
> --- rtems/cpukit/score/src/threaddispatch.c:1.25 Thu May 26 13:07:07 2011
> +++ rtems/cpukit/score/src/threaddispatch.c Mon Aug 22 13:26:08 2011
> @@ -169,9 +169,10 @@
> }
>
> post_switch:
> - _Thread_Dispatch_set_disable_level( 0 );
>
> _ISR_Enable( level );
>
> + _Thread_Unnest_dispatch();
> +
> _API_extensions_Run_postswitch();
> }
[...]
This change and previous changes in the file threaddispatch.c are very bad. In
fact they destroy the real-time properties of RTEMS completely.
Consider the following scenario. We have three tasks L (lowest priority), M
(middle priority), and H (highest priority). Now let a thread dispatch from M
to L happen. An interrupt occurs in _Thread_Dispatch() here:
void _Thread_Dispatch( void )
{
[...]
post_switch:
_ISR_Enable( level );
<-- INTERRUPT
<-- AFTER INTERRUPT
_Thread_Unnest_dispatch();
_API_extensions_Run_postswitch();
}
The interrupt event makes task H ready. The interrupt code will see
_Thread_Dispatch_disable_level > 0 and thus doesn't perform a
_Thread_Dispatch(). Now we return to position "AFTER INTERRUPT". This means
task L executes now although task H is ready! Task H will execute once someone
calls _Thread_Dispatch().
We should restore the previous behaviour at least for non-SMP configurations.
I am not sure how to deal with SMP here, but the current solution turns RTEMS
into a non-real time system.
--
Sebastian Huber, embedded brains GmbH
Address : Obere Lagerstr. 30, D-82178 Puchheim, Germany
Phone : +49 89 18 90 80 79-6
Fax : +49 89 18 90 80 79-9
E-Mail : sebastian.huber at embedded-brains.de
PGP : Public key available on request.
Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-score-Critical-fix-for-thread-dispatching.patch
Type: text/x-patch
Size: 2234 bytes
Desc: not available
URL: <http://lists.rtems.org/pipermail/devel/attachments/20120926/e71e8cff/attachment.bin>
More information about the devel
mailing list