[rtems commit] score: Disable thread dispatching earlier

Sebastian Huber sebh at rtems.org
Tue Mar 8 18:20:06 UTC 2022


Module:    rtems
Branch:    master
Commit:    5fcc2caa103531b0cf2267e822e952e26684aab8
Changeset: http://git.rtems.org/rtems/commit/?id=5fcc2caa103531b0cf2267e822e952e26684aab8

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Tue Mar  8 09:44:31 2022 +0100

score: Disable thread dispatching earlier

Disable thread dispatching earlier on secondary processors.  This ensures that
fatal error and per-CPU job handlers are called with thread dispatching
disabled.  On the boot processor, the thread dispatching is already disabled by
_Thread_Dispatch_initialization().

---

 cpukit/score/src/smp.c                     | 6 ++++++
 cpukit/score/src/threadstartmultitasking.c | 6 ------
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/cpukit/score/src/smp.c b/cpukit/score/src/smp.c
index 125c54e..0dc8830 100644
--- a/cpukit/score/src/smp.c
+++ b/cpukit/score/src/smp.c
@@ -253,6 +253,12 @@ void _SMP_Start_multitasking_on_secondary_processor(
 
   cpu_index_self = _Per_CPU_Get_index( cpu_self );
 
+  /*
+   * Call fatal error and per-CPU job handlers with thread dispatching
+   * disabled.
+   */
+  cpu_self->thread_dispatch_disable_level = 1;
+
   if ( cpu_index_self >= rtems_configuration_get_maximum_processors() ) {
     _SMP_Fatal( SMP_FATAL_MULTITASKING_START_ON_INVALID_PROCESSOR );
   }
diff --git a/cpukit/score/src/threadstartmultitasking.c b/cpukit/score/src/threadstartmultitasking.c
index 76187ef..5cc2051 100644
--- a/cpukit/score/src/threadstartmultitasking.c
+++ b/cpukit/score/src/threadstartmultitasking.c
@@ -51,12 +51,6 @@ void _Thread_Start_multitasking( void )
 #if defined(RTEMS_SMP)
   _Per_CPU_Set_state( cpu_self, PER_CPU_STATE_UP );
   _SMP_Try_to_process_message( cpu_self, SMP_MESSAGE_FORCE_PROCESSING );
-
-  /*
-   * Threads begin execution in the _Thread_Handler() function.   This
-   * function will set the thread dispatch disable level to zero.
-   */
-  cpu_self->thread_dispatch_disable_level = 1;
 #endif
 
   heir = _Thread_Get_heir_and_make_it_executing( cpu_self );



More information about the vc mailing list