change log for rtems (2011-10-17)

rtems-vc at rtems.org rtems-vc at rtems.org
Mon Oct 17 19:11:28 UTC 2011


 *jennifer*:
2011-10-17	Daniel Hellstrom <daniel at gaisler.com>

	PR 1935/cpukit
	* score/include/rtems/score/smplock.h, score/src/smplock.c: SMP nested
	count variable was being overritten when nested lock was taken more
	than once.

M 1.2952  cpukit/ChangeLog
M    1.6  cpukit/score/include/rtems/score/smplock.h
M    1.5  cpukit/score/src/smplock.c

diff -u rtems/cpukit/ChangeLog:1.2951 rtems/cpukit/ChangeLog:1.2952
--- rtems/cpukit/ChangeLog:1.2951	Mon Oct 17 10:54:40 2011
+++ rtems/cpukit/ChangeLog	Mon Oct 17 13:51:44 2011
@@ -1,3 +1,10 @@
+2011-10-17	Daniel Hellstrom <daniel at gaisler.com>
+
+	PR 1935/cpukit
+	* score/include/rtems/score/smplock.h, score/src/smplock.c: SMP nested
+	count variable was being overritten when nested lock was taken more
+	than once.
+
 2011-10-17	Sebastian Huber <sebastian.huber at embedded-brains.de>
 
 	PR 1938/cpukit

diff -u rtems/cpukit/score/include/rtems/score/smplock.h:1.5 rtems/cpukit/score/include/rtems/score/smplock.h:1.6
--- rtems/cpukit/score/include/rtems/score/smplock.h:1.5	Mon Aug  1 12:30:20 2011
+++ rtems/cpukit/score/include/rtems/score/smplock.h	Mon Oct 17 13:51:44 2011
@@ -50,6 +50,7 @@
  *  times.
  */
 typedef struct {
+  SMP_lock_spinlock_simple_Control lock;
   uint32_t  count;
   int       cpu_id;
 } SMP_lock_spinlock_nested_Control;

diff -u rtems/cpukit/score/src/smplock.c:1.4 rtems/cpukit/score/src/smplock.c:1.5
--- rtems/cpukit/score/src/smplock.c:1.4	Mon Aug 22 13:26:08 2011
+++ rtems/cpukit/score/src/smplock.c	Mon Oct 17 13:51:44 2011
@@ -114,6 +114,7 @@
   SMP_lock_spinlock_nested_Control *lock
 )
 {
+  lock->lock = 0;
   lock->count = 0;
   lock->cpu_id = -1;
 }
@@ -143,8 +144,9 @@
   if (lock->count == 1) {
     lock->cpu_id = -1;
     debug_logit( 'U', lock );
-    RTEMS_COMPILER_MEMORY_BARRIER();
     lock->count  = 0;
+    RTEMS_COMPILER_MEMORY_BARRIER();
+    lock->lock = 0;
   } else {
     debug_logit( 'u', lock );
     lock->count--;
@@ -174,7 +176,7 @@
    */
   while (1) {
     RTEMS_COMPILER_MEMORY_BARRIER();
-    SMP_CPU_SWAP( &lock->count, value, previous );
+    SMP_CPU_SWAP( &lock->lock, value, previous );
     RTEMS_COMPILER_MEMORY_BARRIER();
     if ( previous == 0 ) {
       /* was not locked */
@@ -190,6 +192,7 @@
   }
 
   lock->cpu_id = cpu_id;
+  lock->count = 1;
   debug_logit( 'L', lock );
 
   return level;



--

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/20111017/6cddc419/attachment-0001.html>


More information about the vc mailing list