forked from Imagelibrary/rtems
@@ -29,7 +29,6 @@
|
||||
#include <rtems/posix/pthreadimpl.h>
|
||||
#include <rtems/posix/pthreadattrimpl.h>
|
||||
#include <rtems/score/assert.h>
|
||||
#include <rtems/score/cpusetimpl.h>
|
||||
#include <rtems/score/threadimpl.h>
|
||||
#include <rtems/score/apimutex.h>
|
||||
#include <rtems/score/stackimpl.h>
|
||||
@@ -170,11 +169,9 @@ int pthread_create(
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
#if defined(RTEMS_SMP)
|
||||
status = _CPU_set_Is_valid(the_attr->affinityset, the_attr->affinitysetsize);
|
||||
if ( !status )
|
||||
if ( the_attr->affinityset == NULL ) {
|
||||
return EINVAL;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* Currently all POSIX threads are floating point if the hardware
|
||||
@@ -223,7 +220,6 @@ int pthread_create(
|
||||
|
||||
the_thread->Life.state |= THREAD_LIFE_CHANGE_DEFERRED;
|
||||
|
||||
#if defined(RTEMS_SMP)
|
||||
_ISR_lock_ISR_disable( &lock_context );
|
||||
status = _Scheduler_Set_affinity(
|
||||
the_thread,
|
||||
@@ -236,7 +232,6 @@ int pthread_create(
|
||||
_RTEMS_Unlock_allocator();
|
||||
return EINVAL;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* finish initializing the per API structure
|
||||
|
||||
@@ -23,9 +23,6 @@
|
||||
#include <rtems/score/schedulerpriorityimpl.h>
|
||||
#include <rtems/score/schedulersmpimpl.h>
|
||||
#include <rtems/score/schedulerprioritysmpimpl.h>
|
||||
#include <rtems/score/wkspace.h>
|
||||
#include <rtems/score/cpusetimpl.h>
|
||||
|
||||
#include <rtems/score/priority.h>
|
||||
|
||||
/*
|
||||
@@ -606,27 +603,27 @@ bool _Scheduler_priority_affinity_SMP_Set_affinity(
|
||||
const Processor_mask *affinity
|
||||
)
|
||||
{
|
||||
Scheduler_Context *context;
|
||||
Scheduler_priority_affinity_SMP_Node *node;
|
||||
States_Control current_state;
|
||||
Processor_mask my_affinity;
|
||||
cpu_set_t cpuset;
|
||||
size_t cpusetsize;
|
||||
|
||||
cpusetsize = sizeof( cpuset );
|
||||
_Processor_mask_To_cpu_set_t( affinity, cpusetsize, &cpuset );
|
||||
/*
|
||||
* Validate that the cpset meets basic requirements.
|
||||
*/
|
||||
if ( !_CPU_set_Is_valid( &cpuset, cpusetsize ) ) {
|
||||
context = _Scheduler_Get_context( scheduler );
|
||||
_Processor_mask_And( &my_affinity, &context->Processors, affinity );
|
||||
|
||||
if ( _Processor_mask_Count( &my_affinity ) == 0 ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
_Processor_mask_To_cpu_set_t( &my_affinity, sizeof( cpuset ), &cpuset );
|
||||
node = _Scheduler_priority_affinity_SMP_Node_downcast( node_base );
|
||||
|
||||
/*
|
||||
* The old and new set are the same, there is no point in
|
||||
* doing anything.
|
||||
*/
|
||||
if ( CPU_EQUAL_S( cpusetsize, &cpuset, node->Affinity.set ) )
|
||||
if ( CPU_EQUAL( &cpuset, node->Affinity.set ) )
|
||||
return true;
|
||||
|
||||
current_state = thread->current_state;
|
||||
|
||||
@@ -45,11 +45,11 @@ void Validate_setaffinity_errors(void)
|
||||
int sc;
|
||||
cpu_set_t cpuset;
|
||||
|
||||
/* Verify pthread_setaffinity_np checks that all cpu's exist. */
|
||||
/* Verify pthread_setaffinity_np checks that more cpu's don't hurt. */
|
||||
CPU_FILL(&cpuset);
|
||||
puts( "Init - pthread_setaffinity_np - Invalid cpu - EINVAL" );
|
||||
puts( "Init - pthread_setaffinity_np - Lots of cpus - SUCCESS" );
|
||||
sc = pthread_setaffinity_np( Init_id, sizeof(cpu_set_t), &cpuset );
|
||||
rtems_test_assert( sc == EINVAL );
|
||||
rtems_test_assert( sc == 0 );
|
||||
|
||||
/* Verify pthread_setaffinity_np checks that at least one cpu is set */
|
||||
CPU_ZERO(&cpuset);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
*** SMP POSIX AFFINITY ATTRIBUTE TEST 2 ***
|
||||
Init - pthread_setaffinity_np - Invalid cpu - EINVAL
|
||||
*** BEGIN OF TEST SMPPSXAFFINITY 2 ***
|
||||
Init - pthread_setaffinity_np - Lots of cpus - SUCCESS
|
||||
Init - pthread_setaffinity_np - no cpu - EINVAL
|
||||
Init - pthread_setaffinity_np - Invalid thread - ESRCH
|
||||
Init - pthread_setaffinity_np - Invalid cpusetsize - EINVAL
|
||||
@@ -11,7 +11,7 @@ Init - Set Init priority to high
|
||||
Init - Create Medium priority tasks
|
||||
Init - Verify Medium priority tasks
|
||||
Init - Create Low priority tasks
|
||||
Init - Verify Medium priority tasks
|
||||
Init - Verify Low priority tasks
|
||||
Init - Change affinity on Low priority tasks
|
||||
Init - Validate affinity on Low priority tasks
|
||||
*** SMP POSIX AFFINITY ATTRIBUTE TEST 2 ***
|
||||
*** END OF TEST SMPPSXAFFINITY 2 ***
|
||||
|
||||
Reference in New Issue
Block a user