summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2021-08-12 11:06:55 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2021-08-12 11:10:38 +0200
commit78311431e4c274cee94f85c7ea81cbcca1ae4a19 (patch)
tree632b831698a619cba233e2ffedb189d0a3587532
parentbb77a82f619752ba147c317d982ac47f56f4afec (diff)
score: Simplify _Scheduler_Tick()
The NULL pointer check for the executing thread was introduced by commit: commit be3c257286ad870d8d1a64941cde53fd2d33a633 Author: Sebastian Huber <sebastian.huber@embedded-brains.de> Date: Thu Jun 5 11:17:26 2014 +0200 score: Avoid NULL pointer access Check that the executing thread is not NULL in _Scheduler_Tick(). It may be NULL in case the processor has an optional scheduler assigned and the system was not able to start the processor. However, it is no longer necessary since now the clock interrupt is distributed to the online processors.
-rw-r--r--cpukit/include/rtems/score/schedulerimpl.h26
1 files changed, 22 insertions, 4 deletions
diff --git a/cpukit/include/rtems/score/schedulerimpl.h b/cpukit/include/rtems/score/schedulerimpl.h
index 586f9e0ec8..7b0658073e 100644
--- a/cpukit/include/rtems/score/schedulerimpl.h
+++ b/cpukit/include/rtems/score/schedulerimpl.h
@@ -611,12 +611,30 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Cancel_job(
*/
RTEMS_INLINE_ROUTINE void _Scheduler_Tick( const Per_CPU_Control *cpu )
{
- const Scheduler_Control *scheduler = _Scheduler_Get_by_CPU( cpu );
- Thread_Control *executing = cpu->executing;
+ const Scheduler_Control *scheduler;
+ Thread_Control *executing;
+
+ scheduler = _Scheduler_Get_by_CPU( cpu );
- if ( scheduler != NULL && executing != NULL ) {
- ( *scheduler->Operations.tick )( scheduler, executing );
+#if defined(RTEMS_SMP)
+ if ( scheduler == NULL ) {
+ /*
+ * In SMP configurations, processors may be removed/added at runtime
+ * from/to a scheduler. There may be still clock interrupts on currently
+ * unassigned processors.
+ */
+ return;
}
+#endif
+
+ /*
+ * Each online processor has at least an idle thread as the executing thread
+ * even in case it has currently no scheduler assigned. Clock interrupts on
+ * processors which are not online would be a severe bug of the Clock Driver.
+ */
+ executing = _Per_CPU_Get_executing( cpu );
+ _Assert( executing != NULL );
+ ( *scheduler->Operations.tick )( scheduler, executing );
}
/**