summaryrefslogtreecommitdiffstats
path: root/cpukit
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 21:00:05 +0200
commit0a69ce0fb4a71f8093f94d2c2bd7343968802980 (patch)
treecef1c989fd0dbc8a42bc76e4fd53fc6810a12aab /cpukit
parentscore: Replace the single use of a sequence lock (diff)
downloadrtems-0a69ce0fb4a71f8093f94d2c2bd7343968802980.tar.bz2
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.
Diffstat (limited to 'cpukit')
-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 24db4d7818..98f8e337fd 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 );
}
/**