summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src/schedulersmp.c
diff options
context:
space:
mode:
Diffstat (limited to 'cpukit/score/src/schedulersmp.c')
-rw-r--r--cpukit/score/src/schedulersmp.c56
1 files changed, 34 insertions, 22 deletions
diff --git a/cpukit/score/src/schedulersmp.c b/cpukit/score/src/schedulersmp.c
index cc566180b7..e26caac3e3 100644
--- a/cpukit/score/src/schedulersmp.c
+++ b/cpukit/score/src/schedulersmp.c
@@ -1,3 +1,5 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
/**
* @file
*
@@ -8,11 +10,28 @@
*/
/*
- * Copyright (c) 2014, 2017 embedded brains GmbH.
+ * Copyright (C) 2014, 2017 embedded brains GmbH & Co. KG
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
*
- * 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.
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
*/
#ifdef HAVE_CONFIG_H
@@ -21,28 +40,21 @@
#include <rtems/score/schedulersmpimpl.h>
-void _Scheduler_Request_ask_for_help( Thread_Control *the_thread )
+void _Scheduler_SMP_Remove_ask_for_help_from_processor(
+ Thread_Control *thread,
+ Per_CPU_Control *cpu
+)
{
- ISR_lock_Context scheduler_lock_context;
-
- _Thread_Scheduler_acquire_critical( the_thread, &scheduler_lock_context );
-
- if ( _Chain_Is_node_off_chain( &the_thread->Scheduler.Help_node ) ) {
- Per_CPU_Control *cpu;
- ISR_lock_Context per_cpu_lock_context;
-
- cpu = _Thread_Get_CPU( the_thread );
- _Per_CPU_Acquire( cpu, &per_cpu_lock_context );
+ ISR_lock_Context lock_context;
- _Chain_Append_unprotected(
- &cpu->Threads_in_need_for_help,
- &the_thread->Scheduler.Help_node
- );
+ _Assert( _ISR_lock_Is_owner( &thread->Scheduler.Lock ) );
- _Per_CPU_Release( cpu, &per_cpu_lock_context );
+ _Per_CPU_Acquire( cpu, &lock_context );
- _Thread_Dispatch_request( _Per_CPU_Get(), cpu );
+ if ( thread->Scheduler.ask_for_help_cpu == cpu ) {
+ _Chain_Extract_unprotected( &thread->Scheduler.Help_node );
+ thread->Scheduler.ask_for_help_cpu = NULL;
}
- _Thread_Scheduler_release_critical( the_thread, &scheduler_lock_context );
+ _Per_CPU_Release( cpu, &lock_context );
}