summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2017-03-07 13:07:02 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2017-03-07 13:21:00 +0100
commit088acbb01fc5060f687e4776f8fc6862060d3aa8 (patch)
treea9445b3bb7de49f8956a0b12cedc0469e1e9bda5 /cpukit/score/src
parentpowerpc: Optimize AltiVec context switch (diff)
downloadrtems-088acbb01fc5060f687e4776f8fc6862060d3aa8.tar.bz2
score: Fix scheduler yield in SMP configurations
Check that no ask help request is registered during unblock and yield scheduler operations. There is no need to ask for help if a scheduled thread yields, since this is already covered by the pre-emption detection. Update #2556.
Diffstat (limited to 'cpukit/score/src')
-rw-r--r--cpukit/score/src/schedulersmp.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/cpukit/score/src/schedulersmp.c b/cpukit/score/src/schedulersmp.c
new file mode 100644
index 0000000000..d68ac4fc8b
--- /dev/null
+++ b/cpukit/score/src/schedulersmp.c
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2014, 2017 embedded brains GmbH.
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.org/license/LICENSE.
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/score/schedulersmpimpl.h>
+
+void _Scheduler_Request_ask_for_help( Thread_Control *the_thread )
+{
+ ISR_lock_Context lock_context;
+
+ _Thread_Scheduler_acquire_critical( the_thread, &lock_context );
+
+ if ( _Chain_Is_node_off_chain( &the_thread->Scheduler.Help_node ) ) {
+ Per_CPU_Control *cpu;
+
+ cpu = _Thread_Get_CPU( the_thread );
+ _Per_CPU_Acquire( cpu );
+
+ _Chain_Append_unprotected(
+ &cpu->Threads_in_need_for_help,
+ &the_thread->Scheduler.Help_node
+ );
+
+ _Per_CPU_Release( cpu );
+
+ _Thread_Dispatch_request( _Per_CPU_Get(), cpu );
+ }
+
+ _Thread_Scheduler_release_critical( the_thread, &lock_context );
+}