change log for rtems (2011-05-23)
rtems-vc at rtems.org
rtems-vc at rtems.org
Mon May 23 14:11:57 UTC 2011
*jennifer*:
2011-05-23 Jennifer Averett <Jennifer.Averett at OARcorp.com>
* score/Makefile.am, score/include/rtems/score/thread.h,
score/inline/rtems/score/thread.inl: Add smp support to dispable
dispatch level accesses.
* score/src/threaddispatchdisablelevel.c: New file.
M 1.2841 cpukit/ChangeLog
M 1.103 cpukit/score/Makefile.am
M 1.104 cpukit/score/include/rtems/score/thread.h
M 1.46 cpukit/score/inline/rtems/score/thread.inl
A 1.1 cpukit/score/src/threaddispatchdisablelevel.c
diff -u rtems/cpukit/ChangeLog:1.2840 rtems/cpukit/ChangeLog:1.2841
--- rtems/cpukit/ChangeLog:1.2840 Fri May 20 07:35:56 2011
+++ rtems/cpukit/ChangeLog Mon May 23 08:30:10 2011
@@ -1,3 +1,10 @@
+2011-05-23 Jennifer Averett <Jennifer.Averett at OARcorp.com>
+
+ * score/Makefile.am, score/include/rtems/score/thread.h,
+ score/inline/rtems/score/thread.inl: Add smp support to dispable
+ dispatch level accesses.
+ * score/src/threaddispatchdisablelevel.c: New file.
+
2011-05-20 Jennifer Averett <Jennifer.Averett at OARcorp.com>
PR 1787/cpukit
diff -u rtems/cpukit/score/Makefile.am:1.102 rtems/cpukit/score/Makefile.am:1.103
--- rtems/cpukit/score/Makefile.am:1.102 Wed May 18 08:05:31 2011
+++ rtems/cpukit/score/Makefile.am Mon May 23 08:30:14 2011
@@ -241,6 +241,10 @@
src/threadstackallocate.c src/threadstackfree.c src/threadstart.c \
src/threadstartmultitasking.c src/threadtickletimeslice.c \
src/iterateoverthreads.c src/threadblockingoperationcancel.c
+
+if HAS_SMP
+libscore_a_SOURCES += src/threaddispatchdisablelevel.c
+endif
## THREADQ_C_FILES
libscore_a_SOURCES += src/threadq.c src/threadqdequeue.c \
diff -u rtems/cpukit/score/include/rtems/score/thread.h:1.103 rtems/cpukit/score/include/rtems/score/thread.h:1.104
--- rtems/cpukit/score/include/rtems/score/thread.h:1.103 Thu May 12 08:23:12 2011
+++ rtems/cpukit/score/include/rtems/score/thread.h Mon May 23 08:30:15 2011
@@ -464,6 +464,14 @@
*/
SCORE_EXTERN volatile uint32_t _Thread_Dispatch_disable_level;
+#if defined(RTEMS_SMP)
+ /**
+ * The following declares the smp spinlock to be used to control
+ * the dispatch critical section accesses across cpus.
+ */
+ SCORE_EXTERN SMP_lock_spinlock_nested_Control _Thread_Dispatch_disable_level_lock;
+#endif
+
/**
* The following holds how many user extensions are in the system. This
* is used to determine how many user extension data areas to allocate
@@ -784,6 +792,53 @@
ISR_Level level
);
+
+#if defined(RTEMS_SMP)
+
+ /** @brief _Thread_Dispatch_initialization
+ *
+ * This routine initializes the thread dispatching subsystem.
+ */
+ void _Thread_Dispatch_initialization(void);
+
+ /** @brief _Thread_Dispatch_in_critical_section
+ *
+ * This routine returns true if thread dispatch indicates
+ * that we are in a critical section.
+ */
+ bool _Thread_Dispatch_in_critical_section(void);
+
+ /** @brief _Thread_Dispatch_get_disable_level
+ *
+ * This routine returns value of the the thread dispatch level.
+ */
+ uint32_t _Thread_Dispatch_get_disable_level(void);
+
+ /** @brief _Thread_Dispatch_set_disable_level
+ *
+ * This routine sets thread dispatch level to the
+ * value passed in.
+ */
+ uint32_t _Thread_Dispatch_set_disable_level(uint32_t value);
+
+ /** @brief _Thread_Dispatch_increment_disable_level
+ *
+ * This rountine increments the thread dispatch level
+ */
+ uint32_t _Thread_Dispatch_increment_disable_level(void);
+
+ /** @brief _Thread_Dispatch_decrement_disable_level
+ *
+ * This routine decrements the thread dispatch level.
+ */
+ uint32_t _Thread_Dispatch_decrement_disable_level(void);
+
+#else
+ /*
+ * The _Thread_Dispatch_... functions are in thread.inl
+ */
+#endif
+
#ifndef __RTEMS_APPLICATION__
#include <rtems/score/thread.inl>
#endif
diff -u rtems/cpukit/score/inline/rtems/score/thread.inl:1.45 rtems/cpukit/score/inline/rtems/score/thread.inl:1.46
--- rtems/cpukit/score/inline/rtems/score/thread.inl:1.45 Thu Apr 21 14:05:15 2011
+++ rtems/cpukit/score/inline/rtems/score/thread.inl Mon May 23 08:30:15 2011
@@ -31,63 +31,77 @@
* @{
*/
-/**
- * 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;
+#if defined(RTEMS_SMP)
- return true;
-}
+ /*
+ * The _Thread_Dispatch_... functions are prototyped in thread.h.
+ */
-/**
- * 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;
-}
+#else
-/**
- * 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;
-}
+ /** @brief _Thread_Dispatch_in_critical_section
+ *
+ * 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;
-/**
- * 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;
-}
+ return true;
+ }
-/**
- * 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;
-}
+ /** @brief _Thread_Dispatch_get_disable_level
+ *
+ * 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 initializes the thread dispatching subsystem.
- */
+ /** @brief _Thread_Dispatch_set_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;
+ }
-RTEMS_INLINE_ROUTINE void _Thread_Dispatch_initialization( void )
-{
- _Thread_Dispatch_set_disable_level( 1 );
-}
+ /** @brief _Thread_Dispatch_increment_disable_level
+ *
+ * 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;
+ }
+
+ /** @brief _Thread_Dispatch_decrement_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;
+ }
+
+ /** @brief _Thread_Dispatch_initialization
+ *
+ * This routine initializes the thread dispatching subsystem.
+ */
+ RTEMS_INLINE_ROUTINE void _Thread_Dispatch_initialization( void )
+ {
+ _Thread_Dispatch_set_disable_level( 1 );
+ }
+#endif
/**
* This routine halts multitasking and returns control to
diff -u /dev/null rtems/cpukit/score/src/threaddispatchdisablelevel.c:1.1
--- /dev/null Mon May 23 09:11:56 2011
+++ rtems/cpukit/score/src/threaddispatchdisablelevel.c Mon May 23 08:30:15 2011
@@ -0,0 +1,133 @@
+/*
+ * Thread Dispatch Disable Level Methods
+ *
+ * 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$
+ */
+
+#include <rtems/system.h>
+#include <rtems/score/apiext.h>
+#include <rtems/score/context.h>
+#include <rtems/score/interr.h>
+#include <rtems/score/isr.h>
+#include <rtems/score/object.h>
+#include <rtems/score/priority.h>
+#include <rtems/score/states.h>
+#include <rtems/score/sysstate.h>
+#include <rtems/score/thread.h>
+
+void _Thread_Dispatch_initialization( void )
+{
+ _Thread_Dispatch_disable_level = 0;
+ _SMP_lock_spinlock_nested_Initialize(&_Thread_Dispatch_disable_level_lock);
+ _Thread_Dispatch_set_disable_level( 1 );
+}
+
+bool _Thread_Dispatch_in_critical_section(void)
+{
+ if ( _Thread_Dispatch_disable_level == 0 )
+ return false;
+
+ return true;
+}
+
+uint32_t _Thread_Dispatch_get_disable_level(void)
+{
+ return _Thread_Dispatch_disable_level;
+}
+
+uint32_t _Thread_Dispatch_increment_disable_level(void)
+{
+ ISR_Level isr_level;
+ uint32_t level;
+
+ /*
+ * Note: _SMP_lock_spinlock_nested_Obtain returns
+ * with ISR's disabled and the isr_level that
+ * should be restored after a short period.
+ *
+ * Here we obtain the lock and increment the
+ * Thread dispatch disable level while under the
+ * protection of the isr being off. After this
+ * point it is safe to re-enable ISRs and allow
+ * the dispatch disable lock to provide protection.
+ */
+
+ isr_level = _SMP_lock_spinlock_nested_Obtain(
+ &_Thread_Dispatch_disable_level_lock
+ );
+
+ _Thread_Dispatch_disable_level++;
+ level = _Thread_Dispatch_disable_level;
+
+ _ISR_Enable(isr_level);
+
+ return level;
+}
+
+uint32_t _Thread_Dispatch_decrement_disable_level(void)
+{
+ ISR_Level isr_level;
+ uint32_t level;
+
+ /* First we must disable ISRs in order to protect
+ * accesses to the dispatch disable level.
+ */
+
+ _ISR_Disable( isr_level );
+
+ _Thread_Dispatch_disable_level--;
+ level = _Thread_Dispatch_disable_level;
+
+
+ /*
+ * Note: _SMP_lock_spinlock_nested_Obtain returns with
+ * ISR's disabled and _SMP_lock_spinlock_nested_Release
+ * is responsable for re-enabling interrupts.
+ */
+ _SMP_lock_spinlock_nested_Release(
+ &_Thread_Dispatch_disable_level_lock,
+ isr_level
+ );
+
+ return level;
+}
+
+
+/*
+ * Note this method is taking a heavy handed approach to
+ * setting the dispatch level. This may be optimized at a
+ * later timee, but it must be in such a way that the nesting
+ * level is decremented by the same number as the dispatch level.
+ * This approach is safest until we are sure the nested spinlock
+ * is successfully working with smp isr source code.
+ */
+
+uint32_t _Thread_Dispatch_set_disable_level(uint32_t value)
+{
+ /*
+ * If we need the dispatch level to go higher
+ * call increment method the desired number of times.
+ */
+
+ while ( value > _Thread_Dispatch_disable_level ) {
+ _Thread_Dispatch_increment_disable_level();
+ }
+
+ /*
+ * If we need the dispatch level to go lower
+ * call increment method the desired number of times.
+ */
+
+ while ( value < _Thread_Dispatch_disable_level ) {
+ _Thread_Dispatch_decrement_disable_level();
+ }
+
+ return value;
+}
*jennifer*:
Add PR to changelog.
M 1.2842 cpukit/ChangeLog
diff -u rtems/cpukit/ChangeLog:1.2841 rtems/cpukit/ChangeLog:1.2842
--- rtems/cpukit/ChangeLog:1.2841 Mon May 23 08:30:10 2011
+++ rtems/cpukit/ChangeLog Mon May 23 08:56:40 2011
@@ -1,5 +1,6 @@
2011-05-23 Jennifer Averett <Jennifer.Averett at OARcorp.com>
+ PR 1791/cpukit
* score/Makefile.am, score/include/rtems/score/thread.h,
score/inline/rtems/score/thread.inl: Add smp support to dispable
dispatch level accesses.
--
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/20110523/5fb18381/attachment-0001.html>
More information about the vc
mailing list