score: Remove CPU_set_Control

Use Processor_mask instead.

Update #2514.
This commit is contained in:
Sebastian Huber
2017-10-11 07:37:58 +02:00
parent a3ad4afba8
commit b2dbb634ec
17 changed files with 12 additions and 407 deletions
-1
View File
@@ -38,7 +38,6 @@
#include <rtems/posix/config.h>
#include <rtems/posix/keyimpl.h>
#include <rtems/score/assert.h>
#include <rtems/score/cpusetimpl.h>
#include <rtems/score/schedulerimpl.h>
Thread_Information _POSIX_Threads_Information;
-1
View File
@@ -25,7 +25,6 @@
#include <errno.h>
#include <rtems/score/threadimpl.h>
#include <rtems/score/cpusetimpl.h>
#include <rtems/score/schedulerimpl.h>
int pthread_setaffinity_np(
@@ -17,7 +17,6 @@
#endif
#include <rtems/rtems/tasks.h>
#include <rtems/score/cpusetimpl.h>
#include <rtems/score/schedulerimpl.h>
rtems_status_code rtems_scheduler_get_processor_set(
-1
View File
@@ -20,7 +20,6 @@
#include <rtems/rtems/tasks.h>
#include <rtems/score/threadimpl.h>
#include <rtems/score/cpusetimpl.h>
#include <rtems/score/schedulerimpl.h>
rtems_status_code rtems_task_get_affinity(
-1
View File
@@ -20,7 +20,6 @@
#include <rtems/rtems/tasks.h>
#include <rtems/score/threadimpl.h>
#include <rtems/score/cpusetimpl.h>
#include <rtems/score/schedulerimpl.h>
rtems_status_code rtems_task_set_affinity(
-4
View File
@@ -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
-63
View File
@@ -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 <rtems/score/basedefs.h>
#include <sys/cpuset.h>
#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 */
@@ -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 <rtems/score/cpuset.h>
#include <rtems/score/smp.h>
#include <limits.h>
#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 */
@@ -22,7 +22,6 @@
#include <rtems/score/scheduler.h>
#include <rtems/score/assert.h>
#include <rtems/score/cpusetimpl.h>
#include <rtems/score/priorityimpl.h>
#include <rtems/score/smpimpl.h>
#include <rtems/score/status.h>
@@ -22,7 +22,8 @@
#include <rtems/score/schedulerpriority.h>
#include <rtems/score/schedulersmp.h>
#include <rtems/score/schedulerprioritysmp.h>
#include <rtems/score/cpuset.h>
#include <sys/cpuset.h>
#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;
/** @} */
-1
View File
@@ -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
-8
View File
@@ -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
-97
View File
@@ -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;
}
-77
View File
@@ -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 );
}
@@ -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 ) ) {
/*
-1
View File
@@ -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(
-13
View File
@@ -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);