From b2dbb634eccc4132eb839a0ed5ab09c7b3bd992e Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Tue, 10 Oct 2017 11:36:23 +0200 Subject: score: Remove CPU_set_Control Use Processor_mask instead. Update #2514. --- cpukit/posix/src/pthread.c | 1 - cpukit/posix/src/pthreadsetaffinitynp.c | 1 - cpukit/rtems/src/schedulergetprocessorset.c | 1 - cpukit/rtems/src/taskgetaffinity.c | 1 - cpukit/rtems/src/tasksetaffinity.c | 1 - cpukit/score/Makefile.am | 4 - cpukit/score/include/rtems/score/cpuset.h | 63 ---------- cpukit/score/include/rtems/score/cpusetimpl.h | 129 --------------------- cpukit/score/include/rtems/score/schedulerimpl.h | 1 - .../rtems/score/schedulerpriorityaffinitysmp.h | 5 +- cpukit/score/include/rtems/sysinit.h | 1 - cpukit/score/preinstall.am | 8 -- cpukit/score/src/cpuset.c | 97 ---------------- cpukit/score/src/cpusetprintsupport.c | 77 ------------ cpukit/score/src/schedulerpriorityaffinitysmp.c | 15 ++- cpukit/score/src/threadinitialize.c | 1 - testsuites/sptests/spsysinit01/init.c | 13 --- 17 files changed, 12 insertions(+), 407 deletions(-) delete mode 100644 cpukit/score/include/rtems/score/cpuset.h delete mode 100644 cpukit/score/include/rtems/score/cpusetimpl.h delete mode 100644 cpukit/score/src/cpuset.c delete mode 100644 cpukit/score/src/cpusetprintsupport.c diff --git a/cpukit/posix/src/pthread.c b/cpukit/posix/src/pthread.c index 17f7fe3a82..107172a557 100644 --- a/cpukit/posix/src/pthread.c +++ b/cpukit/posix/src/pthread.c @@ -38,7 +38,6 @@ #include #include #include -#include #include Thread_Information _POSIX_Threads_Information; diff --git a/cpukit/posix/src/pthreadsetaffinitynp.c b/cpukit/posix/src/pthreadsetaffinitynp.c index c504de5cd7..0d3fec4482 100644 --- a/cpukit/posix/src/pthreadsetaffinitynp.c +++ b/cpukit/posix/src/pthreadsetaffinitynp.c @@ -25,7 +25,6 @@ #include #include -#include #include int pthread_setaffinity_np( diff --git a/cpukit/rtems/src/schedulergetprocessorset.c b/cpukit/rtems/src/schedulergetprocessorset.c index d632e5e2c7..986a0ab9e7 100644 --- a/cpukit/rtems/src/schedulergetprocessorset.c +++ b/cpukit/rtems/src/schedulergetprocessorset.c @@ -17,7 +17,6 @@ #endif #include -#include #include rtems_status_code rtems_scheduler_get_processor_set( diff --git a/cpukit/rtems/src/taskgetaffinity.c b/cpukit/rtems/src/taskgetaffinity.c index 4519534aee..bd946318df 100644 --- a/cpukit/rtems/src/taskgetaffinity.c +++ b/cpukit/rtems/src/taskgetaffinity.c @@ -20,7 +20,6 @@ #include #include -#include #include rtems_status_code rtems_task_get_affinity( diff --git a/cpukit/rtems/src/tasksetaffinity.c b/cpukit/rtems/src/tasksetaffinity.c index 290a13bb3a..595c7e0828 100644 --- a/cpukit/rtems/src/tasksetaffinity.c +++ b/cpukit/rtems/src/tasksetaffinity.c @@ -20,7 +20,6 @@ #include #include -#include #include rtems_status_code rtems_task_set_affinity( diff --git a/cpukit/score/Makefile.am b/cpukit/score/Makefile.am index 7a200707b2..f0c927b294 100644 --- a/cpukit/score/Makefile.am +++ b/cpukit/score/Makefile.am @@ -41,8 +41,6 @@ include_rtems_score_HEADERS += include/rtems/score/coremuteximpl.h include_rtems_score_HEADERS += include/rtems/score/corerwlockimpl.h include_rtems_score_HEADERS += include/rtems/score/coresem.h include_rtems_score_HEADERS += include/rtems/score/coresemimpl.h -include_rtems_score_HEADERS += include/rtems/score/cpuset.h -include_rtems_score_HEADERS += include/rtems/score/cpusetimpl.h include_rtems_score_HEADERS += include/rtems/score/cpustdatomic.h include_rtems_score_HEADERS += include/rtems/score/heap.h include_rtems_score_HEADERS += include/rtems/score/heapimpl.h @@ -156,8 +154,6 @@ libscore_a_SOURCES += src/schedulerstrongapa.c libscore_a_SOURCES += src/smp.c libscore_a_SOURCES += src/smplock.c libscore_a_SOURCES += src/smpmulticastaction.c -libscore_a_SOURCES += src/cpuset.c -libscore_a_SOURCES += src/cpusetprintsupport.c libscore_a_SOURCES += src/schedulerdefaultaskforhelp.c libscore_a_SOURCES += src/schedulerdefaultsetaffinity.c libscore_a_SOURCES += src/schedulersmp.c diff --git a/cpukit/score/include/rtems/score/cpuset.h b/cpukit/score/include/rtems/score/cpuset.h deleted file mode 100644 index 564f4a5efb..0000000000 --- a/cpukit/score/include/rtems/score/cpuset.h +++ /dev/null @@ -1,63 +0,0 @@ -/** - * @file rtems/score/cpuset.h - * - * @brief Information About the CPU Set - * - * This include file contains all information about the thread - * 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. - */ - -#ifndef _RTEMS_SCORE_CPUSET_H -#define _RTEMS_SCORE_CPUSET_H - -#include - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @defgroup ScoreCpuset SuperCore CPU Set - * - * @ingroup Score - * - * This handler encapsulates functionality which is used in the management - * of thread's CPU set. - */ -/**@{*/ - -/** - * The following defines the control block used to manage the cpuset. - * The names do not include affinity in the front in case the set is - * ever used for something other than affinity. The usage in thread - * uses the attribute affinity such that accesses will read - * thread->affinity.set. - */ -typedef struct { - /** This is the size of the set */ - size_t setsize; - /** This is the preallocated space to store the set */ - cpu_set_t preallocated; - /** This is a pointer to the set in use */ - cpu_set_t *set; -} CPU_set_Control; - -/**@}*/ - -#ifdef __cplusplus -} -#endif - -#endif /* _RTEMS_SCORE_CPUSET_H */ -/* end of include file */ diff --git a/cpukit/score/include/rtems/score/cpusetimpl.h b/cpukit/score/include/rtems/score/cpusetimpl.h deleted file mode 100644 index 1cb71d6169..0000000000 --- a/cpukit/score/include/rtems/score/cpusetimpl.h +++ /dev/null @@ -1,129 +0,0 @@ -/** - * @file - * - * @brief Implementation Helper for CPU Set - * - * This file contains the implementation helpers inlines and prototypes for - * CPU set methods. - */ - -/* - * 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. - */ - -#ifndef _RTEMS_SCORE_CPUSETIMPL_H -#define _RTEMS_SCORE_CPUSETIMPL_H - -#include -#include - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief Determine If the CPU Set if 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. - * - * @param[in] cpuset is the cpuset to validate - * @param[in] setsize is the number of CPUs in the cpuset - * - * @return true if the set is valid - */ -bool _CPU_set_Is_valid( const cpu_set_t *cpuset, size_t setsize ); - -/** - * @brief Print the CPU Set - * - * This routine will print the value of the given cpuset. - * - * @param[in] description is a string to print before the value. - * @param[in] cpuset is the cpuset to validate - */ -void _CPU_set_Show( const char *description, const cpu_set_t *cpuset); - -/** - * @brief Print the Default CPU Set - * - * This routine will print the value of the default cpuset. - * - * @param[in] description is a string to print before the value. - */ -void _CPU_set_Show_default( const char *description ); - -/** - * @brief Obtain the Default CPU Set - * - * This routine returns the default cpuset for this system. - * - * @return a pointer to the default cpuset. - */ -const CPU_set_Control *_CPU_set_Default(void); - -/** - * @brief Obtain the Maximum Number of CPUs Representable in CPU Set - * - * This routine returns maximum number of CPUs that can be represented - * in the @a setsize specified. - * - * @return the number of representable cores in the cpuset - */ -RTEMS_INLINE_ROUTINE size_t _CPU_set_Maximum_CPU_count( size_t setsize ) -{ - return setsize * CHAR_BIT; -} - -/** - * @brief Is this CPU Set Large Enough? - * - * This method can be used to determine if a particular cpuset is - * large enough for the number of CPUs in the system. - * - * @param[in] setsize is the number of CPUs in the cpuset - * - * @return true if the @a setsize is sufficient - */ -RTEMS_INLINE_ROUTINE bool _CPU_set_Is_large_enough( - size_t setsize -) -{ - return _CPU_set_Maximum_CPU_count( setsize ) >= _SMP_Get_processor_count(); -} - -/** - * @brief Fill in CPU_set_Control - * - * This method fills in a CPU_set_Control based upon a cpu_set_t and - * size information. - * - * @param[in] cpuset is the cpuset to validate - * @param[in] setsize is the number of CPUs in the cpuset - */ -static inline void _CPU_set_Set( - size_t setsize, - cpu_set_t *cpuset, - CPU_set_Control *set -) -{ - set->set = &set->preallocated; - set->setsize = setsize; - CPU_COPY( cpuset, set->set ); -} - -/**@}*/ - -#ifdef __cplusplus -} -#endif -#endif -/* end of include file */ diff --git a/cpukit/score/include/rtems/score/schedulerimpl.h b/cpukit/score/include/rtems/score/schedulerimpl.h index 85fcace760..89b24415df 100644 --- a/cpukit/score/include/rtems/score/schedulerimpl.h +++ b/cpukit/score/include/rtems/score/schedulerimpl.h @@ -22,7 +22,6 @@ #include #include -#include #include #include #include diff --git a/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h b/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h index e5eb916133..6ae7ac5e76 100644 --- a/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h +++ b/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h @@ -22,7 +22,8 @@ #include #include #include -#include + +#include #ifdef __cplusplus extern "C" { @@ -168,7 +169,7 @@ typedef struct { /** * Structure containing affinity set data and size */ - CPU_set_Control Affinity; + cpu_set_t affinity; } Scheduler_priority_affinity_SMP_Node; /** @} */ diff --git a/cpukit/score/include/rtems/sysinit.h b/cpukit/score/include/rtems/sysinit.h index 7ab3d0b631..535fb98e2c 100644 --- a/cpukit/score/include/rtems/sysinit.h +++ b/cpukit/score/include/rtems/sysinit.h @@ -31,7 +31,6 @@ extern "C" { #define RTEMS_SYSINIT_INITIAL_EXTENSIONS 000300 #define RTEMS_SYSINIT_MP_EARLY 000301 #define RTEMS_SYSINIT_DATA_STRUCTURES 000302 -#define RTEMS_SYSINIT_CPU_SET 00030d #define RTEMS_SYSINIT_MP 00030e #define RTEMS_SYSINIT_USER_EXTENSIONS 000320 #define RTEMS_SYSINIT_CLASSIC_TASKS 000340 diff --git a/cpukit/score/preinstall.am b/cpukit/score/preinstall.am index 2d7d5a2859..0329b9ce92 100644 --- a/cpukit/score/preinstall.am +++ b/cpukit/score/preinstall.am @@ -132,14 +132,6 @@ $(PROJECT_INCLUDE)/rtems/score/coresemimpl.h: include/rtems/score/coresemimpl.h $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/coresemimpl.h PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/coresemimpl.h -$(PROJECT_INCLUDE)/rtems/score/cpuset.h: include/rtems/score/cpuset.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp) - $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/cpuset.h -PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/cpuset.h - -$(PROJECT_INCLUDE)/rtems/score/cpusetimpl.h: include/rtems/score/cpusetimpl.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp) - $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/cpusetimpl.h -PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/cpusetimpl.h - $(PROJECT_INCLUDE)/rtems/score/cpustdatomic.h: include/rtems/score/cpustdatomic.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp) $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/cpustdatomic.h PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/cpustdatomic.h 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 -#include -#include -#include -#include - -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 -#include -#include -#include -#include -#include -#include - -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 #include #include -#include #include bool _Thread_Initialize( diff --git a/testsuites/sptests/spsysinit01/init.c b/testsuites/sptests/spsysinit01/init.c index f6fa1ddaf4..f3e0e3f6a5 100644 --- a/testsuites/sptests/spsysinit01/init.c +++ b/testsuites/sptests/spsysinit01/init.c @@ -72,8 +72,6 @@ typedef enum { INITIAL_EXTENSIONS_POST, DATA_STRUCTURES_PRE, DATA_STRUCTURES_POST, - CPU_SET_PRE, - CPU_SET_POST, USER_EXTENSIONS_PRE, USER_EXTENSIONS_POST, CLASSIC_TASKS_PRE, @@ -245,17 +243,6 @@ LAST(RTEMS_SYSINIT_DATA_STRUCTURES) next_step(DATA_STRUCTURES_POST); } -FIRST(RTEMS_SYSINIT_CPU_SET) -{ - /* There is nothing to do in case RTEMS_SMP is not defined */ - next_step(CPU_SET_PRE); -} - -LAST(RTEMS_SYSINIT_CPU_SET) -{ - next_step(CPU_SET_POST); -} - FIRST(RTEMS_SYSINIT_USER_EXTENSIONS) { assert(_Extension_Information.maximum == 0); -- cgit v1.2.3