[PATCH v2 09/15] score: Fix default set affinity
Sebastian Huber
sebastian.huber at embedded-brains.de
Fri Jul 7 13:54:46 UTC 2017
The set of online processors must be a subset of the thread processor
affinity for the schedulers without arbitrary processor affinity support
to avoid problems in case of processor addition and removal.
Update #3059.
---
cpukit/score/include/rtems/score/schedulerimpl.h | 7 +++----
testsuites/smptests/smpscheduler02/init.c | 7 ++++---
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/cpukit/score/include/rtems/score/schedulerimpl.h b/cpukit/score/include/rtems/score/schedulerimpl.h
index 6f220acf57..49aaf029e1 100644
--- a/cpukit/score/include/rtems/score/schedulerimpl.h
+++ b/cpukit/score/include/rtems/score/schedulerimpl.h
@@ -612,10 +612,9 @@ RTEMS_INLINE_ROUTINE bool _Scheduler_default_Set_affinity_body(
const Processor_mask *affinity
)
{
- return _Processor_mask_Is_subset(
- affinity,
- _Scheduler_Get_processors( scheduler )
- );
+ (void) scheduler;
+ (void) the_thread;
+ return _Processor_mask_Is_subset( affinity, _SMP_Get_online_processors() );
}
bool _Scheduler_Set_affinity(
diff --git a/testsuites/smptests/smpscheduler02/init.c b/testsuites/smptests/smpscheduler02/init.c
index db7d863991..a15218b368 100644
--- a/testsuites/smptests/smpscheduler02/init.c
+++ b/testsuites/smptests/smpscheduler02/init.c
@@ -223,9 +223,7 @@ static void test(void)
CPU_ZERO(&second_cpu);
CPU_SET(1, &second_cpu);
- CPU_ZERO(&all_cpus);
- CPU_SET(0, &all_cpus);
- CPU_SET(1, &all_cpus);
+ CPU_FILL(&all_cpus);
CPU_ZERO(&online_cpus);
CPU_SET(0, &online_cpus);
@@ -348,6 +346,9 @@ static void test(void)
rtems_test_assert(scheduler_id == scheduler_b_id);
sc = rtems_task_set_affinity(task_id, sizeof(second_cpu), &second_cpu);
+ rtems_test_assert(sc == RTEMS_INVALID_NUMBER);
+
+ sc = rtems_task_set_affinity(task_id, sizeof(online_cpus), &online_cpus);
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
sc = rtems_task_get_scheduler(task_id, &scheduler_id);
--
2.12.3
More information about the devel
mailing list