change log for rtems (2011-04-21)
rtems-vc at rtems.org
rtems-vc at rtems.org
Thu Apr 21 19:10:19 UTC 2011
*jennifer*:
2011-04-21 Jennifer Averett <Jennifer.Averett at OARcorp.com
PR 1777/cpukit
* src/lib/libbsp/powerpc/shared/startup/panic.c,
src/lib/libcpu/sh/sh7032/score/cpu_asm.c,
src/lib/libcpu/sh/sh7045/score/cpu_asm.c,
src/lib/libcpu/sh/sh7750/score/cpu_asm.c,
src/lib/libcpu/sh/shgdb/score/cpu_asm.c: Consolidated access to
_Thread_Dispatch_disable_level.
M 1.56 c/ChangeLog
M 1.9 c/src/lib/libbsp/powerpc/shared/startup/panic.c
M 1.19 c/src/lib/libcpu/sh/sh7032/score/cpu_asm.c
M 1.21 c/src/lib/libcpu/sh/sh7045/score/cpu_asm.c
M 1.17 c/src/lib/libcpu/sh/sh7750/score/cpu_asm.c
M 1.6 c/src/lib/libcpu/sh/shgdb/score/cpu_asm.c
diff -u rtems/c/ChangeLog:1.55 rtems/c/ChangeLog:1.56
--- rtems/c/ChangeLog:1.55 Wed Feb 2 08:57:35 2011
+++ rtems/c/ChangeLog Thu Apr 21 14:04:41 2011
@@ -1,3 +1,13 @@
+2011-04-21 Jennifer Averett <Jennifer.Averett at OARcorp.com
+
+ PR 1777/cpukit
+ * src/lib/libbsp/powerpc/shared/startup/panic.c,
+ src/lib/libcpu/sh/sh7032/score/cpu_asm.c,
+ src/lib/libcpu/sh/sh7045/score/cpu_asm.c,
+ src/lib/libcpu/sh/sh7750/score/cpu_asm.c,
+ src/lib/libcpu/sh/shgdb/score/cpu_asm.c: Consolidated access to
+ _Thread_Dispatch_disable_level.
+
2011-02-02 Ralf Corsépius <ralf.corsepius at rtems.org>
* configure.ac: Require autoconf-2.68, automake-1.11.1.
diff -u rtems/c/src/lib/libbsp/powerpc/shared/startup/panic.c:1.8 rtems/c/src/lib/libbsp/powerpc/shared/startup/panic.c:1.9
--- rtems/c/src/lib/libbsp/powerpc/shared/startup/panic.c:1.8 Wed Jul 7 09:08:04 2010
+++ rtems/c/src/lib/libbsp/powerpc/shared/startup/panic.c Thu Apr 21 14:04:41 2011
@@ -9,6 +9,8 @@
#include <rtems/bspIo.h>
#include <rtems/error.h>
#include <libcpu/stackTrace.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/thread.inl>
static void
rebootQuestion(void)
@@ -101,10 +103,10 @@
printk(" UNKNOWN (0x%x)\n",THESRC);
break;
}
- if ( _Thread_Dispatch_disable_level )
+ if ( _Thread_Dispatch_in_critical_section() )
printk(
" Error occurred in a Thread Dispatching DISABLED context (level %i)\n",
- _Thread_Dispatch_disable_level);
+ _Thread_Dispatch_get_disable_level());
else
printk("enabled\n");
diff -u rtems/c/src/lib/libcpu/sh/sh7032/score/cpu_asm.c:1.18 rtems/c/src/lib/libcpu/sh/sh7032/score/cpu_asm.c:1.19
--- rtems/c/src/lib/libcpu/sh/sh7032/score/cpu_asm.c:1.18 Fri Feb 11 03:57:25 2011
+++ rtems/c/src/lib/libcpu/sh/sh7032/score/cpu_asm.c Thu Apr 21 14:04:44 2011
@@ -134,7 +134,7 @@
_ISR_Disable( level );
- _Thread_Dispatch_disable_level++;
+ _Thread_Dispatch_increment_disable_level();
#if (CPU_HAS_SOFTWARE_INTERRUPT_STACK == TRUE)
if ( _ISR_Nest_level == 0 )
@@ -156,7 +156,7 @@
_ISR_Disable( level );
- _Thread_Dispatch_disable_level--;
+ _Thread_Dispatch_decrement_disable_level();
_ISR_Nest_level--;
@@ -172,7 +172,7 @@
if ( _ISR_Nest_level )
return;
- if ( _Thread_Dispatch_disable_level ) {
+ if ( _Thread_Dispatch_in_critical_section() ) {
return;
}
diff -u rtems/c/src/lib/libcpu/sh/sh7045/score/cpu_asm.c:1.20 rtems/c/src/lib/libcpu/sh/sh7045/score/cpu_asm.c:1.21
--- rtems/c/src/lib/libcpu/sh/sh7045/score/cpu_asm.c:1.20 Fri Feb 11 03:57:25 2011
+++ rtems/c/src/lib/libcpu/sh/sh7045/score/cpu_asm.c Thu Apr 21 14:04:47 2011
@@ -136,7 +136,7 @@
_ISR_Disable( level );
- _Thread_Dispatch_disable_level++;
+ _Thread_Dispatch_increment_disable_level();
#if (CPU_HAS_SOFTWARE_INTERRUPT_STACK == TRUE)
if ( _ISR_Nest_level == 0 )
@@ -158,7 +158,7 @@
_ISR_Disable( level );
- _Thread_Dispatch_disable_level--;
+ _Thread_Dispatch_decrement_disable_level();
_ISR_Nest_level--;
@@ -174,7 +174,7 @@
if ( _ISR_Nest_level )
return;
- if ( _Thread_Dispatch_disable_level ) {
+ if ( _Thread_Dispatch_in_critical_section() ) {
return;
}
diff -u rtems/c/src/lib/libcpu/sh/sh7750/score/cpu_asm.c:1.16 rtems/c/src/lib/libcpu/sh/sh7750/score/cpu_asm.c:1.17
--- rtems/c/src/lib/libcpu/sh/sh7750/score/cpu_asm.c:1.16 Fri Feb 11 03:57:25 2011
+++ rtems/c/src/lib/libcpu/sh/sh7750/score/cpu_asm.c Thu Apr 21 14:04:50 2011
@@ -60,7 +60,7 @@
_ISR_Disable( level );
- _Thread_Dispatch_disable_level++;
+ _Thread_Dispatch_increment_disable_level();
#if (CPU_HAS_SOFTWARE_INTERRUPT_STACK == TRUE)
if ( _ISR_Nest_level == 0 )
@@ -82,7 +82,7 @@
_ISR_Disable( level );
- _Thread_Dispatch_disable_level--;
+ _Thread_Dispatch_decrement_disable_level();
_ISR_Nest_level--;
@@ -97,7 +97,7 @@
if ( _ISR_Nest_level )
return;
- if ( _Thread_Dispatch_disable_level ) {
+ if ( _Thread_Dispatch_in_critical_section() ) {
return;
}
diff -u rtems/c/src/lib/libcpu/sh/shgdb/score/cpu_asm.c:1.5 rtems/c/src/lib/libcpu/sh/shgdb/score/cpu_asm.c:1.6
--- rtems/c/src/lib/libcpu/sh/shgdb/score/cpu_asm.c:1.5 Fri Feb 11 03:57:25 2011
+++ rtems/c/src/lib/libcpu/sh/shgdb/score/cpu_asm.c Thu Apr 21 14:04:50 2011
@@ -33,7 +33,7 @@
_ISR_Disable( level );
- _Thread_Dispatch_disable_level++;
+ _Thread_Dispatch_increment_disable_level();
#if (CPU_HAS_SOFTWARE_INTERRUPT_STACK == TRUE)
if ( _ISR_Nest_level == 0 )
@@ -55,7 +55,7 @@
_ISR_Disable( level );
- _Thread_Dispatch_disable_level--;
+ _Thread_Dispatch_decrement_disable_level();
_ISR_Nest_level--;
@@ -71,7 +71,7 @@
if ( _ISR_Nest_level )
return;
- if ( _Thread_Dispatch_disable_level ) {
+ if ( _Thread_Dispatch_in_critical_section() ) {
return;
}
*jennifer*:
2011-04-21 Jennifer Averett <Jennifer.Averett at OARcorp.com
PR 1777/cpukit
* libcsupport/src/malloc_deferred.c, libcsupport/src/realloc.c,
score/Makefile.am, score/cpu/lm32/irq.c, score/cpu/nios2/irq.c,
score/include/rtems/score/coremutex.h,
score/include/rtems/score/thread.h,
score/inline/rtems/score/thread.inl, score/src/heapfree.c,
score/src/pheapwalk.c, score/src/smp.c, score/src/threaddispatch.c:
Consolidated access to _Thread_Dispatch_disable_level.
* score/src/threaddisabledispatch.c, score/src/threadenabledispatch.c:
New files.
M 1.2803 cpukit/ChangeLog
M 1.5 cpukit/libcsupport/src/malloc_deferred.c
M 1.8 cpukit/libcsupport/src/realloc.c
M 1.96 cpukit/score/Makefile.am
M 1.8 cpukit/score/cpu/lm32/irq.c
M 1.9 cpukit/score/cpu/nios2/irq.c
M 1.43 cpukit/score/include/rtems/score/coremutex.h
M 1.101 cpukit/score/include/rtems/score/thread.h
M 1.45 cpukit/score/inline/rtems/score/thread.inl
M 1.16 cpukit/score/src/heapfree.c
M 1.6 cpukit/score/src/pheapwalk.c
M 1.2 cpukit/score/src/smp.c
A 1.1 cpukit/score/src/threaddisabledispatch.c
M 1.24 cpukit/score/src/threaddispatch.c
A 1.1 cpukit/score/src/threadenabledispatch.c
diff -u rtems/cpukit/ChangeLog:1.2802 rtems/cpukit/ChangeLog:1.2803
--- rtems/cpukit/ChangeLog:1.2802 Mon Apr 18 17:01:46 2011
+++ rtems/cpukit/ChangeLog Thu Apr 21 14:05:14 2011
@@ -1,3 +1,16 @@
+2011-04-21 Jennifer Averett <Jennifer.Averett at OARcorp.com
+
+ PR 1777/cpukit
+ * libcsupport/src/malloc_deferred.c, libcsupport/src/realloc.c,
+ score/Makefile.am, score/cpu/lm32/irq.c, score/cpu/nios2/irq.c,
+ score/include/rtems/score/coremutex.h,
+ score/include/rtems/score/thread.h,
+ score/inline/rtems/score/thread.inl, score/src/heapfree.c,
+ score/src/pheapwalk.c, score/src/smp.c, score/src/threaddispatch.c:
+ Consolidated access to _Thread_Dispatch_disable_level.
+ * score/src/threaddisabledispatch.c, score/src/threadenabledispatch.c:
+ New files.
+
2011-04-18 Joel Sherrill <joel.sherrilL at OARcorp.com>
* posix/src/mqueuegetattr.c,
diff -u rtems/cpukit/libcsupport/src/malloc_deferred.c:1.4 rtems/cpukit/libcsupport/src/malloc_deferred.c:1.5
--- rtems/cpukit/libcsupport/src/malloc_deferred.c:1.4 Mon Sep 1 06:42:19 2008
+++ rtems/cpukit/libcsupport/src/malloc_deferred.c Thu Apr 21 14:05:14 2011
@@ -26,7 +26,7 @@
bool malloc_is_system_state_OK(void)
{
- if ( _Thread_Dispatch_disable_level > 0 )
+ if ( _Thread_Dispatch_in_critical_section() )
return false;
if ( _ISR_Nest_level > 0 )
diff -u rtems/cpukit/libcsupport/src/realloc.c:1.7 rtems/cpukit/libcsupport/src/realloc.c:1.8
--- rtems/cpukit/libcsupport/src/realloc.c:1.7 Wed Jun 30 10:36:48 2010
+++ rtems/cpukit/libcsupport/src/realloc.c Thu Apr 21 14:05:14 2011
@@ -35,7 +35,7 @@
*/
if (_System_state_Is_up(_System_state_Get())) {
- if (_Thread_Dispatch_disable_level > 0)
+ if (_Thread_Dispatch_in_critical_section())
return (void *) 0;
if (_ISR_Nest_level > 0)
diff -u rtems/cpukit/score/Makefile.am:1.95 rtems/cpukit/score/Makefile.am:1.96
--- rtems/cpukit/score/Makefile.am:1.95 Mon Apr 4 13:44:16 2011
+++ rtems/cpukit/score/Makefile.am Thu Apr 21 14:05:14 2011
@@ -189,6 +189,7 @@
libscore_a_SOURCES += src/thread.c src/threadchangepriority.c \
src/threadclearstate.c src/threadclose.c src/threadcreateidle.c \
src/threaddelayended.c src/threaddispatch.c \
+ src/threadenabledispatch.c src/threaddisabledispatch.c \
src/threadget.c src/threadhandler.c src/threadinitialize.c \
src/threadloadenv.c src/threadready.c src/threadreset.c \
src/threadrestart.c src/threadsetpriority.c \
diff -u rtems/cpukit/score/cpu/lm32/irq.c:1.7 rtems/cpukit/score/cpu/lm32/irq.c:1.8
--- rtems/cpukit/score/cpu/lm32/irq.c:1.7 Fri Feb 11 02:57:36 2011
+++ rtems/cpukit/score/cpu/lm32/irq.c Thu Apr 21 14:05:14 2011
@@ -44,7 +44,7 @@
/* Interrupts are disabled upon entry to this Handler */
- _Thread_Dispatch_disable_level++;
+ _Thread_Dispatch_increment_disable_level();
#if( CPU_HAS_SOFTWARE_INTERRUPT_STACK == TRUE)
if ( _ISR_Nest_level == 0 ) {
@@ -71,7 +71,7 @@
stack_ptr = _old_stack_ptr;
#endif
- _Thread_Dispatch_disable_level--;
+ _Thread_Dispatch_decrement_disable_level();
_CPU_ISR_Enable( level );
diff -u rtems/cpukit/score/cpu/nios2/irq.c:1.8 rtems/cpukit/score/cpu/nios2/irq.c:1.9
--- rtems/cpukit/score/cpu/nios2/irq.c:1.8 Fri Feb 11 03:23:20 2011
+++ rtems/cpukit/score/cpu/nios2/irq.c Thu Apr 21 14:05:14 2011
@@ -50,7 +50,7 @@
_ISR_Nest_level++;
- _Thread_Dispatch_disable_level++;
+ _Thread_Dispatch_increment_disable_level();
if ( _ISR_Vector_table[ vector] )
{
@@ -60,7 +60,7 @@
/* Make sure that interrupts are disabled again */
_CPU_ISR_Disable( level );
- _Thread_Dispatch_disable_level--;
+ _Thread_Dispatch_decrement_disable_level();
_ISR_Nest_level--;
@@ -69,7 +69,7 @@
stack_ptr = _old_stack_ptr;
#endif
- if( _Thread_Dispatch_disable_level == 0 )
+ if( !_Thread_Dispatch_in_critical_section() )
{
if ( _Thread_Dispatch_necessary ) {
_CPU_ISR_Enable( level );
diff -u rtems/cpukit/score/include/rtems/score/coremutex.h:1.42 rtems/cpukit/score/include/rtems/score/coremutex.h:1.43
--- rtems/cpukit/score/include/rtems/score/coremutex.h:1.42 Mon Feb 14 20:31:05 2011
+++ rtems/cpukit/score/include/rtems/score/coremutex.h Thu Apr 21 14:05:14 2011
@@ -368,7 +368,7 @@
#define _CORE_mutex_Seize_body( \
_the_mutex, _id, _wait, _timeout, _level ) \
do { \
- if ( _Thread_Dispatch_disable_level \
+ if ( _Thread_Dispatch_in_critical_section() \
&& (_wait) \
&& (_System_state_Get() >= SYSTEM_STATE_BEGIN_MULTITASKING ) \
) { \
diff -u rtems/cpukit/score/include/rtems/score/thread.h:1.100 rtems/cpukit/score/include/rtems/score/thread.h:1.101
--- rtems/cpukit/score/include/rtems/score/thread.h:1.100 Tue Mar 15 14:27:46 2011
+++ rtems/cpukit/score/include/rtems/score/thread.h Thu Apr 21 14:05:14 2011
@@ -46,6 +46,18 @@
#define RTEMS_SCORE_THREAD_ENABLE_USER_PROVIDED_STACK_VIA_API
#endif
+#if defined(RTEMS_SMP) || \
+ defined(RTEMS_HEAVY_STACK_DEBUG) || \
+ defined(RTEMS_HEAVY_MALLOC_DEBUG)
+ #define __THREAD_DO_NOT_INLINE_DISABLE_DISPATCH__
+#endif
+
+#if defined(RTEMS_SMP) || \
+ (CPU_INLINE_ENABLE_DISPATCH == FALSE) || \
+ (__RTEMS_DO_NOT_INLINE_THREAD_ENABLE_DISPATCH__ == 1)
+ #define __THREAD_DO_NOT_INLINE_ENABLE_DISPATCH__
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
diff -u rtems/cpukit/score/inline/rtems/score/thread.inl:1.44 rtems/cpukit/score/inline/rtems/score/thread.inl:1.45
--- rtems/cpukit/score/inline/rtems/score/thread.inl:1.44 Wed Nov 24 09:51:28 2010
+++ rtems/cpukit/score/inline/rtems/score/thread.inl Thu Apr 21 14:05:15 2011
@@ -32,6 +32,64 @@
*/
/**
+ * This routine returns true if thread dispatch indicates
+ * that we are in a critical section.
+ */
+RTEMS_INLINE_ROUTINE bool _Thread_Dispatch_in_critical_section(void)
+{
+ if ( _Thread_Dispatch_disable_level == 0 )
+ return false;
+
+ return true;
+}
+
+/**
+ * This routine returns value of the the thread dispatch level.
+ */
+RTEMS_INLINE_ROUTINE uint32_t _Thread_Dispatch_get_disable_level(void)
+{
+ return _Thread_Dispatch_disable_level;
+}
+
+/**
+ * This routine sets thread dispatch level to the
+ * value passed in.
+ */
+RTEMS_INLINE_ROUTINE uint32_t _Thread_Dispatch_set_disable_level(uint32_t value)
+{
+ _Thread_Dispatch_disable_level = value;
+ return value;
+}
+
+/**
+ * This rountine increments the thread dispatch level
+ */
+RTEMS_INLINE_ROUTINE uint32_t _Thread_Dispatch_increment_disable_level(void)
+{
+ _Thread_Dispatch_disable_level++;
+ return _Thread_Dispatch_disable_level;
+}
+
+/**
+ * This routine decrements the thread dispatch level.
+ */
+RTEMS_INLINE_ROUTINE uint32_t _Thread_Dispatch_decrement_disable_level(void)
+{
+ _Thread_Dispatch_disable_level--;
+ return _Thread_Dispatch_disable_level;
+}
+
+/**
+ * This routine initializes the thread dispatching subsystem.
+ */
+
+RTEMS_INLINE_ROUTINE void _Thread_Dispatch_initialization( void )
+{
+ _Thread_Dispatch_set_disable_level( 1 );
+}
+
+
+/**
* This routine halts multitasking and returns control to
* the "thread" (i.e. the BSP) which initially invoked the
* routine which initialized the system.
@@ -150,51 +208,15 @@
* This routine prevents dispatching.
*/
-#if defined(RTEMS_HEAVY_STACK_DEBUG) || defined(RTEMS_HEAVY_MALLOC_DEBUG)
- #include <rtems/bspIo.h>
- #include <rtems/fatal.h>
- #include <rtems/stackchk.h>
- #include <rtems/score/sysstate.h>
- #include <rtems/score/heap.h>
-
- /*
- * This is currently not defined in any .h file, so we have to
- * extern it here.
- */
- extern Heap_Control *RTEMS_Malloc_Heap;
-#endif
-
+#if defined ( __THREAD_DO_NOT_INLINE_DISABLE_DISPATCH__ )
+void _Thread_Disable_dispatch( void );
+#else
RTEMS_INLINE_ROUTINE void _Thread_Disable_dispatch( void )
{
- /*
- * This check is very brutal to system performance but is very helpful
- * at finding blown stack problems. If you have a stack problem and
- * need help finding it, then uncomment this code. Every system
- * call will check the stack and since mutexes are used frequently
- * in most systems, you might get lucky.
- */
- #if defined(RTEMS_HEAVY_STACK_DEBUG)
- if (_System_state_Is_up(_System_state_Get()) && (_ISR_Nest_level == 0)) {
- if ( rtems_stack_checker_is_blown() ) {
- printk( "Stack blown!!\n" );
- rtems_fatal_error_occurred( 99 );
- }
- }
- #endif
-
- _Thread_Dispatch_disable_level += 1;
+ _Thread_Dispatch_increment_disable_level();
RTEMS_COMPILER_MEMORY_BARRIER();
-
- /*
- * This check is even more brutal than the other one. This enables
- * malloc heap integrity checking upon entry to every system call.
- */
- #if defined(RTEMS_HEAVY_MALLOC_DEBUG)
- if ( _Thread_Dispatch_disable_level == 1 ) {
- _Heap_Walk( RTEMS_Malloc_Heap,99, false );
- }
- #endif
}
+#endif
/**
* This routine allows dispatching to occur again. If this is
@@ -203,21 +225,18 @@
* processor will be transferred to the heir thread.
*/
-#if ( (defined(CPU_INLINE_ENABLE_DISPATCH) && \
- (CPU_INLINE_ENABLE_DISPATCH == FALSE)) || \
- (__RTEMS_DO_NOT_INLINE_THREAD_ENABLE_DISPATCH__ == 1) )
-void _Thread_Enable_dispatch( void );
+#if defined ( __THREAD_DO_NOT_INLINE_ENABLE_DISPATCH__ )
+ void _Thread_Enable_dispatch( void );
#else
-/* inlining of enable dispatching must be true */
-RTEMS_INLINE_ROUTINE void _Thread_Enable_dispatch( void )
-{
- RTEMS_COMPILER_MEMORY_BARRIER();
- if ( (--_Thread_Dispatch_disable_level) == 0 )
- _Thread_Dispatch();
-}
+ /* inlining of enable dispatching must be true */
+ RTEMS_INLINE_ROUTINE void _Thread_Enable_dispatch( void )
+ {
+ RTEMS_COMPILER_MEMORY_BARRIER();
+ if ( _Thread_Dispatch_decrement_disable_level() == 0 )
+ _Thread_Dispatch();
+ }
#endif
-
/**
* This routine allows dispatching to occur again. However,
* no dispatching operation is performed even if this is the outer
@@ -227,7 +246,7 @@
RTEMS_INLINE_ROUTINE void _Thread_Unnest_dispatch( void )
{
RTEMS_COMPILER_MEMORY_BARRIER();
- _Thread_Dispatch_disable_level -= 1;
+ _Thread_Dispatch_decrement_disable_level();
}
/**
@@ -237,7 +256,7 @@
RTEMS_INLINE_ROUTINE bool _Thread_Is_dispatching_enabled( void )
{
- return ( _Thread_Dispatch_disable_level == 0 );
+ return ( _Thread_Dispatch_in_critical_section() == false );
}
/**
@@ -251,15 +270,6 @@
}
/**
- * This routine initializes the thread dispatching subsystem.
- */
-
-RTEMS_INLINE_ROUTINE void _Thread_Dispatch_initialization( void )
-{
- _Thread_Dispatch_disable_level = 1;
-}
-
-/**
* This function returns true if the_thread is NULL and false otherwise.
*/
diff -u rtems/cpukit/score/src/heapfree.c:1.15 rtems/cpukit/score/src/heapfree.c:1.16
--- rtems/cpukit/score/src/heapfree.c:1.15 Mon Feb 28 23:29:26 2011
+++ rtems/cpukit/score/src/heapfree.c Thu Apr 21 14:05:15 2011
@@ -89,7 +89,7 @@
* is the task stack of a thread that deletes itself. The thread dispatch
* disable level is a way to detect this use case.
*/
- if ( _Thread_Dispatch_disable_level == 0 ) {
+ if ( !_Thread_Dispatch_in_critical_section() ) {
Heap_Block *const next = block->Protection_begin.next_delayed_free_block;
if ( next == NULL ) {
_Heap_Protection_delay_block_free( heap, block );
diff -u rtems/cpukit/score/src/pheapwalk.c:1.5 rtems/cpukit/score/src/pheapwalk.c:1.6
--- rtems/cpukit/score/src/pheapwalk.c:1.5 Sun Nov 29 07:51:52 2009
+++ rtems/cpukit/score/src/pheapwalk.c Thu Apr 21 14:05:15 2011
@@ -39,7 +39,7 @@
*
* NOTE: Dispatching is also disabled during initialization.
*/
- if ( !_Thread_Dispatch_disable_level ) {
+ if ( _Thread_Dispatch_in_critical_section() == false ) {
_RTEMS_Lock_allocator();
status = _Heap_Walk( the_heap, source, do_dump );
_RTEMS_Unlock_allocator();
diff -u rtems/cpukit/score/src/smp.c:1.1 rtems/cpukit/score/src/smp.c:1.2
--- rtems/cpukit/score/src/smp.c:1.1 Wed Mar 16 15:05:06 2011
+++ rtems/cpukit/score/src/smp.c Thu Apr 21 14:05:15 2011
@@ -37,7 +37,7 @@
* This is definitely a hack until we have SMP scheduling. Since there
* is only one executing and heir right now, we have to fake this out.
*/
- _Thread_Dispatch_disable_level = 1;
+ _Thread_Dispatch_set_disable_level(1);
_Thread_Executing = heir;
_CPU_Context_switch_to_first_task_smp( &heir->Registers );
}
@@ -103,7 +103,7 @@
if ( message & RTEMS_BSP_SMP_SHUTDOWN ) {
ISR_Level level;
- _Thread_Dispatch_disable_level = 0;
+ _Thread_Dispatch_set_disable_level(0);
_Per_CPU_Information[cpu].isr_nest_level = 0;
_Per_CPU_Information[cpu].state = RTEMS_BSP_SMP_CPU_SHUTDOWN;
_ISR_Disable( level );
diff -u /dev/null rtems/cpukit/score/src/threaddisabledispatch.c:1.1
--- /dev/null Thu Apr 21 14:10:18 2011
+++ rtems/cpukit/score/src/threaddisabledispatch.c Thu Apr 21 14:05:15 2011
@@ -0,0 +1,54 @@
+/*
+ * _Thread_Disable_dispatch
+ *
+ *
+ * COPYRIGHT (c) 1989-2011.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/system.h>
+#include <rtems/score/thread.h>
+
+#if defined ( __THREAD_DO_NOT_INLINE_DISABLE_DISPATCH__ )
+void _Thread_Disable_dispatch( void )
+{
+ /*
+ * This check is very brutal to system performance but is very helpful
+ * at finding blown stack problems. If you have a stack problem and
+ * need help finding it, then uncomment this code. Every system
+ * call will check the stack and since mutexes are used frequently
+ * in most systems, you might get lucky.
+ */
+ #if defined(RTEMS_HEAVY_STACK_DEBUG)
+ if (_System_state_Is_up(_System_state_Get()) && (_ISR_Nest_level == 0)) {
+ if ( rtems_stack_checker_is_blown() ) {
+ printk( "Stack blown!!\n" );
+ rtems_fatal_error_occurred( 99 );
+ }
+ }
+ #endif
+
+ _Thread_Dispatch_increment_disable_level();
+ RTEMS_COMPILER_MEMORY_BARRIER();
+
+ /*
+ * This check is even more brutal than the other one. This enables
+ * malloc heap integrity checking upon entry to every system call.
+ */
+ #if defined(RTEMS_HEAVY_MALLOC_DEBUG)
+ if ( _Thread_Dispatch_get_disable_level() == 1 ) {
+ _Heap_Walk( RTEMS_Malloc_Heap,99, false );
+ }
+ #endif
+}
+#endif
diff -u rtems/cpukit/score/src/threaddispatch.c:1.23 rtems/cpukit/score/src/threaddispatch.c:1.24
--- rtems/cpukit/score/src/threaddispatch.c:1.23 Fri Jan 28 14:24:53 2011
+++ rtems/cpukit/score/src/threaddispatch.c Thu Apr 21 14:05:15 2011
@@ -1,7 +1,6 @@
/*
* Thread Handler
*
- *
* COPYRIGHT (c) 1989-2009.
* On-Line Applications Research Corporation (OAR).
*
@@ -34,35 +33,7 @@
#include <rtems/score/timestamp.h>
#endif
-/*PAGE
- *
- * _Thread_Enable_dispatch
- *
- * This kernel routine exits a context switch disable critical section.
- * This is the NOT INLINED version.
- *
- * Input parameters: NONE
- *
- * Output parameters: NONE
- *
- * INTERRUPT LATENCY:
- * dispatch thread
- * no dispatch thread
- */
-
-#if ( (defined(CPU_INLINE_ENABLE_DISPATCH) && \
- (CPU_INLINE_ENABLE_DISPATCH == FALSE)) || \
- (__RTEMS_DO_NOT_INLINE_THREAD_ENABLE_DISPATCH__ == 1) )
-void _Thread_Enable_dispatch( void )
-{
- if ( --_Thread_Dispatch_disable_level )
- return;
- _Thread_Dispatch();
-}
-#endif
-
-/*PAGE
- *
+/**
* _Thread_Dispatch
*
* This kernel routine determines if a dispatch is needed, and if so
@@ -72,10 +43,6 @@
* ALTERNATE ENTRY POINTS:
* void _Thread_Enable_dispatch();
*
- * Input parameters: NONE
- *
- * Output parameters: NONE
- *
* INTERRUPT LATENCY:
* dispatch thread
* no dispatch thread
@@ -91,7 +58,7 @@
_ISR_Disable( level );
while ( _Thread_Dispatch_necessary == true ) {
heir = _Thread_Heir;
- _Thread_Dispatch_disable_level = 1;
+ _Thread_Dispatch_set_disable_level( 1 );
_Thread_Dispatch_necessary = false;
_Thread_Executing = heir;
@@ -185,7 +152,7 @@
}
post_switch:
- _Thread_Dispatch_disable_level = 0;
+ _Thread_Dispatch_set_disable_level( 0 );
_ISR_Enable( level );
diff -u /dev/null rtems/cpukit/score/src/threadenabledispatch.c:1.1
--- /dev/null Thu Apr 21 14:10:18 2011
+++ rtems/cpukit/score/src/threadenabledispatch.c Thu Apr 21 14:05:15 2011
@@ -0,0 +1,49 @@
+/*
+ * _Thread_Enable_dispatch
+ *
+ *
+ * COPYRIGHT (c) 1989-2011.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/score/thread.h>
+
+#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
+ #include <rtems/score/timestamp.h>
+#endif
+
+
+/**
+ * The following declares the dispatch critical section nesting
+ * counter which is used to prevent context switches at inopportune
+ * moments.
+ */
+
+/**
+ * _Thread_Enable_dispatch
+ *
+ * This kernel routine exits a context switch disable critical section.
+ * This is the NOT INLINED version.
+ *
+ * INTERRUPT LATENCY:
+ * dispatch thread
+ * no dispatch thread
+ */
+#if defined (__THREAD_DO_NOT_INLINE_ENABLE_DISPATCH__ )
+void _Thread_Enable_dispatch( void )
+{
+ if ( --_Thread_Dispatch_disable_level )
+ return;
+ _Thread_Dispatch();
+}
+#endif
*jennifer*:
2011-04-21 Jennifer Averett <Jennifer.Averett at OARcorp.com
PR 1777/cpukit
* support/include/tmacros.h, tmtests/tm26/task1.c,
tmtests/tm27/task1.c: Consolidated access to
_Thread_Dispatch_disable_level.
M 1.182 testsuites/ChangeLog
M 1.56 testsuites/support/include/tmacros.h
M 1.39 testsuites/tmtests/tm26/task1.c
M 1.35 testsuites/tmtests/tm27/task1.c
diff -u rtems/testsuites/ChangeLog:1.181 rtems/testsuites/ChangeLog:1.182
--- rtems/testsuites/ChangeLog:1.181 Wed Apr 20 16:30:36 2011
+++ rtems/testsuites/ChangeLog Thu Apr 21 14:05:33 2011
@@ -1,3 +1,10 @@
+2011-04-21 Jennifer Averett <Jennifer.Averett at OARcorp.com
+
+ PR 1777/cpukit
+ * support/include/tmacros.h, tmtests/tm26/task1.c,
+ tmtests/tm27/task1.c: Consolidated access to
+ _Thread_Dispatch_disable_level.
+
2011-04-20 Joel Sherrill <joel.sherrill at oarcorp.com>
* configure.ac: Add fstests.
diff -u rtems/testsuites/support/include/tmacros.h:1.55 rtems/testsuites/support/include/tmacros.h:1.56
--- rtems/testsuites/support/include/tmacros.h:1.55 Tue Feb 8 00:39:57 2011
+++ rtems/testsuites/support/include/tmacros.h Thu Apr 21 14:05:33 2011
@@ -25,6 +25,7 @@
#include <string.h>
#include <rtems/error.h>
#include <rtems/score/thread.h> /* _Thread_Dispatch_disable_level */
+#include <rtems/score/thread.inl> /* _Thread_Dispatch_disable_level */
#ifdef __cplusplus
extern "C" {
@@ -48,13 +49,13 @@
#define check_dispatch_disable_level( _expect ) \
do { \
if ( (_expect) != -1 \
- && ((_Thread_Dispatch_disable_level == 0 && (_expect) != 0) \
- || (_Thread_Dispatch_disable_level != 0 && (_expect) == 0)) \
+ && ((_Thread_Dispatch_in_critical_section() == false && (_expect) != 0) \
+ || (_Thread_Dispatch_in_critical_section() && (_expect) == 0)) \
) { \
printk( \
"\n_Thread_Dispatch_disable_level is (%" PRId32 \
") not %d detected at %s:%d\n", \
- _Thread_Dispatch_disable_level, (_expect), __FILE__, __LINE__ ); \
+ _Thread_Dispatch_get_disable_level(), (_expect), __FILE__, __LINE__ ); \
FLUSH_OUTPUT(); \
rtems_test_exit( 1 ); \
} \
diff -u rtems/testsuites/tmtests/tm26/task1.c:1.38 rtems/testsuites/tmtests/tm26/task1.c:1.39
--- rtems/testsuites/tmtests/tm26/task1.c:1.38 Wed Mar 16 12:11:32 2011
+++ rtems/testsuites/tmtests/tm26/task1.c Thu Apr 21 14:05:34 2011
@@ -453,7 +453,8 @@
_Thread_Heir = _Thread_Executing;
_Thread_Dispatch_necessary = false;
- _Thread_Dispatch_disable_level = 0;
+
+ _Thread_Dispatch_set_disable_level( 0 );
/*
* Now dump all the times
diff -u rtems/testsuites/tmtests/tm27/task1.c:1.34 rtems/testsuites/tmtests/tm27/task1.c:1.35
--- rtems/testsuites/tmtests/tm27/task1.c:1.34 Wed Mar 16 12:11:32 2011
+++ rtems/testsuites/tmtests/tm27/task1.c Thu Apr 21 14:05:34 2011
@@ -111,7 +111,7 @@
Interrupt_nest = 0;
- _Thread_Dispatch_disable_level = 0;
+ _Thread_Dispatch_set_disable_level( 0 );
Interrupt_occurred = 0;
@@ -144,7 +144,7 @@
* No preempt .. nested
*/
- _Thread_Dispatch_disable_level = 1;
+ _Thread_Dispatch_set_disable_level( 1 );
Interrupt_nest = 1;
@@ -158,7 +158,7 @@
#endif
Interrupt_return_time = benchmark_timer_read();
- _Thread_Dispatch_disable_level = 0;
+ _Thread_Dispatch_set_disable_level( 0 );
put_time(
"interrupt entry overhead: returns to nested interrupt",
@@ -180,7 +180,7 @@
* Does a preempt .. not nested
*/
- _Thread_Dispatch_disable_level = 0;
+ _Thread_Dispatch_set_disable_level( 0 );
ready_queues = (Chain_Control *) _Scheduler.information;
_Thread_Executing =
@@ -241,7 +241,7 @@
* Switch back to the other task to exit the test.
*/
- _Thread_Dispatch_disable_level = 0;
+ _Thread_Dispatch_set_disable_level( 0 );
ready_queues = (Chain_Control *) _Scheduler.information;
_Thread_Executing =
*jennifer*:
2011-04-21 Jennifer Averett <Jennifer.Averett at OARcorp.com
PR 1777/cpukit
* tools/schedsim/rtems/rtems_init.c: Consolidated access to
_Thread_Dispatch_disable_level.
M 1.397 ChangeLog
M 1.2 tools/schedsim/rtems/rtems_init.c
diff -u rtems/ChangeLog:1.396 rtems/ChangeLog:1.397
--- rtems/ChangeLog:1.396 Wed Mar 16 15:06:55 2011
+++ rtems/ChangeLog Thu Apr 21 14:09:13 2011
@@ -1,3 +1,9 @@
+2011-04-21 Jennifer Averett <Jennifer.Averett at OARcorp.com
+
+ PR 1777/cpukit
+ * tools/schedsim/rtems/rtems_init.c: Consolidated access to
+ _Thread_Dispatch_disable_level.
+
2011-03-16 Jennifer Averett <jennifer.averett at OARcorp.com>
PR 1729/cpukit
diff -u rtems/tools/schedsim/rtems/rtems_init.c:1.1 rtems/tools/schedsim/rtems/rtems_init.c:1.2
--- rtems/tools/schedsim/rtems/rtems_init.c:1.1 Fri Dec 17 08:51:56 2010
+++ rtems/tools/schedsim/rtems/rtems_init.c Thu Apr 21 14:09:13 2011
@@ -101,7 +101,7 @@
/*
* Now we are back in a non-dispatching critical section
*/
- _Thread_Dispatch_disable_level = 0;
+ _Thread_Dispatch_set_disable_level(0);
/*
* Print an initial message
--
Generated by Deluxe Loginfo [http://www.codewiz.org/projects/index.html#loginfo] 2.122 by Bernardo Innocenti <bernie at develer.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/vc/attachments/20110421/6b470510/attachment.html>
More information about the vc
mailing list