diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-06-22 17:09:23 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-09-21 08:59:26 +0200 |
commit | 300f6a481aaf9e6d29811faca71bf7104a01492c (patch) | |
tree | ba8f18cedb93e3781a2f17aa989c5c805dd18d6a /testsuites/smptests | |
parent | classic networking: do not reference BSP_irq_enabled_at_i8259s which is no mo... (diff) | |
download | rtems-300f6a481aaf9e6d29811faca71bf7104a01492c.tar.bz2 |
score: Rework thread priority management
Add priority nodes which contribute to the overall thread priority.
The actual priority of a thread is now an aggregation of priority nodes.
The thread priority aggregation for the home scheduler instance of a
thread consists of at least one priority node, which is normally the
real priority of the thread. The locking protocols (e.g. priority
ceiling and priority inheritance), rate-monotonic period objects and the
POSIX sporadic server add, change and remove priority nodes.
A thread changes its priority now immediately, e.g. priority changes are
not deferred until the thread releases its last resource.
Replace the _Thread_Change_priority() function with
* _Thread_Priority_perform_actions(),
* _Thread_Priority_add(),
* _Thread_Priority_remove(),
* _Thread_Priority_change(), and
* _Thread_Priority_update().
Update #2412.
Update #2556.
Diffstat (limited to 'testsuites/smptests')
-rw-r--r-- | testsuites/smptests/smpmutex01/init.c | 3 | ||||
-rw-r--r-- | testsuites/smptests/smpscheduler03/init.c | 43 |
2 files changed, 25 insertions, 21 deletions
diff --git a/testsuites/smptests/smpmutex01/init.c b/testsuites/smptests/smpmutex01/init.c index 5adc2e2244..93c059e6fc 100644 --- a/testsuites/smptests/smpmutex01/init.c +++ b/testsuites/smptests/smpmutex01/init.c @@ -315,10 +315,9 @@ static void test(void) request(ctx, B_5_0, REQ_MTX_RELEASE); check_generations(ctx, B_5_0, A_2_1); assert_prio(ctx, B_5_0, 5); - assert_prio(ctx, A_2_1, 0); + assert_prio(ctx, A_2_1, 2); request(ctx, A_2_1, REQ_MTX_RELEASE); check_generations(ctx, A_2_1, B_5_1); - assert_prio(ctx, A_2_1, 2); assert_prio(ctx, B_5_1, 5); request(ctx, B_5_1, REQ_MTX_RELEASE); check_generations(ctx, B_5_1, NONE); diff --git a/testsuites/smptests/smpscheduler03/init.c b/testsuites/smptests/smpscheduler03/init.c index c114eb90be..50d4894859 100644 --- a/testsuites/smptests/smpscheduler03/init.c +++ b/testsuites/smptests/smpscheduler03/init.c @@ -40,28 +40,35 @@ typedef struct { static test_context test_instance; -static bool change_priority_filter( - Thread_Control *thread, - Priority_Control *new_priority, - void *arg +static void apply_priority( + Thread_Control *thread, + Priority_Control new_priority, + bool prepend_it, + Thread_queue_Context *queue_context ) { - return _Thread_Get_priority( thread ) != *new_priority; + _Thread_queue_Context_clear_priority_updates(queue_context); + _Thread_Wait_acquire(thread, queue_context); + _Thread_Priority_change( + thread, + &thread->Real_priority, + new_priority, + prepend_it, + queue_context + ); + _Thread_Wait_release(thread, queue_context); } static void change_priority( - Thread_Control *thread, - Priority_Control new_priority, - bool prepend_it + Thread_Control *thread, + Priority_Control new_priority, + bool prepend_it ) { - _Thread_Change_priority( - thread, - new_priority, - NULL, - change_priority_filter, - prepend_it - ); + Thread_queue_Context queue_context; + + apply_priority(thread, new_priority, prepend_it, &queue_context); + _Thread_Priority_update(&queue_context); } static void barrier_wait(test_context *ctx) @@ -197,11 +204,9 @@ static Thread_Control *update_priority_op( ISR_lock_Context state_lock_context; ISR_lock_Context scheduler_lock_context; Thread_Control *needs_help; - Scheduler_Node *node; + Thread_queue_Context queue_context; - thread->current_priority = new_priority; - node = _Scheduler_Thread_get_node(thread); - _Scheduler_Node_set_priority(node, new_priority, prepend_it); + apply_priority(thread, new_priority, prepend_it, &queue_context); _Thread_State_acquire( thread, &state_lock_context ); scheduler = _Scheduler_Get( thread ); |