summaryrefslogtreecommitdiffstats
path: root/cpukit/rtems/include
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-08-04 10:20:29 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-08-04 10:20:29 +0200
commitee0e41355d1faa5f74085effc4f57c3a7fc1f884 (patch)
treec845395523e084218ca6715977648b807d30605d /cpukit/rtems/include
parentscore: Fix _Thread_queue_Path_release() (diff)
downloadrtems-ee0e41355d1faa5f74085effc4f57c3a7fc1f884.tar.bz2
score: Fix a release/cancel job race condition
Split up the potential thread priority change in the scheduler release/cancel job operation. Protect the rate monotonic period state with a dedicated SMP lock. This avoids a race condition during _Rate_monotonic_Timeout() while _Rate_monotonic_Cancel() is called on another processor.
Diffstat (limited to 'cpukit/rtems/include')
-rw-r--r--cpukit/rtems/include/rtems/rtems/ratemon.h5
-rw-r--r--cpukit/rtems/include/rtems/rtems/ratemonimpl.h12
2 files changed, 11 insertions, 6 deletions
diff --git a/cpukit/rtems/include/rtems/rtems/ratemon.h b/cpukit/rtems/include/rtems/rtems/ratemon.h
index 3203eab394..a2df13f025 100644
--- a/cpukit/rtems/include/rtems/rtems/ratemon.h
+++ b/cpukit/rtems/include/rtems/rtems/ratemon.h
@@ -194,6 +194,11 @@ typedef struct {
/** This field is the object management portion of a Period instance. */
Objects_Control Object;
+ /**
+ * @brief Protects the rate monotonic period state.
+ */
+ ISR_LOCK_MEMBER( Lock )
+
/** This is the timer used to provide the unblocking mechanism. */
Watchdog_Control Timer;
diff --git a/cpukit/rtems/include/rtems/rtems/ratemonimpl.h b/cpukit/rtems/include/rtems/rtems/ratemonimpl.h
index 9963cab612..b6b3ffd404 100644
--- a/cpukit/rtems/include/rtems/rtems/ratemonimpl.h
+++ b/cpukit/rtems/include/rtems/rtems/ratemonimpl.h
@@ -69,19 +69,19 @@ RTEMS_INLINE_ROUTINE Rate_monotonic_Control *_Rate_monotonic_Allocate( void )
}
RTEMS_INLINE_ROUTINE void _Rate_monotonic_Acquire_critical(
- Thread_Control *the_thread,
- ISR_lock_Context *lock_context
+ Rate_monotonic_Control *the_period,
+ ISR_lock_Context *lock_context
)
{
- _Thread_Wait_acquire_default_critical( the_thread, lock_context );
+ _ISR_lock_Acquire( &the_period->Lock, lock_context );
}
RTEMS_INLINE_ROUTINE void _Rate_monotonic_Release(
- Thread_Control *the_thread,
- ISR_lock_Context *lock_context
+ Rate_monotonic_Control *the_period,
+ ISR_lock_Context *lock_context
)
{
- _Thread_Wait_release_default( the_thread, lock_context );
+ _ISR_lock_Release_and_ISR_enable( &the_period->Lock, lock_context );
}
RTEMS_INLINE_ROUTINE Rate_monotonic_Control *_Rate_monotonic_Get(