[PATCH 23/32] testsuites: Replace _Thread_Get()
Sebastian Huber
sebastian.huber at embedded-brains.de
Wed May 18 09:20:42 UTC 2016
Replace _Thread_Get() with _Thread_Get_interrupt_disable() to avoid the
Giant lock.
Update #2555.
---
testsuites/smptests/smpmigration02/init.c | 8 ++++----
testsuites/smptests/smpscheduler03/init.c | 8 ++++----
testsuites/sptests/spintrcritical23/init.c | 9 ++++-----
testsuites/tmtests/tm26/task1.c | 25 ++++++++++++++-----------
4 files changed, 26 insertions(+), 24 deletions(-)
diff --git a/testsuites/smptests/smpmigration02/init.c b/testsuites/smptests/smpmigration02/init.c
index 9af7752..40ac8ff 100644
--- a/testsuites/smptests/smpmigration02/init.c
+++ b/testsuites/smptests/smpmigration02/init.c
@@ -118,12 +118,12 @@ static void busy_loop_task(rtems_task_argument arg)
static Thread_Control *get_thread_by_id(rtems_id task_id)
{
- Objects_Locations location;
+ ISR_lock_Context lock_context;
Thread_Control *thread;
- thread = _Thread_Get(task_id, &location);
- rtems_test_assert(location == OBJECTS_LOCAL);
- _Thread_Enable_dispatch();
+ thread = _Thread_Get_interrupt_disable(task_id, &lock_context);
+ rtems_test_assert(thread != NULL);
+ _ISR_lock_ISR_enable(&lock_context);
return thread;
}
diff --git a/testsuites/smptests/smpscheduler03/init.c b/testsuites/smptests/smpscheduler03/init.c
index 1888048..5473500 100644
--- a/testsuites/smptests/smpscheduler03/init.c
+++ b/testsuites/smptests/smpscheduler03/init.c
@@ -100,12 +100,12 @@ static rtems_id start_task(rtems_task_priority prio)
static Thread_Control *get_thread_by_id(rtems_id task_id)
{
- Objects_Locations location;
+ ISR_lock_Context lock_context;
Thread_Control *thread;
- thread = _Thread_Get(task_id, &location);
- rtems_test_assert(location == OBJECTS_LOCAL);
- _Thread_Enable_dispatch();
+ thread = _Thread_Get_interrupt_disable(task_id, &lock_context);
+ rtems_test_assert(thread != NULL);
+ _ISR_lock_ISR_enable(&lock_context);
return thread;
}
diff --git a/testsuites/sptests/spintrcritical23/init.c b/testsuites/sptests/spintrcritical23/init.c
index 89fea25..4857d99 100644
--- a/testsuites/sptests/spintrcritical23/init.c
+++ b/testsuites/sptests/spintrcritical23/init.c
@@ -42,13 +42,12 @@ static test_context ctx_instance;
static Thread_Control *get_tcb(rtems_id id)
{
- Objects_Locations location;
+ ISR_lock_Context lock_context;
Thread_Control *tcb;
- tcb = _Thread_Get(id, &location);
- _Objects_Put(&tcb->Object);
-
- rtems_test_assert(tcb != NULL && location == OBJECTS_LOCAL);
+ tcb = _Thread_Get_interrupt_disable(id, &lock_context);
+ rtems_test_assert(tcb != NULL);
+ _ISR_lock_ISR_enable(&lock_context);
return tcb;
}
diff --git a/testsuites/tmtests/tm26/task1.c b/testsuites/tmtests/tm26/task1.c
index 66bd409..babd240 100644
--- a/testsuites/tmtests/tm26/task1.c
+++ b/testsuites/tmtests/tm26/task1.c
@@ -543,8 +543,9 @@ rtems_task Floating_point_task_2(
void complete_test( void )
{
- uint32_t index;
- rtems_id task_id;
+ uint32_t index;
+ rtems_id task_id;
+ ISR_lock_Context lock_context;
benchmark_timer_initialize();
thread_resume( Middle_tcb );
@@ -570,14 +571,14 @@ void complete_test( void )
task_id = Middle_tcb->Object.id;
benchmark_timer_initialize();
- for ( index=1 ; index <= OPERATION_COUNT ; index++ )
- (void) _Thread_Get( task_id, &location );
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ ) {
+ (void) _Thread_Get_interrupt_disable( task_id, &lock_context );
+ _ISR_lock_ISR_enable( &lock_context );
+ }
thread_get_time = benchmark_timer_read();
benchmark_timer_initialize();
for ( index=1 ; index <= OPERATION_COUNT ; index++ ) {
- ISR_lock_Context lock_context;
-
(void) _Semaphore_Get_interrupt_disable(
Semaphore_id,
&location,
@@ -588,8 +589,10 @@ void complete_test( void )
semaphore_get_time = benchmark_timer_read();
benchmark_timer_initialize();
- for ( index=1 ; index <= OPERATION_COUNT ; index++ )
- (void) _Thread_Get( 0x3, &location );
+ for ( index=1 ; index <= OPERATION_COUNT ; index++ ) {
+ (void) _Thread_Get_interrupt_disable( 0x3, &lock_context );
+ _ISR_lock_ISR_enable( &lock_context );
+ }
thread_get_invalid_time = benchmark_timer_read();
/*
@@ -755,7 +758,7 @@ void complete_test( void )
);
put_time(
- "rtems internal: _Thread_Get",
+ "rtems internal: _Thread_Get_interrupt_disable",
thread_get_time,
OPERATION_COUNT,
0,
@@ -763,7 +766,7 @@ void complete_test( void )
);
put_time(
- "rtems internal: _Semaphore_Get",
+ "rtems internal: _Semaphore_Get_interrupt_disable",
semaphore_get_time,
OPERATION_COUNT,
0,
@@ -771,7 +774,7 @@ void complete_test( void )
);
put_time(
- "rtems internal: _Thread_Get: invalid id",
+ "rtems internal: _Thread_Get_interrupt_disable: invalid id",
thread_get_invalid_time,
OPERATION_COUNT,
0,
--
1.8.4.5
More information about the devel
mailing list