summaryrefslogtreecommitdiffstats
path: root/cpukit/score/include/rtems/score/corebarrierimpl.h
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-04-01 11:38:47 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-04-06 09:08:21 +0200
commit8f9658187a46f3c3ee3d7c7b68491fab5175a8fd (patch)
treec1887c2441887909201698b8d16b8cb2e8598188 /cpukit/score/include/rtems/score/corebarrierimpl.h
parentscore: Simplify _Thread_queue_Do_flush() (diff)
downloadrtems-8f9658187a46f3c3ee3d7c7b68491fab5175a8fd.tar.bz2
score: Rework MP thread queue callout support
The thread queue implementation was heavily reworked to support SMP. This broke the multiprocessing support of the thread queues. This is fixed by this patch. A thread proxy is unblocked due to three reasons 1) timeout, 2) request satisfaction, and 3) extraction. In case 1) no MPCI message must be sent. This is ensured via the _Thread_queue_MP_callout_do_nothing() callout set during _Thread_MP_Allocate_proxy(). In case 2) and 3) an MPCI message must be sent. In case we interrupt the blocking operation during _Thread_queue_Enqueue_critical(), then this message must be sent by the blocking thread. For this the new fields Thread_Proxy_control::thread_queue_callout and Thread_Proxy_control::thread_queue_id are used. Delete the individual API MP callout types and use Thread_queue_MP_callout throughout. This type is only defined in multiprocessing configurations. Prefix the multiprocessing parameters with mp_ to ease code review. Multiprocessing specific parameters are optional due to use of a similar macro pattern. There is no overhead for non-multiprocessing configurations.
Diffstat (limited to 'cpukit/score/include/rtems/score/corebarrierimpl.h')
-rw-r--r--cpukit/score/include/rtems/score/corebarrierimpl.h103
1 files changed, 78 insertions, 25 deletions
diff --git a/cpukit/score/include/rtems/score/corebarrierimpl.h b/cpukit/score/include/rtems/score/corebarrierimpl.h
index 7e1c0ab31a..8754cecdac 100644
--- a/cpukit/score/include/rtems/score/corebarrierimpl.h
+++ b/cpukit/score/include/rtems/score/corebarrierimpl.h
@@ -65,15 +65,6 @@ typedef enum {
#define CORE_BARRIER_TQ_OPERATIONS &_Thread_queue_Operations_FIFO
/**
- * The following type defines the callout which the API provides
- * to support global/multiprocessor operations on barriers.
- */
-typedef void ( *CORE_barrier_API_mp_support_callout )(
- Thread_Control *,
- Objects_Id
- );
-
-/**
* @brief Initialize core barrier.
*
* This routine initializes the barrier based on the parameters passed.
@@ -93,6 +84,18 @@ RTEMS_INLINE_ROUTINE void _CORE_barrier_Destroy(
_Thread_queue_Destroy( &the_barrier->Wait_queue );
}
+void _CORE_barrier_Do_wait(
+ CORE_barrier_Control *the_barrier,
+ Thread_Control *executing,
+ bool wait,
+ Watchdog_Interval timeout
+#if defined(RTEMS_MULTIPROCESSING)
+ ,
+ Thread_queue_MP_callout mp_callout,
+ Objects_Id mp_id
+#endif
+);
+
/**
* @brief Wait for the barrier.
*
@@ -103,22 +106,56 @@ RTEMS_INLINE_ROUTINE void _CORE_barrier_Destroy(
*
* @param[in] the_barrier is the barrier to wait for
* @param[in,out] executing The currently executing thread.
- * @param[in] id is the id of the object being waited upon
* @param[in] wait is true if the calling thread is willing to wait
* @param[in] timeout is the number of ticks the calling thread is willing
* to wait if @a wait is true.
- * @param[in] api_barrier_mp_support is the routine to invoke if the
+ * @param[in] mp_callout is the routine to invoke if the
* thread unblocked is remote
+ * @param[in] mp_id is the id of the object being waited upon
*
* @note Status is returned via the thread control block.
*/
-void _CORE_barrier_Wait(
- CORE_barrier_Control *the_barrier,
- Thread_Control *executing,
- Objects_Id id,
- bool wait,
- Watchdog_Interval timeout,
- CORE_barrier_API_mp_support_callout api_barrier_mp_support
+#if defined(RTEMS_MULTIPROCESSING)
+ #define _CORE_barrier_Wait( \
+ the_barrier, \
+ executing, \
+ wait, \
+ timeout, \
+ mp_callout, \
+ mp_id \
+ ) \
+ _CORE_barrier_Do_wait( \
+ the_barrier, \
+ executing, \
+ wait, \
+ timeout, \
+ mp_callout, \
+ mp_id \
+ )
+#else
+ #define _CORE_barrier_Wait( \
+ the_barrier, \
+ executing, \
+ wait, \
+ timeout, \
+ mp_callout, \
+ mp_id \
+ ) \
+ _CORE_barrier_Do_wait( \
+ the_barrier, \
+ executing, \
+ wait, \
+ timeout \
+ )
+#endif
+
+uint32_t _CORE_barrier_Do_release(
+ CORE_barrier_Control *the_barrier
+#if defined(RTEMS_MULTIPROCESSING)
+ ,
+ Thread_queue_MP_callout mp_callout,
+ Objects_Id mp_id
+#endif
);
/**
@@ -128,17 +165,33 @@ void _CORE_barrier_Wait(
* for the barrier will be readied.
*
* @param[in] the_barrier is the barrier to surrender
- * @param[in] id is the id of the object for a remote unblock
- * @param[in] api_barrier_mp_support is the routine to invoke if the
+ * @param[in] mp_callout is the routine to invoke if the
* thread unblocked is remote
+ * @param[in] mp_id is the id of the object for a remote unblock
*
* @retval the number of unblocked threads
*/
-uint32_t _CORE_barrier_Release(
- CORE_barrier_Control *the_barrier,
- Objects_Id id,
- CORE_barrier_API_mp_support_callout api_barrier_mp_support
-);
+#if defined(RTEMS_MULTIPROCESSING)
+ #define _CORE_barrier_Release( \
+ the_barrier, \
+ mp_callout, \
+ mp_id \
+ ) \
+ _CORE_barrier_Do_release( \
+ the_barrier, \
+ mp_callout, \
+ mp_id \
+ )
+#else
+ #define _CORE_barrier_Release( \
+ the_barrier, \
+ mp_callout, \
+ mp_id \
+ ) \
+ _CORE_barrier_Do_release( \
+ the_barrier \
+ )
+#endif
/* Must be a macro due to the multiprocessing dependent parameters */
#define _CORE_barrier_Flush( \