From ec771f253182569dd5e046f39785a22c6c6f8e44 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 16 Nov 2017 15:04:21 +0100 Subject: score: Fix priority ceiling updates We must not clear the priority updates in _Thread_queue_Extract_locked() since this function is used by the priority ceiling surrender operations after the ceiling priority handover from the previous owner to the new owner. This is especially important in SMP configurations. Move the _Thread_queue_Context_clear_priority_updates() invocation to the callers. Close #3237. --- cpukit/score/src/threadqenqueue.c | 2 +- cpukit/score/src/threadqflush.c | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'cpukit/score/src') diff --git a/cpukit/score/src/threadqenqueue.c b/cpukit/score/src/threadqenqueue.c index 62d3671222..f62ec29b02 100644 --- a/cpukit/score/src/threadqenqueue.c +++ b/cpukit/score/src/threadqenqueue.c @@ -568,7 +568,6 @@ bool _Thread_queue_Extract_locked( Thread_queue_Context *queue_context ) { - _Thread_queue_Context_clear_priority_updates( queue_context ); #if defined(RTEMS_MULTIPROCESSING) _Thread_queue_MP_set_callout( the_thread, queue_context ); #endif @@ -627,6 +626,7 @@ void _Thread_queue_Extract( Thread_Control *the_thread ) Thread_queue_Queue *queue; _Thread_queue_Context_initialize( &queue_context ); + _Thread_queue_Context_clear_priority_updates( &queue_context ); _Thread_Wait_acquire( the_thread, &queue_context ); queue = the_thread->Wait.queue; diff --git a/cpukit/score/src/threadqflush.c b/cpukit/score/src/threadqflush.c index ef4d6b1f09..4310e06edf 100644 --- a/cpukit/score/src/threadqflush.c +++ b/cpukit/score/src/threadqflush.c @@ -92,6 +92,13 @@ size_t _Thread_queue_Flush_critical( break; } + /* + * We do not have enough space in the queue context to collect all priority + * updates, so clear it each time. We unconditionally do the priority + * update for the owner later if it exists. + */ + _Thread_queue_Context_clear_priority_updates( queue_context ); + do_unblock = _Thread_queue_Extract_locked( queue, operations, -- cgit v1.2.3