summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2017-10-10 11:36:23 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2017-10-11 07:37:58 +0200
commitb2dbb634eccc4132eb839a0ed5ab09c7b3bd992e (patch)
treef8ceced2aa2efa35f9a208a9279bcf5b95ea03e5 /cpukit/score/src
parentposix: Validate affinity sets by the scheduler (diff)
downloadrtems-b2dbb634eccc4132eb839a0ed5ab09c7b3bd992e.tar.bz2
score: Remove CPU_set_Control
Use Processor_mask instead. Update #2514.
Diffstat (limited to 'cpukit/score/src')
-rw-r--r--cpukit/score/src/cpuset.c97
-rw-r--r--cpukit/score/src/cpusetprintsupport.c77
-rw-r--r--cpukit/score/src/schedulerpriorityaffinitysmp.c15
-rw-r--r--cpukit/score/src/threadinitialize.c1
4 files changed, 9 insertions, 181 deletions
diff --git a/cpukit/score/src/cpuset.c b/cpukit/score/src/cpuset.c
deleted file mode 100644
index 1540d3c83c..0000000000
--- a/cpukit/score/src/cpuset.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/**
- * @file
- *
- * @ingroup ScoreCpuset
- *
- * @brief Routines to Control a CPU Set.
- */
-
-/*
- * COPYRIGHT (c) 2014.
- * On-Line Applications Research Corporation (OAR).
- *
- * 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 <sys/cpuset.h>
-#include <rtems/sysinit.h>
-#include <rtems/score/cpusetimpl.h>
-#include <rtems/score/assert.h>
-#include <rtems/score/percpu.h>
-
-static CPU_set_Control cpuset_default;
-
-/*
- * _CPU_set_Handler_initialization
- */
-static void _CPU_set_Handler_initialization(void)
-{
- uint32_t cpu_count;
- uint32_t cpu_index;
-
- /* We do not support a cpu count over CPU_SETSIZE */
- cpu_count = _SMP_Get_processor_count();
-
- /* This should never happen */
- _Assert( cpu_count <= CPU_SETSIZE );
-
- /* Initialize the affinity to be the set of all available CPU's */
- cpuset_default.set = &cpuset_default.preallocated;
- cpuset_default.setsize = sizeof( *cpuset_default.set );
- CPU_ZERO_S( cpuset_default.setsize, &cpuset_default.preallocated );
-
- for ( cpu_index=0; cpu_index<cpu_count; cpu_index++ )
- CPU_SET_S( (int) cpu_index, cpuset_default.setsize, cpuset_default.set );
-}
-
-RTEMS_SYSINIT_ITEM(
- _CPU_set_Handler_initialization,
- RTEMS_SYSINIT_CPU_SET,
- RTEMS_SYSINIT_ORDER_MIDDLE
-);
-
-/**
- * _CPU_set_Is_valid
- *
- * This routine validates a cpuset size corresponds to
- * the system correct size, that at least one
- * valid cpu is set and that no invalid cpus are set.
- */
-bool _CPU_set_Is_valid( const cpu_set_t *cpuset, size_t setsize )
-{
- cpu_set_t temp;
-
- if ( !cpuset )
- return false;
-
- if ( setsize != cpuset_default.setsize )
- return false;
-
- /* Validate at least 1 valid cpu is set in cpuset */
- CPU_AND_S( cpuset_default.setsize, &temp, cpuset, cpuset_default.set );
-
- if ( CPU_COUNT_S( setsize, &temp ) == 0 )
- return false;
-
- /* Validate that no invalid cpu's are set in cpuset */
- if ( !CPU_EQUAL_S( setsize, &temp, cpuset ) )
- return false;
-
- return true;
-}
-
-/**
- * _CPU_set_Default
- *
- * This routine returns the default cpuset.
- */
-const CPU_set_Control *_CPU_set_Default()
-{
- return &cpuset_default;
-}
diff --git a/cpukit/score/src/cpusetprintsupport.c b/cpukit/score/src/cpusetprintsupport.c
deleted file mode 100644
index 1199671032..0000000000
--- a/cpukit/score/src/cpusetprintsupport.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/**
- * @file
- *
- * @brief CPU Set Print Support Routines
- * @ingroup ScoreCpuset
- */
-
-/*
- * COPYRIGHT (c) 2014.
- * On-Line Applications Research Corporation (OAR).
- *
- * 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <string.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <ctype.h>
-#include <inttypes.h>
-#include <rtems/printer.h>
-#include <rtems/score/cpusetimpl.h>
-
-void _CPU_set_Show_with_plugin(
- const rtems_printer *printer,
- const char *description,
- const cpu_set_t *cpuset
-);
-
-/*
- * _CPU_set_Show_with_plugin
- *
- * This routine shows cpuset cpuset using a
- * print plugin .
- */
-void _CPU_set_Show_with_plugin(
- const rtems_printer *printer,
- const char *description,
- const cpu_set_t *cpuset
-)
-{
- int i;
- rtems_printf(printer ,"%s: ", description);
- for(i=0; i<_NCPUWORDS; i++)
- rtems_printf(printer ,"%lx", cpuset->__bits[i]);
- rtems_printf(printer ,"\n");
-}
-
-/*
- * _CPU_set_Show
- *
- * This routine shows a cpuset using the
- * printk plugin.
- */
-void _CPU_set_Show( const char *description, const cpu_set_t *cpuset)
-{
- rtems_printer printer;
- rtems_print_printer_printk( &printer );
- _CPU_set_Show_with_plugin( &printer, description, cpuset );
-}
-
-/*
- * _CPU_set_Show_default
- *
- * This routine shows the default cpuset.
- */
-void _CPU_set_Show_default( const char *description )
-{
- const CPU_set_Control *ctl;
- ctl = _CPU_set_Default();
- _CPU_set_Show( description, ctl->set );
-}
diff --git a/cpukit/score/src/schedulerpriorityaffinitysmp.c b/cpukit/score/src/schedulerpriorityaffinitysmp.c
index e8301226f3..03db3e9a26 100644
--- a/cpukit/score/src/schedulerpriorityaffinitysmp.c
+++ b/cpukit/score/src/schedulerpriorityaffinitysmp.c
@@ -84,8 +84,11 @@ void _Scheduler_priority_affinity_SMP_Node_initialize(
* All we add is affinity information to the basic SMP node.
*/
the_node = _Scheduler_priority_affinity_SMP_Node_downcast( node );
- the_node->Affinity = *_CPU_set_Default();
- the_node->Affinity.set = &the_node->Affinity.preallocated;
+ _Processor_mask_To_cpu_set_t(
+ _SMP_Get_online_processors(),
+ sizeof( the_node->affinity ),
+ &the_node->affinity
+ );
}
/*
@@ -153,7 +156,7 @@ static Scheduler_Node *_Scheduler_priority_affinity_SMP_Get_highest_ready(
/*
* Can this thread run on this CPU?
*/
- if ( CPU_ISSET( (int) victim_cpu_index, node->Affinity.set ) ) {
+ if ( CPU_ISSET( (int) victim_cpu_index, &node->affinity ) ) {
highest = &node->Base.Base.Base;
break;
}
@@ -245,7 +248,7 @@ static Scheduler_Node * _Scheduler_priority_affinity_SMP_Get_lowest_scheduled(
thread = _Scheduler_Node_get_owner( &node->Base.Base.Base );
cpu_index = _Per_CPU_Get_index( _Thread_Get_CPU( thread ) );
- if ( CPU_ISSET( (int) cpu_index, filter->Affinity.set ) ) {
+ if ( CPU_ISSET( (int) cpu_index, &filter->affinity ) ) {
lowest_scheduled = &node->Base.Base.Base;
break;
}
@@ -623,7 +626,7 @@ bool _Scheduler_priority_affinity_SMP_Set_affinity(
* The old and new set are the same, there is no point in
* doing anything.
*/
- if ( CPU_EQUAL( &cpuset, node->Affinity.set ) )
+ if ( CPU_EQUAL( &cpuset, &node->affinity ) )
return true;
current_state = thread->current_state;
@@ -632,7 +635,7 @@ bool _Scheduler_priority_affinity_SMP_Set_affinity(
_Scheduler_priority_affinity_SMP_Block( scheduler, thread, &node->Base.Base.Base );
}
- CPU_COPY( &cpuset, node->Affinity.set );
+ CPU_COPY( &cpuset, &node->affinity );
if ( _States_Is_ready( current_state ) ) {
/*
diff --git a/cpukit/score/src/threadinitialize.c b/cpukit/score/src/threadinitialize.c
index 3230eac2fe..c2296fbf55 100644
--- a/cpukit/score/src/threadinitialize.c
+++ b/cpukit/score/src/threadinitialize.c
@@ -25,7 +25,6 @@
#include <rtems/score/userextimpl.h>
#include <rtems/score/watchdogimpl.h>
#include <rtems/score/wkspace.h>
-#include <rtems/score/cpusetimpl.h>
#include <rtems/config.h>
bool _Thread_Initialize(