score: Add STATES_THREAD_QUEUE_WITH_IDENTIFIER

Add thread state bit to identify thread queues that are embedded in an
object with identifier.
This commit is contained in:
Sebastian Huber
2016-12-23 16:02:07 +01:00
parent c6000d2b54
commit 9a448aabe6
16 changed files with 43 additions and 49 deletions

View File

@@ -521,7 +521,7 @@ rtems_debugger_thread_state_str(rtems_debugger_thread* thread,
{ "Wbar", STATES_WAITING_FOR_BARRIER }, { "Wbar", STATES_WAITING_FOR_BARRIER },
{ "Wcvar", STATES_WAITING_FOR_CONDITION_VARIABLE }, { "Wcvar", STATES_WAITING_FOR_CONDITION_VARIABLE },
{ "Wevnt", STATES_WAITING_FOR_EVENT }, { "Wevnt", STATES_WAITING_FOR_EVENT },
{ "Wisig", STATES_INTERRUPTIBLE_BY_SIGNAL }, { "ISIG" , STATES_INTERRUPTIBLE_BY_SIGNAL },
{ "Wjatx", STATES_WAITING_FOR_JOIN_AT_EXIT }, { "Wjatx", STATES_WAITING_FOR_JOIN_AT_EXIT },
{ "Wjoin", STATES_WAITING_FOR_JOIN }, { "Wjoin", STATES_WAITING_FOR_JOIN },
{ "Wmsg" , STATES_WAITING_FOR_MESSAGE }, { "Wmsg" , STATES_WAITING_FOR_MESSAGE },
@@ -532,10 +532,8 @@ rtems_debugger_thread_state_str(rtems_debugger_thread* thread,
{ "Wseg", STATES_WAITING_FOR_SEGMENT }, { "Wseg", STATES_WAITING_FOR_SEGMENT },
{ "Wsem", STATES_WAITING_FOR_SEMAPHORE }, { "Wsem", STATES_WAITING_FOR_SEMAPHORE },
{ "Wsig", STATES_WAITING_FOR_SIGNAL }, { "Wsig", STATES_WAITING_FOR_SIGNAL },
{ "Wslcnd", STATES_WAITING_FOR_SYS_LOCK_CONDITION }, { "Wfutex", STATES_WAITING_FOR_FUTEX },
{ "Wslftx", STATES_WAITING_FOR_SYS_LOCK_FUTEX }, { "TQID", STATES_THREAD_QUEUE_WITH_IDENTIFIER },
{ "Wslmtx", STATES_WAITING_FOR_SYS_LOCK_MUTEX },
{ "Wslsem", STATES_WAITING_FOR_SYS_LOCK_SEMAPHORE },
{ "Wsysev", STATES_WAITING_FOR_SYSTEM_EVENT }, { "Wsysev", STATES_WAITING_FOR_SYSTEM_EVENT },
{ "Wtime", STATES_WAITING_FOR_TIME }, { "Wtime", STATES_WAITING_FOR_TIME },
{ "Wwkup", STATES_WAITING_FOR_BSD_WAKEUP }, { "Wwkup", STATES_WAITING_FOR_BSD_WAKEUP },

View File

@@ -112,29 +112,31 @@ rtems_monitor_dump_priority(rtems_task_priority priority)
return fprintf(stdout,"%3" PRId32, priority); return fprintf(stdout,"%3" PRId32, priority);
} }
#define WITH_ID(state) (STATES_THREAD_QUEUE_WITH_IDENTIFIER | state)
static const rtems_assoc_t rtems_monitor_state_assoc[] = { static const rtems_assoc_t rtems_monitor_state_assoc[] = {
{ "DELAY", STATES_DELAYING, 0 }, { "DELAY", STATES_DELAYING, 0 },
{ "DORM", STATES_DORMANT, 0 }, { "DORM", STATES_DORMANT, 0 },
{ "LIFE", STATES_LIFE_IS_CHANGING, 0 }, { "LIFE", STATES_LIFE_IS_CHANGING, 0 },
{ "SUSP", STATES_SUSPENDED, 0 }, { "SUSP", STATES_SUSPENDED, 0 },
{ "Wbar", STATES_WAITING_FOR_BARRIER, 0 }, { "Wbar", WITH_ID(STATES_WAITING_FOR_BARRIER), 0 },
{ "Wcvar", STATES_WAITING_FOR_CONDITION_VARIABLE, 0 }, { "Wcvar", WITH_ID(STATES_WAITING_FOR_CONDITION_VARIABLE), 0 },
{ "Wevnt", STATES_WAITING_FOR_EVENT, 0 }, { "Wevnt", STATES_WAITING_FOR_EVENT, 0 },
{ "Wisig", STATES_INTERRUPTIBLE_BY_SIGNAL, 0 }, { "Wisig", STATES_INTERRUPTIBLE_BY_SIGNAL, 0 },
{ "Wjatx", STATES_WAITING_FOR_JOIN_AT_EXIT, 0 }, { "Wjatx", STATES_WAITING_FOR_JOIN_AT_EXIT, 0 },
{ "Wjoin", STATES_WAITING_FOR_JOIN, 0 }, { "Wjoin", STATES_WAITING_FOR_JOIN, 0 },
{ "Wmsg" , STATES_WAITING_FOR_MESSAGE, 0 }, { "Wmsg" , WITH_ID(STATES_WAITING_FOR_MESSAGE), 0 },
{ "Wmutex", STATES_WAITING_FOR_MUTEX, 0 }, { "Wmutex", WITH_ID(STATES_WAITING_FOR_MUTEX), 0 },
{ "WRATE", STATES_WAITING_FOR_PERIOD, 0 }, { "WRATE", STATES_WAITING_FOR_PERIOD, 0 },
{ "Wrpc", STATES_WAITING_FOR_RPC_REPLY, 0 }, { "Wrpc", STATES_WAITING_FOR_RPC_REPLY, 0 },
{ "Wrwlk", STATES_WAITING_FOR_RWLOCK, 0 }, { "Wrwlk", WITH_ID(STATES_WAITING_FOR_RWLOCK), 0 },
{ "Wseg", STATES_WAITING_FOR_SEGMENT, 0 }, { "Wseg", STATES_WAITING_FOR_SEGMENT, 0 },
{ "Wsem", STATES_WAITING_FOR_SEMAPHORE, 0 }, { "Wsem", WITH_ID(STATES_WAITING_FOR_SEMAPHORE), 0 },
{ "Wsig", STATES_WAITING_FOR_SIGNAL, 0 }, { "Wsig", STATES_WAITING_FOR_SIGNAL, 0 },
{ "Wslcnd", STATES_WAITING_FOR_SYS_LOCK_CONDITION, 0 }, { "Wcvar", STATES_WAITING_FOR_CONDITION_VARIABLE, 0 },
{ "Wslftx", STATES_WAITING_FOR_SYS_LOCK_FUTEX, 0 }, { "Wfutex", STATES_WAITING_FOR_FUTEX, 0 },
{ "Wslmtx", STATES_WAITING_FOR_SYS_LOCK_MUTEX, 0 }, { "Wmutex", STATES_WAITING_FOR_MUTEX, 0 },
{ "Wslsem", STATES_WAITING_FOR_SYS_LOCK_SEMAPHORE, 0 }, { "Wsem", STATES_WAITING_FOR_SEMAPHORE, 0 },
{ "Wsysev", STATES_WAITING_FOR_SYSTEM_EVENT, 0 }, { "Wsysev", STATES_WAITING_FOR_SYSTEM_EVENT, 0 },
{ "Wtime", STATES_WAITING_FOR_TIME, 0 }, { "Wtime", STATES_WAITING_FOR_TIME, 0 },
{ "Wwkup", STATES_WAITING_FOR_BSD_WAKEUP, 0 }, { "Wwkup", STATES_WAITING_FOR_BSD_WAKEUP, 0 },

View File

@@ -119,7 +119,8 @@ int _POSIX_Condition_variables_Wait_support(
if ( !already_timedout ) { if ( !already_timedout ) {
_Thread_queue_Context_set_thread_state( _Thread_queue_Context_set_thread_state(
&queue_context, &queue_context,
STATES_WAITING_FOR_CONDITION_VARIABLE STATES_THREAD_QUEUE_WITH_IDENTIFIER
| STATES_WAITING_FOR_CONDITION_VARIABLE
); );
_Thread_queue_Context_set_enqueue_callout( _Thread_queue_Context_set_enqueue_callout(
&queue_context, &queue_context,

View File

@@ -186,7 +186,7 @@ RTEMS_INLINE_ROUTINE Status_Control _CORE_semaphore_Seize(
_Thread_queue_Context_set_thread_state( _Thread_queue_Context_set_thread_state(
queue_context, queue_context,
STATES_WAITING_FOR_SEMAPHORE STATES_THREAD_QUEUE_WITH_IDENTIFIER | STATES_WAITING_FOR_SEMAPHORE
); );
_Thread_queue_Context_set_do_nothing_enqueue_callout( queue_context ); _Thread_queue_Context_set_do_nothing_enqueue_callout( queue_context );
_Thread_queue_Enqueue( _Thread_queue_Enqueue(

View File

@@ -82,22 +82,26 @@ extern "C" {
#define STATES_LIFE_IS_CHANGING 0x00800000 #define STATES_LIFE_IS_CHANGING 0x00800000
/** This macro corresponds to a task waiting for a join. */ /** This macro corresponds to a task waiting for a join. */
#define STATES_WAITING_FOR_JOIN 0x01000000 #define STATES_WAITING_FOR_JOIN 0x01000000
/** This macro corresponds to a task waiting for a <sys/lock.h> mutex. */ /** This macro corresponds to a task waiting for a futex. */
#define STATES_WAITING_FOR_SYS_LOCK_MUTEX 0x02000000 #define STATES_WAITING_FOR_FUTEX 0x08000000
/** This macro corresponds to a task waiting for a <sys/lock.h> semaphore. */
#define STATES_WAITING_FOR_SYS_LOCK_SEMAPHORE 0x04000000
/** This macro corresponds to a task waiting for a <sys/lock.h> futex. */
#define STATES_WAITING_FOR_SYS_LOCK_FUTEX 0x08000000
/** This macro corresponds to a task which is in an interruptible /** This macro corresponds to a task which is in an interruptible
* blocking state. * blocking state.
*/ */
#define STATES_INTERRUPTIBLE_BY_SIGNAL 0x10000000 #define STATES_INTERRUPTIBLE_BY_SIGNAL 0x10000000
/** This macro corresponds to a task waiting for a <sys/lock.h> condition. */
#define STATES_WAITING_FOR_SYS_LOCK_CONDITION 0x20000000 /**
* @brief This macro corresponds to a task which is blocked on a thread queue
* embedded in an object with an identifier.
*
* This thread state bit is intended to ease debugging and improve system
* diagnostics, see _Thread_Wait_get_id().
*/
#define STATES_THREAD_QUEUE_WITH_IDENTIFIER 0x80000000
/** This macro corresponds to a task waiting for a local object operation. */ /** This macro corresponds to a task waiting for a local object operation. */
#define STATES_LOCALLY_BLOCKED ( STATES_WAITING_FOR_SEGMENT | \ #define STATES_LOCALLY_BLOCKED ( STATES_THREAD_QUEUE_WITH_IDENTIFIER | \
STATES_WAITING_FOR_SEGMENT | \
STATES_WAITING_FOR_MESSAGE | \ STATES_WAITING_FOR_MESSAGE | \
STATES_WAITING_FOR_SEMAPHORE | \ STATES_WAITING_FOR_SEMAPHORE | \
STATES_WAITING_FOR_MUTEX | \ STATES_WAITING_FOR_MUTEX | \
@@ -106,10 +110,7 @@ extern "C" {
STATES_WAITING_FOR_SIGNAL | \ STATES_WAITING_FOR_SIGNAL | \
STATES_WAITING_FOR_BARRIER | \ STATES_WAITING_FOR_BARRIER | \
STATES_WAITING_FOR_BSD_WAKEUP | \ STATES_WAITING_FOR_BSD_WAKEUP | \
STATES_WAITING_FOR_SYS_LOCK_MUTEX | \ STATES_WAITING_FOR_FUTEX | \
STATES_WAITING_FOR_SYS_LOCK_SEMAPHORE | \
STATES_WAITING_FOR_SYS_LOCK_FUTEX | \
STATES_WAITING_FOR_SYS_LOCK_CONDITION | \
STATES_WAITING_FOR_RWLOCK ) STATES_WAITING_FOR_RWLOCK )
/** This macro corresponds to a task waiting which is blocked. */ /** This macro corresponds to a task waiting which is blocked. */

View File

@@ -111,7 +111,7 @@ static Thread_Control *_Condition_Do_wait(
executing = _Condition_Queue_acquire_critical( condition, &context->Base ); executing = _Condition_Queue_acquire_critical( condition, &context->Base );
_Thread_queue_Context_set_thread_state( _Thread_queue_Context_set_thread_state(
&context->Base, &context->Base,
STATES_WAITING_FOR_SYS_LOCK_CONDITION STATES_WAITING_FOR_CONDITION_VARIABLE
); );
_Thread_queue_Context_set_enqueue_callout( _Thread_queue_Context_set_enqueue_callout(
&context->Base, &context->Base,

View File

@@ -46,7 +46,7 @@ Status_Control _CORE_barrier_Seize(
the_barrier->number_of_waiting_threads = number_of_waiting_threads; the_barrier->number_of_waiting_threads = number_of_waiting_threads;
_Thread_queue_Context_set_thread_state( _Thread_queue_Context_set_thread_state(
queue_context, queue_context,
STATES_WAITING_FOR_BARRIER STATES_THREAD_QUEUE_WITH_IDENTIFIER | STATES_WAITING_FOR_BARRIER
); );
_Thread_queue_Context_set_do_nothing_enqueue_callout( queue_context ); _Thread_queue_Context_set_do_nothing_enqueue_callout( queue_context );
_Thread_queue_Enqueue( _Thread_queue_Enqueue(

View File

@@ -115,7 +115,7 @@ Status_Control _CORE_message_queue_Seize(
_Thread_queue_Context_set_thread_state( _Thread_queue_Context_set_thread_state(
queue_context, queue_context,
STATES_WAITING_FOR_MESSAGE STATES_THREAD_QUEUE_WITH_IDENTIFIER | STATES_WAITING_FOR_MESSAGE
); );
_Thread_queue_Context_set_do_nothing_enqueue_callout( queue_context ); _Thread_queue_Context_set_do_nothing_enqueue_callout( queue_context );
_Thread_queue_Enqueue( _Thread_queue_Enqueue(

View File

@@ -133,7 +133,7 @@ Status_Control _CORE_message_queue_Submit(
_Thread_queue_Context_set_thread_state( _Thread_queue_Context_set_thread_state(
queue_context, queue_context,
STATES_WAITING_FOR_MESSAGE STATES_THREAD_QUEUE_WITH_IDENTIFIER | STATES_WAITING_FOR_MESSAGE
); );
_Thread_queue_Context_set_do_nothing_enqueue_callout( queue_context ); _Thread_queue_Context_set_do_nothing_enqueue_callout( queue_context );
_Thread_queue_Enqueue( _Thread_queue_Enqueue(

View File

@@ -34,7 +34,7 @@ Status_Control _CORE_mutex_Seize_slow(
if ( wait ) { if ( wait ) {
_Thread_queue_Context_set_thread_state( _Thread_queue_Context_set_thread_state(
queue_context, queue_context,
STATES_WAITING_FOR_MUTEX STATES_THREAD_QUEUE_WITH_IDENTIFIER | STATES_WAITING_FOR_MUTEX
); );
_Thread_queue_Context_set_do_nothing_enqueue_callout( queue_context ); _Thread_queue_Context_set_do_nothing_enqueue_callout( queue_context );
_Thread_queue_Context_set_deadlock_callout( _Thread_queue_Context_set_deadlock_callout(

View File

@@ -80,7 +80,7 @@ Status_Control _CORE_RWLock_Seize_for_reading(
_Thread_queue_Context_set_thread_state( _Thread_queue_Context_set_thread_state(
queue_context, queue_context,
STATES_WAITING_FOR_RWLOCK STATES_THREAD_QUEUE_WITH_IDENTIFIER | STATES_WAITING_FOR_RWLOCK
); );
_Thread_queue_Context_set_do_nothing_enqueue_callout( queue_context ); _Thread_queue_Context_set_do_nothing_enqueue_callout( queue_context );
_Thread_queue_Enqueue( _Thread_queue_Enqueue(

View File

@@ -68,7 +68,7 @@ Status_Control _CORE_RWLock_Seize_for_writing(
_Thread_queue_Context_set_thread_state( _Thread_queue_Context_set_thread_state(
queue_context, queue_context,
STATES_WAITING_FOR_RWLOCK STATES_THREAD_QUEUE_WITH_IDENTIFIER | STATES_WAITING_FOR_RWLOCK
); );
_Thread_queue_Context_set_do_nothing_enqueue_callout( queue_context ); _Thread_queue_Context_set_do_nothing_enqueue_callout( queue_context );
_Thread_queue_Enqueue( _Thread_queue_Enqueue(

View File

@@ -94,7 +94,7 @@ int _Futex_Wait( struct _Futex_Control *_futex, int *uaddr, int val )
if ( *uaddr == val ) { if ( *uaddr == val ) {
_Thread_queue_Context_set_thread_state( _Thread_queue_Context_set_thread_state(
&queue_context, &queue_context,
STATES_WAITING_FOR_SYS_LOCK_FUTEX STATES_WAITING_FOR_FUTEX
); );
_Thread_queue_Context_set_do_nothing_enqueue_callout( &queue_context ); _Thread_queue_Context_set_do_nothing_enqueue_callout( &queue_context );
_Thread_queue_Context_set_no_timeout( &queue_context ); _Thread_queue_Context_set_no_timeout( &queue_context );

View File

@@ -111,7 +111,7 @@ static void _Mutex_Acquire_slow(
{ {
_Thread_queue_Context_set_thread_state( _Thread_queue_Context_set_thread_state(
queue_context, queue_context,
STATES_WAITING_FOR_SYS_LOCK_MUTEX STATES_WAITING_FOR_MUTEX
); );
_Thread_queue_Context_set_do_nothing_enqueue_callout( queue_context ); _Thread_queue_Context_set_do_nothing_enqueue_callout( queue_context );
_Thread_queue_Context_set_deadlock_callout( _Thread_queue_Context_set_deadlock_callout(

View File

@@ -105,7 +105,7 @@ void _Semaphore_Wait( struct _Semaphore_Control *_sem )
} else { } else {
_Thread_queue_Context_set_thread_state( _Thread_queue_Context_set_thread_state(
&queue_context, &queue_context,
STATES_WAITING_FOR_SYS_LOCK_SEMAPHORE STATES_WAITING_FOR_SEMAPHORE
); );
_Thread_queue_Context_set_do_nothing_enqueue_callout( &queue_context ); _Thread_queue_Context_set_do_nothing_enqueue_callout( &queue_context );
_Thread_queue_Context_set_no_timeout( &queue_context ); _Thread_queue_Context_set_no_timeout( &queue_context );

View File

@@ -18,14 +18,6 @@
#include <rtems/score/threadimpl.h> #include <rtems/score/threadimpl.h>
#define THREAD_WAIT_QUEUE_OBJECT_STATES \
( STATES_WAITING_FOR_BARRIER \
| STATES_WAITING_FOR_CONDITION_VARIABLE \
| STATES_WAITING_FOR_MESSAGE \
| STATES_WAITING_FOR_MUTEX \
| STATES_WAITING_FOR_RWLOCK \
| STATES_WAITING_FOR_SEMAPHORE )
Objects_Id _Thread_Wait_get_id( const Thread_Control *the_thread ) Objects_Id _Thread_Wait_get_id( const Thread_Control *the_thread )
{ {
States_Control current_state; States_Control current_state;
@@ -38,7 +30,7 @@ Objects_Id _Thread_Wait_get_id( const Thread_Control *the_thread )
} }
#endif #endif
if ( ( current_state & THREAD_WAIT_QUEUE_OBJECT_STATES ) != 0 ) { if ( ( current_state & STATES_THREAD_QUEUE_WITH_IDENTIFIER ) != 0 ) {
const Thread_queue_Object *queue_object; const Thread_queue_Object *queue_object;
queue_object = THREAD_QUEUE_QUEUE_TO_OBJECT( the_thread->Wait.queue ); queue_object = THREAD_QUEUE_QUEUE_TO_OBJECT( the_thread->Wait.queue );