[rtems-schedsim commit] schedsim_smppriority_affinity: Cleanup scenarios.

Jennifer Averett jennifer at rtems.org
Fri May 23 14:47:05 UTC 2014


Module:    rtems-schedsim
Branch:    master
Commit:    f965428ac73adf305190cafa9d484134089dd1bf
Changeset: http://git.rtems.org/rtems-schedsim/commit/?id=f965428ac73adf305190cafa9d484134089dd1bf

Author:    Jennifer Averett <jennifer.averett at oarcorp.com>
Date:      Wed May 21 09:40:49 2014 -0500

schedsim_smppriority_affinity: Cleanup scenarios.

Add check of expected threads to cpu commands.  Add more documentation and set fix
the expected files.

---

 .../scenarios/cpus1_exercise_affinity_api.expected |    4 +-
 .../scenarios/cpus1_exercise_affinity_api.scen     |    3 +-
 .../scenarios/cpus2_affinity_case1.expected        |   42 ++-----
 .../scenarios/cpus2_affinity_case1.scen            |   15 +--
 .../scenarios/cpus2_affinity_case2.expected        |   48 +++-----
 .../scenarios/cpus2_affinity_case2.scen            |   19 +--
 .../scenarios/cpus2_affinity_case3.expected        |   33 ------
 .../scenarios/cpus2_affinity_case3.scen            |   10 --
 .../scenarios/cpus2_affinity_case4.expected        |   33 ------
 .../scenarios/cpus2_affinity_case4.scen            |   10 --
 .../cpus2_affinity_migrate_case1.expected          |   53 +++++++++
 .../scenarios/cpus2_affinity_migrate_case1.scen    |   19 +++
 .../cpus2_affinity_migrate_case2.expected          |   50 +++++++++
 .../scenarios/cpus2_affinity_migrate_case2.scen    |   20 ++++
 ....expected => cpus4_affinity_api_case1.expected} |   57 +++++-----
 ...nity_api.scen => cpus4_affinity_api_case1.scen} |    2 +-
 .../scenarios/cpus4_affinity_api_case2.expected    |   82 ++++++++++++++
 .../scenarios/cpus4_affinity_api_case2.scen        |   28 +++++
 .../scenarios/cpus4_affinity_block_case1.expected  |  102 +++++++++++++++++
 .../scenarios/cpus4_affinity_block_case1.scn       |   29 +++++
 ...ected => cpus4_affinity_migrate_case1.expected} |   71 ++++++------
 ...ase2.scen => cpus4_affinity_migrate_case1.scen} |   16 ++-
 .../cpus4_affinity_migrate_case2.expected          |   78 +++++++++++++
 .../scenarios/cpus4_affinity_migrate_case2.scen    |   24 ++++
 ...ected => cpus4_affinity_overlap_case1.expected} |  116 +++++++++++---------
 ...ase1.scen => cpus4_affinity_overlap_case1.scen} |    4 +-
 ...cted => cpus4_affinity_priority_case1.expected} |   24 +++--
 ...se1.scen => cpus4_affinity_priority_case1.scen} |    8 +-
 ...cted => cpus4_affinity_priority_case2.expected} |    8 +-
 ...se2.scen => cpus4_affinity_priority_case2.scen} |    6 +-
 .../cpus4_affinity_priority_case3.expected         |   85 ++++++++++++++
 .../scenarios/cpus4_affinity_priority_case3.scen   |   22 ++++
 32 files changed, 807 insertions(+), 314 deletions(-)

diff --git a/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus1_exercise_affinity_api.expected b/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus1_exercise_affinity_api.expected
index ca7a217..3e58112 100644
--- a/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus1_exercise_affinity_api.expected
+++ b/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus1_exercise_affinity_api.expected
@@ -19,9 +19,9 @@ Task (TA1) starting: id=0x0a010001, priority=3
   CPU 0: Thread Executing 0x0a010001 priority=3
 ==> 9: 
 ==> 10: # GOAL: 0x0a010001 is now heir and executing on CPU 0
-==> 11: cpus
+==> 11: cpus TA1
 === CPU Status
           EXECUTING      /   HEIR             / SWITCH NEEDED
   CPU 0: 0x0a010001 @  3 / 0x0a010001 @  3          false
 === End of Ready Set of Threads
-==> 12: 
+*** ERROR in scenario -- unknown task TA1
diff --git a/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus1_exercise_affinity_api.scen b/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus1_exercise_affinity_api.scen
index 3c1bb39..0515374 100644
--- a/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus1_exercise_affinity_api.scen
+++ b/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus1_exercise_affinity_api.scen
@@ -8,5 +8,4 @@ echo "=== Create and start 0x0a010001 ==="
 task_create TA1 3 -a 1
 
 # GOAL: 0x0a010001 is now heir and executing on CPU 0
-cpus
-
+cpus TA1
diff --git a/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus2_affinity_case1.expected b/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus2_affinity_case1.expected
index 643e7ff..125c7b4 100644
--- a/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus2_affinity_case1.expected
+++ b/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus2_affinity_case1.expected
@@ -1,48 +1,32 @@
 Script File               : scenarios/cpus2_affinity_case1.scen
 verbose                   : 1
 ==> 1: #
-==> 2: #  
-==> 3: #
-==> 4: rtems_init 2
+==> 2: # Force Cores such that the first created task
+==> 3: # is on CPU 0 and the second is on CPU 1. 
+==> 4: #
+==> 5: rtems_init 2
   CPU 0: Thread Heir 0x09010001 priority=255
   CPU 0: Thread Executing 0x09010001 priority=255
   CPU 1: Thread Heir 0x09010002 priority=255
   CPU 1: Thread Executing 0x09010002 priority=255
-==> 5: task_create smp1 3 
+==> 6: task_create smp1 3 -a 1 
 Creating task with:  Preemption: yes Timeslicing: no
 Task (smp1) created: id=0x0a010001, priority=3
+Task (0x0a010001) Set affinity=0x00000001
 Task (smp1) starting: id=0x0a010001, priority=3
-  CPU 1: Thread Heir 0x0a010001 priority=3
-  CPU 1: Thread Executing 0x0a010001 priority=3
-==> 6: # GOAL: 0x09010001, 0x0a010001
-==> 7: # GOAL:   on CPUs 0-1 respectively
-==> 8: cpus
-=== CPU Status
-          EXECUTING      /   HEIR             / SWITCH NEEDED
-  CPU 0: 0x09010001 @255 / 0x09010001 @255          false
-  CPU 1: 0x0a010001 @  3 / 0x0a010001 @  3          false
-=== End of Ready Set of Threads
-==> 9: 
-==> 10: task_create smp2 2 -a 2
+  CPU 0: Thread Heir 0x0a010001 priority=3
+  CPU 0: Thread Executing 0x0a010001 priority=3
+==> 7: task_create smp2 2 -a 2
 Creating task with:  Preemption: yes Timeslicing: no
 Task (smp2) created: id=0x0a010002, priority=2
 Task (0x0a010002) Set affinity=0x00000002
 Task (smp2) starting: id=0x0a010002, priority=2
   CPU 1: Thread Heir 0x0a010002 priority=2
   CPU 1: Thread Executing 0x0a010002 priority=2
-==> 11: # GOAL: want 0x09010001, 0x0a010002 as heir and executings
-==> 12: # GOAL:   on CPUs 0 -1 respectively
-==> 13: cpus
-=== CPU Status
-          EXECUTING      /   HEIR             / SWITCH NEEDED
-  CPU 0: 0x09010001 @255 / 0x09010001 @255          false
-  CPU 1: 0x0a010002 @  2 / 0x0a010002 @  2          false
-=== End of Ready Set of Threads
-==> 14: 
-==> 15: dispatch
-==> 16: # GOAL: want 0x0a010001 - 0x0a010002 as heir and executings
-==> 17: # GOAL:   on CPUs 0 -1 respectively
-==> 18: cpus
+==> 8: 
+==> 9: # GOAL: want 0x0a010001 - 0x0a010002 as heir and executings
+==> 10: # GOAL:   on CPUs 0 -1 respectively
+==> 11: cpus smp1 smp2
 === CPU Status
           EXECUTING      /   HEIR             / SWITCH NEEDED
   CPU 0: 0x0a010001 @  3 / 0x0a010001 @  3          false
diff --git a/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus2_affinity_case1.scen b/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus2_affinity_case1.scen
index 2037275..eaf84b3 100644
--- a/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus2_affinity_case1.scen
+++ b/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus2_affinity_case1.scen
@@ -1,18 +1,11 @@
 #
-#  
+# Force Cores such that the first created task
+# is on CPU 0 and the second is on CPU 1. 
 #
 rtems_init 2
-task_create smp1 3 
-# GOAL: 0x09010001, 0x0a010001
-# GOAL:   on CPUs 0-1 respectively
-cpus
-
+task_create smp1 3 -a 1 
 task_create smp2 2 -a 2
-# GOAL: want 0x09010001, 0x0a010002 as heir and executings
-# GOAL:   on CPUs 0 -1 respectively
-cpus
 
-dispatch
 # GOAL: want 0x0a010001 - 0x0a010002 as heir and executings
 # GOAL:   on CPUs 0 -1 respectively
-cpus
+cpus smp1 smp2
diff --git a/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus2_affinity_case2.expected b/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus2_affinity_case2.expected
index a80ab6c..951f836 100644
--- a/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus2_affinity_case2.expected
+++ b/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus2_affinity_case2.expected
@@ -1,48 +1,34 @@
 Script File               : scenarios/cpus2_affinity_case2.scen
 verbose                   : 1
 ==> 1: #
-==> 2: #  
-==> 3: #
-==> 4: rtems_init 2
+==> 2: # Force Cores such that the first created task
+==> 3: # is on CPU 1 and the second is on CPU 0. 
+==> 4: #
+==> 5: rtems_init 2
   CPU 0: Thread Heir 0x09010001 priority=255
   CPU 0: Thread Executing 0x09010001 priority=255
   CPU 1: Thread Heir 0x09010002 priority=255
   CPU 1: Thread Executing 0x09010002 priority=255
-==> 5: task_create smp1 3 
+==> 6: task_create smp1 3 -a 2 
 Creating task with:  Preemption: yes Timeslicing: no
 Task (smp1) created: id=0x0a010001, priority=3
+Task (0x0a010001) Set affinity=0x00000002
 Task (smp1) starting: id=0x0a010001, priority=3
   CPU 1: Thread Heir 0x0a010001 priority=3
   CPU 1: Thread Executing 0x0a010001 priority=3
-==> 6: # GOAL: 0x09010001, 0x0a010001
-==> 7: # GOAL:   on CPUs 0-1 respectively
-==> 8: cpus
-=== CPU Status
-          EXECUTING      /   HEIR             / SWITCH NEEDED
-  CPU 0: 0x09010001 @255 / 0x09010001 @255          false
-  CPU 1: 0x0a010001 @  3 / 0x0a010001 @  3          false
-=== End of Ready Set of Threads
-==> 9: 
-==> 10: task_create smp2 4 -a 2
+==> 7: task_create smp2 2 -a 1
 Creating task with:  Preemption: yes Timeslicing: no
-Task (smp2) created: id=0x0a010002, priority=4
-Task (0x0a010002) Set affinity=0x00000002
-Task (smp2) starting: id=0x0a010002, priority=4
-==> 11: # GOAL: 0x09010001, 0x0a010001
-==> 12: # GOAL:   on CPUs 0 -1 respectively
-==> 13: cpus
-=== CPU Status
-          EXECUTING      /   HEIR             / SWITCH NEEDED
-  CPU 0: 0x09010001 @255 / 0x09010001 @255          false
-  CPU 1: 0x0a010001 @  3 / 0x0a010001 @  3          false
-=== End of Ready Set of Threads
-==> 14: 
-==> 15: dispatch
-==> 16: # GOAL: 0x09010001, 0x0a010001
-==> 17: # GOAL:   on CPUs 0 -1 respectively
-==> 18: cpus
+Task (smp2) created: id=0x0a010002, priority=2
+Task (0x0a010002) Set affinity=0x00000001
+Task (smp2) starting: id=0x0a010002, priority=2
+  CPU 0: Thread Heir 0x0a010002 priority=2
+  CPU 0: Thread Executing 0x0a010002 priority=2
+==> 8: 
+==> 9: # GOAL: want 0x0a010002 - 0x0a010001 as heir and executings
+==> 10: # GOAL:   on CPUs 0 -1 respectively
+==> 11: cpus smp2 smp1
 === CPU Status
           EXECUTING      /   HEIR             / SWITCH NEEDED
-  CPU 0: 0x09010001 @255 / 0x09010001 @255          false
+  CPU 0: 0x0a010002 @  2 / 0x0a010002 @  2          false
   CPU 1: 0x0a010001 @  3 / 0x0a010001 @  3          false
 === End of Ready Set of Threads
diff --git a/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus2_affinity_case2.scen b/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus2_affinity_case2.scen
index e0ef8c2..546f84b 100644
--- a/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus2_affinity_case2.scen
+++ b/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus2_affinity_case2.scen
@@ -1,18 +1,11 @@
 #
-#  
+# Force Cores such that the first created task
+# is on CPU 1 and the second is on CPU 0. 
 #
 rtems_init 2
-task_create smp1 3 
-# GOAL: 0x09010001, 0x0a010001
-# GOAL:   on CPUs 0-1 respectively
-cpus
+task_create smp1 3 -a 2 
+task_create smp2 2 -a 1
 
-task_create smp2 4 -a 2
-# GOAL: 0x09010001, 0x0a010001
+# GOAL: want 0x0a010002 - 0x0a010001 as heir and executings
 # GOAL:   on CPUs 0 -1 respectively
-cpus
-
-dispatch
-# GOAL: 0x09010001, 0x0a010001
-# GOAL:   on CPUs 0 -1 respectively
-cpus
+cpus smp2 smp1
diff --git a/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus2_affinity_case3.expected b/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus2_affinity_case3.expected
deleted file mode 100644
index 2954beb..0000000
--- a/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus2_affinity_case3.expected
+++ /dev/null
@@ -1,33 +0,0 @@
-Script File               : scenarios/cpus2_affinity_case3.scen
-verbose                   : 1
-==> 1: #
-==> 2: #  
-==> 3: #
-==> 4: rtems_init 2
-  CPU 0: Thread Heir 0x09010001 priority=255
-  CPU 0: Thread Executing 0x09010001 priority=255
-  CPU 1: Thread Heir 0x09010002 priority=255
-  CPU 1: Thread Executing 0x09010002 priority=255
-==> 5: task_create smp1 3 -a 1 
-Creating task with:  Preemption: yes Timeslicing: no
-Task (smp1) created: id=0x0a010001, priority=3
-Task (0x0a010001) Set affinity=0x00000001
-Task (smp1) starting: id=0x0a010001, priority=3
-  CPU 0: Thread Heir 0x0a010001 priority=3
-  CPU 0: Thread Executing 0x0a010001 priority=3
-==> 6: task_create smp2 2 -a 2
-Creating task with:  Preemption: yes Timeslicing: no
-Task (smp2) created: id=0x0a010002, priority=2
-Task (0x0a010002) Set affinity=0x00000002
-Task (smp2) starting: id=0x0a010002, priority=2
-  CPU 1: Thread Heir 0x0a010002 priority=2
-  CPU 1: Thread Executing 0x0a010002 priority=2
-==> 7: 
-==> 8: # GOAL: want 0x0a010001 - 0x0a010002 as heir and executings
-==> 9: # GOAL:   on CPUs 0 -1 respectively
-==> 10: cpus
-=== CPU Status
-          EXECUTING      /   HEIR             / SWITCH NEEDED
-  CPU 0: 0x0a010001 @  3 / 0x0a010001 @  3          false
-  CPU 1: 0x0a010002 @  2 / 0x0a010002 @  2          false
-=== End of Ready Set of Threads
diff --git a/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus2_affinity_case3.scen b/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus2_affinity_case3.scen
deleted file mode 100644
index 97a06e5..0000000
--- a/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus2_affinity_case3.scen
+++ /dev/null
@@ -1,10 +0,0 @@
-#
-#  
-#
-rtems_init 2
-task_create smp1 3 -a 1 
-task_create smp2 2 -a 2
-
-# GOAL: want 0x0a010001 - 0x0a010002 as heir and executings
-# GOAL:   on CPUs 0 -1 respectively
-cpus
diff --git a/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus2_affinity_case4.expected b/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus2_affinity_case4.expected
deleted file mode 100644
index 9456370..0000000
--- a/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus2_affinity_case4.expected
+++ /dev/null
@@ -1,33 +0,0 @@
-Script File               : scenarios/cpus2_affinity_case4.scen
-verbose                   : 1
-==> 1: #
-==> 2: #  
-==> 3: #
-==> 4: rtems_init 2
-  CPU 0: Thread Heir 0x09010001 priority=255
-  CPU 0: Thread Executing 0x09010001 priority=255
-  CPU 1: Thread Heir 0x09010002 priority=255
-  CPU 1: Thread Executing 0x09010002 priority=255
-==> 5: task_create smp1 3 -a 2 
-Creating task with:  Preemption: yes Timeslicing: no
-Task (smp1) created: id=0x0a010001, priority=3
-Task (0x0a010001) Set affinity=0x00000002
-Task (smp1) starting: id=0x0a010001, priority=3
-  CPU 1: Thread Heir 0x0a010001 priority=3
-  CPU 1: Thread Executing 0x0a010001 priority=3
-==> 6: task_create smp2 2 -a 1
-Creating task with:  Preemption: yes Timeslicing: no
-Task (smp2) created: id=0x0a010002, priority=2
-Task (0x0a010002) Set affinity=0x00000001
-Task (smp2) starting: id=0x0a010002, priority=2
-  CPU 0: Thread Heir 0x0a010002 priority=2
-  CPU 0: Thread Executing 0x0a010002 priority=2
-==> 7: 
-==> 8: # GOAL: want 0x0a010002 - 0x0a010001 as heir and executings
-==> 9: # GOAL:   on CPUs 0 -1 respectively
-==> 10: cpus
-=== CPU Status
-          EXECUTING      /   HEIR             / SWITCH NEEDED
-  CPU 0: 0x0a010002 @  2 / 0x0a010002 @  2          false
-  CPU 1: 0x0a010001 @  3 / 0x0a010001 @  3          false
-=== End of Ready Set of Threads
diff --git a/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus2_affinity_case4.scen b/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus2_affinity_case4.scen
deleted file mode 100644
index 2b10849..0000000
--- a/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus2_affinity_case4.scen
+++ /dev/null
@@ -1,10 +0,0 @@
-#
-#  
-#
-rtems_init 2
-task_create smp1 3 -a 2 
-task_create smp2 2 -a 1
-
-# GOAL: want 0x0a010002 - 0x0a010001 as heir and executings
-# GOAL:   on CPUs 0 -1 respectively
-cpus
diff --git a/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus2_affinity_migrate_case1.expected b/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus2_affinity_migrate_case1.expected
new file mode 100644
index 0000000..f7387d5
--- /dev/null
+++ b/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus2_affinity_migrate_case1.expected
@@ -0,0 +1,53 @@
+Script File               : scenarios/cpus2_affinity_migrate_case1.scen
+verbose                   : 1
+==> 1: #
+==> 2: # Create a second task that forces and existing
+==> 3: # task to migrate CPUs at start. 
+==> 4: #
+==> 5: rtems_init 2
+  CPU 0: Thread Heir 0x09010001 priority=255
+  CPU 0: Thread Executing 0x09010001 priority=255
+  CPU 1: Thread Heir 0x09010002 priority=255
+  CPU 1: Thread Executing 0x09010002 priority=255
+==> 6: task_create smp1 3 
+Creating task with:  Preemption: yes Timeslicing: no
+Task (smp1) created: id=0x0a010001, priority=3
+Task (smp1) starting: id=0x0a010001, priority=3
+  CPU 1: Thread Heir 0x0a010001 priority=3
+  CPU 1: Thread Executing 0x0a010001 priority=3
+==> 7: # GOAL: 0x09010001, 0x0a010001
+==> 8: # GOAL:   on CPUs 0-1 respectively
+==> 9: cpus IDLE smp1
+=== CPU Status
+          EXECUTING      /   HEIR             / SWITCH NEEDED
+  CPU 0: 0x09010001 @255 / 0x09010001 @255          false
+  CPU 1: 0x0a010001 @  3 / 0x0a010001 @  3          false
+=== End of Ready Set of Threads
+==> 10: 
+==> 11: task_create smp2 2 -a 2
+Creating task with:  Preemption: yes Timeslicing: no
+Task (smp2) created: id=0x0a010002, priority=2
+Task (0x0a010002) Set affinity=0x00000002
+Task (smp2) starting: id=0x0a010002, priority=2
+  CPU 0: Thread Heir 0x0a010001 priority=3
+  CPU 0: Thread Executing 0x0a010001 priority=3
+  CPU 1: Thread Heir 0x0a010002 priority=2
+  CPU 1: Thread Executing 0x0a010002 priority=2
+==> 12: # GOAL: want 0x09010001, 0x0a010002 as heir and executings
+==> 13: # GOAL:   on CPUs 0 -1 respectively
+==> 14: cpus smp1 smp2
+=== CPU Status
+          EXECUTING      /   HEIR             / SWITCH NEEDED
+  CPU 0: 0x0a010001 @  3 / 0x0a010001 @  3          false
+  CPU 1: 0x0a010002 @  2 / 0x0a010002 @  2          false
+=== End of Ready Set of Threads
+==> 15: 
+==> 16: dispatch
+==> 17: # GOAL: want 0x0a010001 - 0x0a010002 as heir and executings
+==> 18: # GOAL:   on CPUs 0 -1 respectively
+==> 19: cpus smp1 smp2
+=== CPU Status
+          EXECUTING      /   HEIR             / SWITCH NEEDED
+  CPU 0: 0x0a010001 @  3 / 0x0a010001 @  3          false
+  CPU 1: 0x0a010002 @  2 / 0x0a010002 @  2          false
+=== End of Ready Set of Threads
diff --git a/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus2_affinity_migrate_case1.scen b/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus2_affinity_migrate_case1.scen
new file mode 100644
index 0000000..0fedf39
--- /dev/null
+++ b/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus2_affinity_migrate_case1.scen
@@ -0,0 +1,19 @@
+#
+# Create a second task that forces and existing
+# task to migrate CPUs at start. 
+#
+rtems_init 2
+task_create smp1 3 
+# GOAL: 0x09010001, 0x0a010001
+# GOAL:   on CPUs 0-1 respectively
+cpus IDLE smp1
+
+task_create smp2 2 -a 2
+# GOAL: want 0x09010001, 0x0a010002 as heir and executings
+# GOAL:   on CPUs 0 -1 respectively
+cpus smp1 smp2
+
+dispatch
+# GOAL: want 0x0a010001 - 0x0a010002 as heir and executings
+# GOAL:   on CPUs 0 -1 respectively
+cpus smp1 smp2
diff --git a/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus2_affinity_migrate_case2.expected b/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus2_affinity_migrate_case2.expected
new file mode 100644
index 0000000..d1cb8f5
--- /dev/null
+++ b/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus2_affinity_migrate_case2.expected
@@ -0,0 +1,50 @@
+Script File               : scenarios/cpus2_affinity_migrate_case2.scen
+verbose                   : 1
+==> 1: #
+==> 2: # Create a second task that is lower priority than
+==> 3: # the first but wants to run on the cpu the first
+==> 4: # task was assigned to.
+==> 5: #
+==> 6: rtems_init 2
+  CPU 0: Thread Heir 0x09010001 priority=255
+  CPU 0: Thread Executing 0x09010001 priority=255
+  CPU 1: Thread Heir 0x09010002 priority=255
+  CPU 1: Thread Executing 0x09010002 priority=255
+==> 7: task_create smp1 3 
+Creating task with:  Preemption: yes Timeslicing: no
+Task (smp1) created: id=0x0a010001, priority=3
+Task (smp1) starting: id=0x0a010001, priority=3
+  CPU 1: Thread Heir 0x0a010001 priority=3
+  CPU 1: Thread Executing 0x0a010001 priority=3
+==> 8: # GOAL: 0x09010001, 0x0a010001
+==> 9: # GOAL:   on CPUs 0-1 respectively
+==> 10: cpus IDLE smp1
+=== CPU Status
+          EXECUTING      /   HEIR             / SWITCH NEEDED
+  CPU 0: 0x09010001 @255 / 0x09010001 @255          false
+  CPU 1: 0x0a010001 @  3 / 0x0a010001 @  3          false
+=== End of Ready Set of Threads
+==> 11: 
+==> 12: task_create smp2 4 -a 2
+Creating task with:  Preemption: yes Timeslicing: no
+Task (smp2) created: id=0x0a010002, priority=4
+Task (0x0a010002) Set affinity=0x00000002
+Task (smp2) starting: id=0x0a010002, priority=4
+==> 13: # GOAL: 0x09010001, 0x0a010001
+==> 14: # GOAL:   on CPUs 0 -1 respectively
+==> 15: cpus IDLE smp1
+=== CPU Status
+          EXECUTING      /   HEIR             / SWITCH NEEDED
+  CPU 0: 0x09010001 @255 / 0x09010001 @255          false
+  CPU 1: 0x0a010001 @  3 / 0x0a010001 @  3          false
+=== End of Ready Set of Threads
+==> 16: 
+==> 17: dispatch
+==> 18: # GOAL: 0x09010001, 0x0a010001
+==> 19: # GOAL:   on CPUs 0 -1 respectively
+==> 20: cpus IDLE smp1
+=== CPU Status
+          EXECUTING      /   HEIR             / SWITCH NEEDED
+  CPU 0: 0x09010001 @255 / 0x09010001 @255          false
+  CPU 1: 0x0a010001 @  3 / 0x0a010001 @  3          false
+=== End of Ready Set of Threads
diff --git a/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus2_affinity_migrate_case2.scen b/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus2_affinity_migrate_case2.scen
new file mode 100644
index 0000000..89731d8
--- /dev/null
+++ b/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus2_affinity_migrate_case2.scen
@@ -0,0 +1,20 @@
+#
+# Create a second task that is lower priority than
+# the first but wants to run on the cpu the first
+# task was assigned to.
+#
+rtems_init 2
+task_create smp1 3 
+# GOAL: 0x09010001, 0x0a010001
+# GOAL:   on CPUs 0-1 respectively
+cpus IDLE smp1
+
+task_create smp2 4 -a 2
+# GOAL: 0x09010001, 0x0a010001
+# GOAL:   on CPUs 0 -1 respectively
+cpus IDLE smp1
+
+dispatch
+# GOAL: 0x09010001, 0x0a010001
+# GOAL:   on CPUs 0 -1 respectively
+cpus IDLE smp1
diff --git a/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_exercise_affinity_api.expected b/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_affinity_api_case1.expected
similarity index 70%
rename from schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_exercise_affinity_api.expected
rename to schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_affinity_api_case1.expected
index 13a89ae..f5f86d6 100644
--- a/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_exercise_affinity_api.expected
+++ b/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_affinity_api_case1.expected
@@ -1,9 +1,12 @@
-Script File               : scenarios/cpus4_exercise_affinity_api.scen
+Script File               : scenarios/cpus4_affinity_api_case1.scen
 verbose                   : 1
 ==> 1: #
 ==> 2: #  Verify that affinity APIs work with the right values
 ==> 3: #
-==> 4: rtems_init 4
+==> 4: #  This scenario does **NOT** change the affinity of any thread
+==> 5: #  which ever executes.
+==> 6: #
+==> 7: rtems_init 4
   CPU 0: Thread Heir 0x09010001 priority=255
   CPU 0: Thread Executing 0x09010001 priority=255
   CPU 1: Thread Heir 0x09010002 priority=255
@@ -12,38 +15,38 @@ verbose                   : 1
   CPU 2: Thread Executing 0x09010003 priority=255
   CPU 3: Thread Heir 0x09010004 priority=255
   CPU 3: Thread Executing 0x09010004 priority=255
-==> 5: task_create smp1 3
+==> 8: task_create smp1 3
 Creating task with:  Preemption: yes Timeslicing: no
 Task (smp1) created: id=0x0a010001, priority=3
 Task (smp1) starting: id=0x0a010001, priority=3
   CPU 3: Thread Heir 0x0a010001 priority=3
   CPU 3: Thread Executing 0x0a010001 priority=3
-==> 6: task_create smp2 6
+==> 9: task_create smp2 6
 Creating task with:  Preemption: yes Timeslicing: no
 Task (smp2) created: id=0x0a010002, priority=6
 Task (smp2) starting: id=0x0a010002, priority=6
   CPU 2: Thread Heir 0x0a010002 priority=6
   CPU 2: Thread Executing 0x0a010002 priority=6
-==> 7: task_create smp3 7
+==> 10: task_create smp3 7
 Creating task with:  Preemption: yes Timeslicing: no
 Task (smp3) created: id=0x0a010003, priority=7
 Task (smp3) starting: id=0x0a010003, priority=7
   CPU 1: Thread Heir 0x0a010003 priority=7
   CPU 1: Thread Executing 0x0a010003 priority=7
-==> 8: task_create smp4 8
+==> 11: task_create smp4 8
 Creating task with:  Preemption: yes Timeslicing: no
 Task (smp4) created: id=0x0a010004, priority=8
 Task (smp4) starting: id=0x0a010004, priority=8
   CPU 0: Thread Heir 0x0a010004 priority=8
   CPU 0: Thread Executing 0x0a010004 priority=8
-==> 9: task_create smp5 10
+==> 12: task_create smp5 10
 Creating task with:  Preemption: yes Timeslicing: no
 Task (smp5) created: id=0x0a010005, priority=10
 Task (smp5) starting: id=0x0a010005, priority=10
-==> 10: dispatch
-==> 11: # GOAL: Tasks 0x0a010001 - 0x0a010004 as heir and executing
-==> 12: # GOAL:    on CPUs 1 - 4 respectively
-==> 13: cpus
+==> 13: dispatch
+==> 14: # GOAL: Tasks 0x0a010001 - 0x0a010004 as heir and executing
+==> 15: # GOAL:    on CPUs 1 - 4 respectively
+==> 16: cpus smp4 smp3 smp2 smp1
 === CPU Status
           EXECUTING      /   HEIR             / SWITCH NEEDED
   CPU 0: 0x0a010004 @  8 / 0x0a010004 @  8          false
@@ -51,29 +54,29 @@ Task (smp5) starting: id=0x0a010005, priority=10
   CPU 2: 0x0a010002 @  6 / 0x0a010002 @  6          false
   CPU 3: 0x0a010001 @  3 / 0x0a010001 @  3          false
 === End of Ready Set of Threads
-==> 14: 
-==> 15: # GOAL: These should work OK and change the affinity
-==> 16: task_get_affinity smp5
+==> 17: 
+==> 18: # GOAL: These should work OK and change the affinity
+==> 19: task_get_affinity smp5
 Task (0x0a010005) Get affinity=0x0000000f
-==> 17: task_set_affinity smp5 0x01
+==> 20: task_set_affinity smp5 0x01
 Task (0x0a010005) Set affinity=0x00000001
-==> 18: task_get_affinity smp5
+==> 21: task_get_affinity smp5
 Task (0x0a010005) Get affinity=0x00000001
-==> 19: task_set_affinity smp5 0x02
+==> 22: task_set_affinity smp5 0x02
 Task (0x0a010005) Set affinity=0x00000002
-==> 20: task_get_affinity smp5
+==> 23: task_get_affinity smp5
 Task (0x0a010005) Get affinity=0x00000002
-==> 21: task_set_affinity smp5 0x04
+==> 24: task_set_affinity smp5 0x04
 Task (0x0a010005) Set affinity=0x00000004
-==> 22: task_get_affinity smp5
+==> 25: task_get_affinity smp5
 Task (0x0a010005) Get affinity=0x00000004
-==> 23: task_set_affinity smp5 0x08
+==> 26: task_set_affinity smp5 0x08
 Task (0x0a010005) Set affinity=0x00000008
-==> 24: task_get_affinity smp5
+==> 27: task_get_affinity smp5
 Task (0x0a010005) Get affinity=0x00000008
-==> 25: 
-==> 26: # GOAL This should fail.
-==> 27: task_set_affinity smp5 0x10
-==> 28: task_get_affinity smp5
+==> 28: 
+==> 29: # GOAL This should fail.
+==> 30: task_set_affinity smp5 0x10
+==> 31: task_get_affinity smp5
 Task (0x0a010005) Get affinity=0x00000008
-==> 29: 
+==> 32: 
diff --git a/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_exercise_affinity_api.scen b/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_affinity_api_case1.scen
similarity index 96%
rename from schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_exercise_affinity_api.scen
rename to schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_affinity_api_case1.scen
index 809be80..68b94c6 100644
--- a/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_exercise_affinity_api.scen
+++ b/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_affinity_api_case1.scen
@@ -13,7 +13,7 @@ task_create smp5 10
 dispatch
 # GOAL: Tasks 0x0a010001 - 0x0a010004 as heir and executing
 # GOAL:    on CPUs 1 - 4 respectively
-cpus
+cpus smp4 smp3 smp2 smp1
 
 # GOAL: These should work OK and change the affinity
 task_get_affinity smp5
diff --git a/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_affinity_api_case2.expected b/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_affinity_api_case2.expected
new file mode 100644
index 0000000..4609369
--- /dev/null
+++ b/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_affinity_api_case2.expected
@@ -0,0 +1,82 @@
+Script File               : scenarios/cpus4_affinity_api_case2.scen
+verbose                   : 1
+==> 1: #
+==> 2: #  Verify that affinity APIs work with the right values
+==> 3: #
+==> 4: #  This scenario does **NOT** change the affinity of any thread
+==> 5: #  which ever executes.
+==> 6: #
+==> 7: rtems_init 4
+  CPU 0: Thread Heir 0x09010001 priority=255
+  CPU 0: Thread Executing 0x09010001 priority=255
+  CPU 1: Thread Heir 0x09010002 priority=255
+  CPU 1: Thread Executing 0x09010002 priority=255
+  CPU 2: Thread Heir 0x09010003 priority=255
+  CPU 2: Thread Executing 0x09010003 priority=255
+  CPU 3: Thread Heir 0x09010004 priority=255
+  CPU 3: Thread Executing 0x09010004 priority=255
+==> 8: task_create smp1 5
+Creating task with:  Preemption: yes Timeslicing: no
+Task (smp1) created: id=0x0a010001, priority=5
+Task (smp1) starting: id=0x0a010001, priority=5
+  CPU 3: Thread Heir 0x0a010001 priority=5
+  CPU 3: Thread Executing 0x0a010001 priority=5
+==> 9: task_create smp2 6
+Creating task with:  Preemption: yes Timeslicing: no
+Task (smp2) created: id=0x0a010002, priority=6
+Task (smp2) starting: id=0x0a010002, priority=6
+  CPU 2: Thread Heir 0x0a010002 priority=6
+  CPU 2: Thread Executing 0x0a010002 priority=6
+==> 10: task_create smp3 6
+Creating task with:  Preemption: yes Timeslicing: no
+Task (smp3) created: id=0x0a010003, priority=6
+Task (smp3) starting: id=0x0a010003, priority=6
+  CPU 1: Thread Heir 0x0a010003 priority=6
+  CPU 1: Thread Executing 0x0a010003 priority=6
+==> 11: task_create smp4 5
+Creating task with:  Preemption: yes Timeslicing: no
+Task (smp4) created: id=0x0a010004, priority=5
+Task (smp4) starting: id=0x0a010004, priority=5
+  CPU 0: Thread Heir 0x0a010004 priority=5
+  CPU 0: Thread Executing 0x0a010004 priority=5
+==> 12: task_create smp5 6
+Creating task with:  Preemption: yes Timeslicing: no
+Task (smp5) created: id=0x0a010005, priority=6
+Task (smp5) starting: id=0x0a010005, priority=6
+==> 13: dispatch
+==> 14: # GOAL: Tasks 0x0a01000[4321] as heir and executing on CPUs 0 - 3 respectively
+==> 15: # GOAL: smp5 has too low priority to run
+==> 16: cpus smp4 smp3 smp2 smp1
+=== CPU Status
+          EXECUTING      /   HEIR             / SWITCH NEEDED
+  CPU 0: 0x0a010004 @  5 / 0x0a010004 @  5          false
+  CPU 1: 0x0a010003 @  6 / 0x0a010003 @  6          false
+  CPU 2: 0x0a010002 @  6 / 0x0a010002 @  6          false
+  CPU 3: 0x0a010001 @  5 / 0x0a010001 @  5          false
+=== End of Ready Set of Threads
+==> 17: 
+==> 18: # GOAL: This should work OK and change the affinity
+==> 19: # GOAL: Internally, smp5 should be selected as heir for CPU 3 while
+==> 20: # GOAL: smp1 is in migrate state. When the migrate state is cleared
+==> 21: # GOAL: at the end of set affinity, smp1 will end up on CPU 1.
+==> 22: #
+==> 23: # NOTE: On a scheduler without SMP, smp1 will be on CPU 3
+==> 24: task_get_affinity smp1
+Task (0x0a010001) Get affinity=0x0000000f
+==> 25: task_set_affinity smp1 0x02
+  CPU 1: Thread Heir 0x0a010001 priority=5
+  CPU 1: Thread Executing 0x0a010001 priority=5
+  CPU 3: Thread Heir 0x0a010005 priority=6
+  CPU 3: Thread Executing 0x0a010005 priority=6
+Task (0x0a010001) Set affinity=0x00000002
+==> 26: task_get_affinity smp1
+Task (0x0a010001) Get affinity=0x00000002
+==> 27: 
+==> 28: cpus smp4 smp1 smp2 smp5
+=== CPU Status
+          EXECUTING      /   HEIR             / SWITCH NEEDED
+  CPU 0: 0x0a010004 @  5 / 0x0a010004 @  5          false
+  CPU 1: 0x0a010001 @  5 / 0x0a010001 @  5          false
+  CPU 2: 0x0a010002 @  6 / 0x0a010002 @  6          false
+  CPU 3: 0x0a010005 @  6 / 0x0a010005 @  6          false
+=== End of Ready Set of Threads
diff --git a/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_affinity_api_case2.scen b/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_affinity_api_case2.scen
new file mode 100644
index 0000000..fa4817e
--- /dev/null
+++ b/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_affinity_api_case2.scen
@@ -0,0 +1,28 @@
+#
+#  Verify that affinity APIs work with the right values
+#
+#  This scenario does **NOT** change the affinity of any thread
+#  which ever executes.
+#
+rtems_init 4
+task_create smp1 5
+task_create smp2 6
+task_create smp3 6
+task_create smp4 5
+task_create smp5 6
+dispatch
+# GOAL: Tasks 0x0a01000[4321] as heir and executing on CPUs 0 - 3 respectively
+# GOAL: smp5 has too low priority to run
+cpus smp4 smp3 smp2 smp1
+
+# GOAL: This should work OK and change the affinity
+# GOAL: Internally, smp5 should be selected as heir for CPU 3 while
+# GOAL: smp1 is in migrate state. When the migrate state is cleared
+# GOAL: at the end of set affinity, smp1 will end up on CPU 1.
+#
+# NOTE: On a scheduler without SMP, smp1 will be on CPU 3
+task_get_affinity smp1
+task_set_affinity smp1 0x02
+task_get_affinity smp1
+
+cpus smp4 smp1 smp2 smp5
diff --git a/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_affinity_block_case1.expected b/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_affinity_block_case1.expected
new file mode 100644
index 0000000..e619d97
--- /dev/null
+++ b/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_affinity_block_case1.expected
@@ -0,0 +1,102 @@
+Script File               : scenarios/cpus4_affinity_2.scen
+verbose                   : 1
+==> 1: #
+==> 2: #  Block a thread in an application with thread affinity and 
+==> 3: #  priorities such that finding an heir requires scanning the
+==> 4: #  ready set of threads.
+==> 5: #
+==> 6: #  Basic premise:
+==> 7: #    - Two threads at low priority, affinity for core 0
+==> 8: #    - More threads than core at high priority, affinity for all but core 0
+==> 9: #
+==> 10: rtems_init 4
+  CPU 0: Thread Heir 0x09010001 priority=255
+  CPU 0: Thread Executing 0x09010001 priority=255
+  CPU 1: Thread Heir 0x09010002 priority=255
+  CPU 1: Thread Executing 0x09010002 priority=255
+  CPU 2: Thread Heir 0x09010003 priority=255
+  CPU 2: Thread Executing 0x09010003 priority=255
+  CPU 3: Thread Heir 0x09010004 priority=255
+  CPU 3: Thread Executing 0x09010004 priority=255
+==> 11: task_create smp1 -a 0xe 10
+Creating task with:  Preemption: yes Timeslicing: no
+Task (smp1) created: id=0x0a010001, priority=10
+Task (0x0a010001) Set affinity=0x0000000e
+Task (smp1) starting: id=0x0a010001, priority=10
+  CPU 3: Thread Heir 0x0a010001 priority=10
+  CPU 3: Thread Executing 0x0a010001 priority=10
+==> 12: task_create smp2 -a 0xe 10
+Creating task with:  Preemption: yes Timeslicing: no
+Task (smp2) created: id=0x0a010002, priority=10
+Task (0x0a010002) Set affinity=0x0000000e
+Task (smp2) starting: id=0x0a010002, priority=10
+  CPU 2: Thread Heir 0x0a010002 priority=10
+  CPU 2: Thread Executing 0x0a010002 priority=10
+==> 13: task_create smp3 -a 0xe 10
+Creating task with:  Preemption: yes Timeslicing: no
+Task (smp3) created: id=0x0a010003, priority=10
+Task (0x0a010003) Set affinity=0x0000000e
+Task (smp3) starting: id=0x0a010003, priority=10
+  CPU 1: Thread Heir 0x0a010003 priority=10
+  CPU 1: Thread Executing 0x0a010003 priority=10
+==> 14: task_create smp4 -a 0xe 10
+Creating task with:  Preemption: yes Timeslicing: no
+Task (smp4) created: id=0x0a010004, priority=10
+Task (0x0a010004) Set affinity=0x0000000e
+Task (smp4) starting: id=0x0a010004, priority=10
+==> 15: # GOAL: Core 0 should be idle
+==> 16: # GOAL: Cores 1-3 should be 0x0a01000[321] respectively
+==> 17: cpus IDLE smp3 smp2 smp1
+=== CPU Status
+          EXECUTING      /   HEIR             / SWITCH NEEDED
+  CPU 0: 0x09010001 @255 / 0x09010001 @255          false
+  CPU 1: 0x0a010003 @ 10 / 0x0a010003 @ 10          false
+  CPU 2: 0x0a010002 @ 10 / 0x0a010002 @ 10          false
+  CPU 3: 0x0a010001 @ 10 / 0x0a010001 @ 10          false
+=== End of Ready Set of Threads
+==> 18: 
+==> 19: # check_tasks IDLE smp3 smp2 smp1
+==> 20: # GOAL: Core 0 should have aff1 0x0a010005
+==> 21: # GOAL: Cores 1-3 should be 0x0a01000[321] respectively
+==> 22: task_create aff1 -a 0x1 11
+Creating task with:  Preemption: yes Timeslicing: no
+Task (aff1) created: id=0x0a010005, priority=11
+Task (0x0a010005) Set affinity=0x00000001
+Task (aff1) starting: id=0x0a010005, priority=11
+  CPU 0: Thread Heir 0x0a010005 priority=11
+  CPU 0: Thread Executing 0x0a010005 priority=11
+==> 23: cpus aff1 smp3 smp2 smp1
+=== CPU Status
+          EXECUTING      /   HEIR             / SWITCH NEEDED
+  CPU 0: 0x0a010005 @ 11 / 0x0a010005 @ 11          false
+  CPU 1: 0x0a010003 @ 10 / 0x0a010003 @ 10          false
+  CPU 2: 0x0a010002 @ 10 / 0x0a010002 @ 10          false
+  CPU 3: 0x0a010001 @ 10 / 0x0a010001 @ 10          false
+=== End of Ready Set of Threads
+==> 24: 
+==> 25: # Create a low priority task with affinity to core 0
+==> 26: task_create aff2 -a 0x1 11
+Creating task with:  Preemption: yes Timeslicing: no
+Task (aff2) created: id=0x0a010006, priority=11
+Task (0x0a010006) Set affinity=0x00000001
+Task (aff2) starting: id=0x0a010006, priority=11
+==> 27: cpus aff1 smp3 smp2 smp1
+=== CPU Status
+          EXECUTING      /   HEIR             / SWITCH NEEDED
+  CPU 0: 0x0a010005 @ 11 / 0x0a010005 @ 11          false
+  CPU 1: 0x0a010003 @ 10 / 0x0a010003 @ 10          false
+  CPU 2: 0x0a010002 @ 10 / 0x0a010002 @ 10          false
+  CPU 3: 0x0a010001 @ 10 / 0x0a010001 @ 10          false
+=== End of Ready Set of Threads
+==> 28: task_suspend aff1
+Suspending task (0x0a010005)
+  CPU 0: Thread Heir 0x0a010006 priority=11
+  CPU 0: Thread Executing 0x0a010006 priority=11
+==> 29: cpus aff2 smp3 smp2 smp1
+=== CPU Status
+          EXECUTING      /   HEIR             / SWITCH NEEDED
+  CPU 0: 0x0a010006 @ 11 / 0x0a010006 @ 11          false
+  CPU 1: 0x0a010003 @ 10 / 0x0a010003 @ 10          false
+  CPU 2: 0x0a010002 @ 10 / 0x0a010002 @ 10          false
+  CPU 3: 0x0a010001 @ 10 / 0x0a010001 @ 10          false
+=== End of Ready Set of Threads
diff --git a/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_affinity_block_case1.scn b/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_affinity_block_case1.scn
new file mode 100644
index 0000000..694da1d
--- /dev/null
+++ b/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_affinity_block_case1.scn
@@ -0,0 +1,29 @@
+#
+#  Block a thread in an application with thread affinity and 
+#  priorities such that finding an heir requires scanning the
+#  ready set of threads.
+#
+#  Basic premise:
+#    - Two threads at low priority, affinity for core 0
+#    - More threads than core at high priority, affinity for all but core 0
+#
+rtems_init 4
+task_create smp1 -a 0xe 10
+task_create smp2 -a 0xe 10
+task_create smp3 -a 0xe 10
+task_create smp4 -a 0xe 10
+# GOAL: Core 0 should be idle
+# GOAL: Cores 1-3 should be 0x0a01000[321] respectively
+cpus IDLE smp3 smp2 smp1
+
+# check_tasks IDLE smp3 smp2 smp1
+# GOAL: Core 0 should have aff1 0x0a010005
+# GOAL: Cores 1-3 should be 0x0a01000[321] respectively
+task_create aff1 -a 0x1 11
+cpus aff1 smp3 smp2 smp1
+
+# Create a low priority task with affinity to core 0
+task_create aff2 -a 0x1 11
+cpus aff1 smp3 smp2 smp1
+task_suspend aff1
+cpus aff2 smp3 smp2 smp1
diff --git a/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_affinity_case2.expected b/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_affinity_migrate_case1.expected
similarity index 61%
rename from schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_affinity_case2.expected
rename to schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_affinity_migrate_case1.expected
index a763f61..a82d073 100644
--- a/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_affinity_case2.expected
+++ b/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_affinity_migrate_case1.expected
@@ -1,9 +1,11 @@
-Script File               : scenarios/cpus4_affinity_case2.scen
+Script File               : scenarios/cpus4_affinity_migrate_case1.scen
 verbose                   : 1
 ==> 1: #
-==> 2: #  
-==> 3: #
-==> 4: rtems_init 4
+==> 2: # Create 5 tasks of the same priority.  Then
+==> 3: # change the affinity and the priority of the
+==> 4: # task that is on the ready queue. 
+==> 5: #
+==> 6: rtems_init 4
   CPU 0: Thread Heir 0x09010001 priority=255
   CPU 0: Thread Executing 0x09010001 priority=255
   CPU 1: Thread Heir 0x09010002 priority=255
@@ -12,38 +14,38 @@ verbose                   : 1
   CPU 2: Thread Executing 0x09010003 priority=255
   CPU 3: Thread Heir 0x09010004 priority=255
   CPU 3: Thread Executing 0x09010004 priority=255
-==> 5: task_create smp1 4 
+==> 7: task_create smp1 4 
 Creating task with:  Preemption: yes Timeslicing: no
 Task (smp1) created: id=0x0a010001, priority=4
 Task (smp1) starting: id=0x0a010001, priority=4
   CPU 3: Thread Heir 0x0a010001 priority=4
   CPU 3: Thread Executing 0x0a010001 priority=4
-==> 6: task_create smp2 4
+==> 8: task_create smp2 4
 Creating task with:  Preemption: yes Timeslicing: no
 Task (smp2) created: id=0x0a010002, priority=4
 Task (smp2) starting: id=0x0a010002, priority=4
   CPU 2: Thread Heir 0x0a010002 priority=4
   CPU 2: Thread Executing 0x0a010002 priority=4
-==> 7: task_create smp3 4
+==> 9: task_create smp3 4
 Creating task with:  Preemption: yes Timeslicing: no
 Task (smp3) created: id=0x0a010003, priority=4
 Task (smp3) starting: id=0x0a010003, priority=4
   CPU 1: Thread Heir 0x0a010003 priority=4
   CPU 1: Thread Executing 0x0a010003 priority=4
-==> 8: task_create smp4 4
+==> 10: task_create smp4 4
 Creating task with:  Preemption: yes Timeslicing: no
 Task (smp4) created: id=0x0a010004, priority=4
 Task (smp4) starting: id=0x0a010004, priority=4
   CPU 0: Thread Heir 0x0a010004 priority=4
   CPU 0: Thread Executing 0x0a010004 priority=4
-==> 9: task_create smp5 4
+==> 11: task_create smp5 4
 Creating task with:  Preemption: yes Timeslicing: no
 Task (smp5) created: id=0x0a010005, priority=4
 Task (smp5) starting: id=0x0a010005, priority=4
-==> 10: 
-==> 11: # GOAL: want 0x0a010004 - 0x0a010001 as heir and executings
-==> 12: # GOAL:   on CPUs 0 -3 respectively
-==> 13: cpus
+==> 12: 
+==> 13: # GOAL: want 0x0a010004 - 0x0a010001 as heir and executings
+==> 14: # GOAL:   on CPUs 0 -3 respectively
+==> 15: cpus smp4 smp3 smp2 smp1
 === CPU Status
           EXECUTING      /   HEIR             / SWITCH NEEDED
   CPU 0: 0x0a010004 @  4 / 0x0a010004 @  4          false
@@ -51,35 +53,34 @@ Task (smp5) starting: id=0x0a010005, priority=4
   CPU 2: 0x0a010002 @  4 / 0x0a010002 @  4          false
   CPU 3: 0x0a010001 @  4 / 0x0a010001 @  4          false
 === End of Ready Set of Threads
-==> 14: 
-==> 15: task_set_affinity smp5 0x03
+==> 16: 
+==> 17: task_set_affinity smp5 0x03
 Task (0x0a010005) Set affinity=0x00000003
-  CPU 1: Thread Heir 0x0a010005 priority=4
-  CPU 1: Thread Executing 0x0a010005 priority=4
-==> 16: # GOAL: want 0x0a010004, 0x0a010005, 0x0a010002,0x0a010001
-==> 17: # GOAL:   as heir and executings on CPUs 0-3 respectively
-==> 18: cpus
+==> 18: task_priority smp5 3
+  CPU 0: Thread Heir 0x0a010005 priority=3
+  CPU 0: Thread Executing 0x0a010005 priority=3
+Task (0x0a010005) Change Priority from 4 to 3
+==> 19:  
+==> 20: # GOAL: want 0x0a010005, 0x0a010003, 0x0a010002,0x0a010001
+==> 21: # GOAL:   as heir and executings on CPUs 0-3 respectively
+==> 22: cpus smp5 smp3 smp2 smp1
 === CPU Status
           EXECUTING      /   HEIR             / SWITCH NEEDED
-  CPU 0: 0x0a010004 @  4 / 0x0a010004 @  4          false
-  CPU 1: 0x0a010005 @  4 / 0x0a010005 @  4          false
+  CPU 0: 0x0a010005 @  3 / 0x0a010005 @  3          false
+  CPU 1: 0x0a010003 @  4 / 0x0a010003 @  4          false
   CPU 2: 0x0a010002 @  4 / 0x0a010002 @  4          false
   CPU 3: 0x0a010001 @  4 / 0x0a010001 @  4          false
 === End of Ready Set of Threads
-==> 19: 
-==> 20: task_set_affinity smp2 0x01
-Task (0x0a010002) Set affinity=0x00000001
-  CPU 0: Thread Heir 0x0a010002 priority=4
-  CPU 0: Thread Executing 0x0a010002 priority=4
-  CPU 2: Thread Heir 0x0a010003 priority=4
-  CPU 2: Thread Executing 0x0a010003 priority=4
-===> 21: # GOAL: want 0x0a010002, 0x0a010005, 0x0a010003,0x0a010001
-==> 22: # GOAL:   as heir and executings on CPUs 0-3 respectively
-==> 23: cpus
+==> 23: 
+==> 24: task_set_affinity smp4 0x01
+Task (0x0a010004) Set affinity=0x00000001
+==> 25: # GOAL: want 0x0a010002, 0x0a010005, 0x0a010003,0x0a010001
+==> 26: # GOAL:   as heir and executings on CPUs 0-3 respectively
+==> 27: cpus smp5 smp3 smp2 smp1
 === CPU Status
           EXECUTING      /   HEIR             / SWITCH NEEDED
-  CPU 0: 0x0a010002 @  4 / 0x0a010002 @  4          false
-  CPU 1: 0x0a010005 @  4 / 0x0a010005 @  4          false
-  CPU 2: 0x0a010003 @  4 / 0x0a010003 @  4          false
+  CPU 0: 0x0a010005 @  3 / 0x0a010005 @  3          false
+  CPU 1: 0x0a010003 @  4 / 0x0a010003 @  4          false
+  CPU 2: 0x0a010002 @  4 / 0x0a010002 @  4          false
   CPU 3: 0x0a010001 @  4 / 0x0a010001 @  4          false
 === End of Ready Set of Threads
diff --git a/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_affinity_case2.scen b/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_affinity_migrate_case1.scen
similarity index 57%
rename from schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_affinity_case2.scen
rename to schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_affinity_migrate_case1.scen
index 6150daa..c7c4e2a 100644
--- a/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_affinity_case2.scen
+++ b/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_affinity_migrate_case1.scen
@@ -1,5 +1,7 @@
 #
-#  
+# Create 5 tasks of the same priority.  Then
+# change the affinity and the priority of the
+# task that is on the ready queue. 
 #
 rtems_init 4
 task_create smp1 4 
@@ -10,14 +12,16 @@ task_create smp5 4
 
 # GOAL: want 0x0a010004 - 0x0a010001 as heir and executings
 # GOAL:   on CPUs 0 -3 respectively
-cpus
+cpus smp4 smp3 smp2 smp1
 
 task_set_affinity smp5 0x03
-# GOAL: want 0x0a010004, 0x0a010005, 0x0a010002,0x0a010001
+task_priority smp5 3
+ 
+# GOAL: want 0x0a010005, 0x0a010003, 0x0a010002,0x0a010001
 # GOAL:   as heir and executings on CPUs 0-3 respectively
-cpus
+cpus smp5 smp3 smp2 smp1
 
-task_set_affinity smp2 0x01
+task_set_affinity smp4 0x01
 # GOAL: want 0x0a010002, 0x0a010005, 0x0a010003,0x0a010001
 # GOAL:   as heir and executings on CPUs 0-3 respectively
-cpus
+cpus smp5 smp3 smp2 smp1
diff --git a/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_affinity_migrate_case2.expected b/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_affinity_migrate_case2.expected
new file mode 100644
index 0000000..467fa6e
--- /dev/null
+++ b/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_affinity_migrate_case2.expected
@@ -0,0 +1,78 @@
+Script File               : scenarios/cpus4_affinity_migrate_case2.scen
+verbose                   : 1
+==> 1: #
+==> 2: #  Create threads of single cpu affinity to fill the
+==> 3: #  cpus.  Have a single of the same priority on the
+==> 4: #  ready chain that can run on any cpu.  Change the
+==> 5: #  affinity of one of the running threads forcing it
+==> 6: #  to move to the ready chain and quit running. 
+==> 7: #
+==> 8: rtems_init 4
+  CPU 0: Thread Heir 0x09010001 priority=255
+  CPU 0: Thread Executing 0x09010001 priority=255
+  CPU 1: Thread Heir 0x09010002 priority=255
+  CPU 1: Thread Executing 0x09010002 priority=255
+  CPU 2: Thread Heir 0x09010003 priority=255
+  CPU 2: Thread Executing 0x09010003 priority=255
+  CPU 3: Thread Heir 0x09010004 priority=255
+  CPU 3: Thread Executing 0x09010004 priority=255
+==> 9: task_create smp1 4 -a 0x2 
+Creating task with:  Preemption: yes Timeslicing: no
+Task (smp1) created: id=0x0a010001, priority=4
+Task (0x0a010001) Set affinity=0x00000002
+Task (smp1) starting: id=0x0a010001, priority=4
+  CPU 1: Thread Heir 0x0a010001 priority=4
+  CPU 1: Thread Executing 0x0a010001 priority=4
+==> 10: task_create smp2 4 -a 0x1
+Creating task with:  Preemption: yes Timeslicing: no
+Task (smp2) created: id=0x0a010002, priority=4
+Task (0x0a010002) Set affinity=0x00000001
+Task (smp2) starting: id=0x0a010002, priority=4
+  CPU 0: Thread Heir 0x0a010002 priority=4
+  CPU 0: Thread Executing 0x0a010002 priority=4
+==> 11: task_create smp3 4 -a 0x8
+Creating task with:  Preemption: yes Timeslicing: no
+Task (smp3) created: id=0x0a010003, priority=4
+Task (0x0a010003) Set affinity=0x00000008
+Task (smp3) starting: id=0x0a010003, priority=4
+  CPU 3: Thread Heir 0x0a010003 priority=4
+  CPU 3: Thread Executing 0x0a010003 priority=4
+==> 12: task_create smp4 4 -a 0x4
+Creating task with:  Preemption: yes Timeslicing: no
+Task (smp4) created: id=0x0a010004, priority=4
+Task (0x0a010004) Set affinity=0x00000004
+Task (smp4) starting: id=0x0a010004, priority=4
+  CPU 2: Thread Heir 0x0a010004 priority=4
+  CPU 2: Thread Executing 0x0a010004 priority=4
+==> 13: task_create smp5 4
+Creating task with:  Preemption: yes Timeslicing: no
+Task (smp5) created: id=0x0a010005, priority=4
+Task (smp5) starting: id=0x0a010005, priority=4
+==> 14: 
+==> 15: # GOAL: want 0x0a010002, 0x0a010001, 0x0a010004, 0x0a010003
+==> 16: # GOAL:   as heir and executings on CPUs 0-3 respectively
+==> 17: cpus smp2 smp1 smp4 smp3
+=== CPU Status
+          EXECUTING      /   HEIR             / SWITCH NEEDED
+  CPU 0: 0x0a010002 @  4 / 0x0a010002 @  4          false
+  CPU 1: 0x0a010001 @  4 / 0x0a010001 @  4          false
+  CPU 2: 0x0a010004 @  4 / 0x0a010004 @  4          false
+  CPU 3: 0x0a010003 @  4 / 0x0a010003 @  4          false
+=== End of Ready Set of Threads
+==> 18: 
+==> 19: 
+==> 20: task_set_affinity smp1 0x0e
+  CPU 1: Thread Heir 0x0a010005 priority=4
+  CPU 1: Thread Executing 0x0a010005 priority=4
+Task (0x0a010001) Set affinity=0x0000000e
+==> 21: # GOAL: want 0x0a010002, 0x0a010005, 0x0a010004, 0x0a010003
+==> 22: # GOAL:   as heir and executings on CPUs 0-3 respectively
+==> 23: cpus smp2 smp5 smp4 smp3
+=== CPU Status
+          EXECUTING      /   HEIR             / SWITCH NEEDED
+  CPU 0: 0x0a010002 @  4 / 0x0a010002 @  4          false
+  CPU 1: 0x0a010005 @  4 / 0x0a010005 @  4          false
+  CPU 2: 0x0a010004 @  4 / 0x0a010004 @  4          false
+  CPU 3: 0x0a010003 @  4 / 0x0a010003 @  4          false
+=== End of Ready Set of Threads
+==> 24: 
diff --git a/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_affinity_migrate_case2.scen b/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_affinity_migrate_case2.scen
new file mode 100644
index 0000000..e01159c
--- /dev/null
+++ b/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_affinity_migrate_case2.scen
@@ -0,0 +1,24 @@
+#
+#  Create threads of single cpu affinity to fill the
+#  cpus.  Have a single of the same priority on the
+#  ready chain that can run on any cpu.  Change the
+#  affinity of one of the running threads forcing it
+#  to move to the ready chain and quit running. 
+#
+rtems_init 4
+task_create smp1 4 -a 0x2 
+task_create smp2 4 -a 0x1
+task_create smp3 4 -a 0x8
+task_create smp4 4 -a 0x4
+task_create smp5 4
+
+# GOAL: want 0x0a010002, 0x0a010001, 0x0a010004, 0x0a010003
+# GOAL:   as heir and executings on CPUs 0-3 respectively
+cpus smp2 smp1 smp4 smp3
+
+
+task_set_affinity smp1 0x0e
+# GOAL: want 0x0a010002, 0x0a010005, 0x0a010004, 0x0a010003
+# GOAL:   as heir and executings on CPUs 0-3 respectively
+cpus smp2 smp5 smp4 smp3
+
diff --git a/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_affinity_case1.expected b/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_affinity_overlap_case1.expected
similarity index 50%
rename from schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_affinity_case1.expected
rename to schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_affinity_overlap_case1.expected
index 8aae39b..c6f76e4 100644
--- a/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_affinity_case1.expected
+++ b/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_affinity_overlap_case1.expected
@@ -1,9 +1,11 @@
-Script File               : scenarios/cpus4_affinity_case1.scen
+Script File               : scenarios/cpus4_affinity_overlap_case1.scen
 verbose                   : 1
 ==> 1: #
-==> 2: #  
-==> 3: #
-==> 4: rtems_init 4
+==> 2: # Create 2 sets of threads one that can run on cpus
+==> 3: # {0,1} the others can run on cpus {1,2,3}.  Then
+==> 4: # swap the affinity of the two sets
+==> 5: #
+==> 6: rtems_init 4
   CPU 0: Thread Heir 0x09010001 priority=255
   CPU 0: Thread Executing 0x09010001 priority=255
   CPU 1: Thread Heir 0x09010002 priority=255
@@ -12,38 +14,40 @@ verbose                   : 1
   CPU 2: Thread Executing 0x09010003 priority=255
   CPU 3: Thread Heir 0x09010004 priority=255
   CPU 3: Thread Executing 0x09010004 priority=255
-==> 5: task_create smp1 4 -a 14
+==> 7: task_create smp1 4 -a 0x0e
 Creating task with:  Preemption: yes Timeslicing: no
 Task (smp1) created: id=0x0a010001, priority=4
 Task (0x0a010001) Set affinity=0x0000000e
 Task (smp1) starting: id=0x0a010001, priority=4
   CPU 3: Thread Heir 0x0a010001 priority=4
   CPU 3: Thread Executing 0x0a010001 priority=4
-==> 6: task_create smp2 4 -a 14
+==> 8: task_create smp2 4 -a 0x0e
 Creating task with:  Preemption: yes Timeslicing: no
 Task (smp2) created: id=0x0a010002, priority=4
 Task (0x0a010002) Set affinity=0x0000000e
 Task (smp2) starting: id=0x0a010002, priority=4
   CPU 2: Thread Heir 0x0a010002 priority=4
   CPU 2: Thread Executing 0x0a010002 priority=4
-==> 7: task_create smp3 4 -a  3
+==> 9: task_create smp3 4 -a 0x03
 Creating task with:  Preemption: yes Timeslicing: no
 Task (smp3) created: id=0x0a010003, priority=4
 Task (0x0a010003) Set affinity=0x00000003
 Task (smp3) starting: id=0x0a010003, priority=4
   CPU 1: Thread Heir 0x0a010003 priority=4
   CPU 1: Thread Executing 0x0a010003 priority=4
-==> 8: task_create smp4 4 -a  3
+==> 10: task_create smp4 4 -a 0x03
 Creating task with:  Preemption: yes Timeslicing: no
 Task (smp4) created: id=0x0a010004, priority=4
 Task (0x0a010004) Set affinity=0x00000003
 Task (smp4) starting: id=0x0a010004, priority=4
   CPU 0: Thread Heir 0x0a010004 priority=4
   CPU 0: Thread Executing 0x0a010004 priority=4
-==> 9: 
-==> 10: # GOAL: want 0x0a010004 - 0x0a010001 as heir and executings
-==> 11: # GOAL:   on CPUs 0 -3 respectively
-==> 12: cpus
+==> 11: 
+==> 12: # EXECUTING: {smp1 smp2 smp3 smp4}
+==> 13: # READY:     {IDLE IDLE IDLE IDLE}
+==> 14: # GOAL: want 0x0a010004 - 0x0a010001 as heir and executings
+==> 15: # GOAL:   on CPUs 0 -3 respectively
+==> 16: cpus smp4 smp3 smp2 smp1
 === CPU Status
           EXECUTING      /   HEIR             / SWITCH NEEDED
   CPU 0: 0x0a010004 @  4 / 0x0a010004 @  4          false
@@ -51,63 +55,75 @@ Task (smp4) starting: id=0x0a010004, priority=4
   CPU 2: 0x0a010002 @  4 / 0x0a010002 @  4          false
   CPU 3: 0x0a010001 @  4 / 0x0a010001 @  4          false
 === End of Ready Set of Threads
-==> 13: 
-==> 14: task_set_affinity smp1 0x03
+==> 17: 
+==> 18: task_set_affinity smp1 0x03
+  CPU 3: Thread Heir 0x09010001 priority=255
+  CPU 3: Thread Executing 0x09010001 priority=255
 Task (0x0a010001) Set affinity=0x00000003
-  CPU 1: Thread Heir 0x0a010001 priority=4
-  CPU 1: Thread Executing 0x0a010001 priority=4
-==> 15: # GOAL: want 0x0a010004, 0x0a010001, 0x0a010002,0x09010001
-==> 16: # GOAL:   as heir and executings on CPUs 0-3 respectively
-==> 17: cpus
+==> 19: # EXECUTING: {smp2 smp3 smp4 IDLE}
+==> 20: # READY:     {smp1 IDLE IDLE IDLE}
+==> 21: # GOAL: want 0x0a010004, 0x0a010003, 0x0a010002,0x09010001
+==> 22: # GOAL:   as heir and executings on CPUs 0-3 respectively
+==> 23: cpus smp4 smp3 smp2 IDLE
 === CPU Status
           EXECUTING      /   HEIR             / SWITCH NEEDED
   CPU 0: 0x0a010004 @  4 / 0x0a010004 @  4          false
-  CPU 1: 0x0a010001 @  4 / 0x0a010001 @  4          false
+  CPU 1: 0x0a010003 @  4 / 0x0a010003 @  4          false
   CPU 2: 0x0a010002 @  4 / 0x0a010002 @  4          false
-  CPU 3: 0x09010001 @  4 / 0x09010001 @  4          false
+  CPU 3: 0x09010001 @255 / 0x09010001 @255          false
 === End of Ready Set of Threads
-==> 18: 
-==> 19: task_set_affinity smp2 0x03
+==> 24: 
+==> 25: task_set_affinity smp2 0x03
+  CPU 2: Thread Heir 0x09010002 priority=255
+  CPU 2: Thread Executing 0x09010002 priority=255
 Task (0x0a010002) Set affinity=0x00000003
-  CPU 1: Thread Heir 0x0a010002 priority=4
-  CPU 1: Thread Executing 0x0a010002 priority=4
-==> 20: # GOAL: want 0x0a010004, 0x0a010002, 0x00910002,0x09010001
-==> 21: # GOAL:   as heir and executings on CPUs 0-3 respectively
-==> 22: cpus
+==> 26: # EXECUTING: {smp3 smp4 IDLE IDLE}
+==> 27: # READY:     {smp1 smp2 IDLE IDLE}
+==> 28: # GOAL: want 0x0a010004, 0x0a010003, 0x00910002,0x09010001
+==> 29: # GOAL:   as heir and executings on CPUs 0-3 respectively
+==> 30: cpus smp4 smp3 IDLE IDLE
 === CPU Status
           EXECUTING      /   HEIR             / SWITCH NEEDED
   CPU 0: 0x0a010004 @  4 / 0x0a010004 @  4          false
-  CPU 1: 0x0a010002 @  4 / 0x0a010002 @  4          false
-  CPU 2: 0x09010002 @  4 / 0x09010002 @  4          false
-  CPU 3: 0x09010001 @  4 / 0x09010001 @  4          false
+  CPU 1: 0x0a010003 @  4 / 0x0a010003 @  4          false
+  CPU 2: 0x09010002 @255 / 0x09010002 @255          false
+  CPU 3: 0x09010001 @255 / 0x09010001 @255          false
 === End of Ready Set of Threads
-==> 23: 
-==> 24: task_set_affinity smp3 0x0e
+==> 31: 
+==> 32: task_set_affinity smp3 0x0e
+  CPU 1: Thread Heir 0x0a010002 priority=4
+  CPU 1: Thread Executing 0x0a010002 priority=4
+  CPU 2: Thread Heir 0x0a010003 priority=4
+  CPU 2: Thread Executing 0x0a010003 priority=4
 Task (0x0a010003) Set affinity=0x0000000e
-  CPU 3: Thread Heir 0x0a010003 priority=4
-  CPU 3: Thread Executing 0x0a010003 priority=4
-==> 25: # GOAL: want 0x0a010004, 0x0a010002, 0x09010002,0x0a010003
-==> 26: # GOAL:   as heir and executings on CPUs 0-3 respectively
-==> 27: cpus
+==> 33: # EXECUTING: {smp4 smp2 smp3 IDLE}
+==> 34: # READY:     {smp1 smp2 IDLE IDLE}
+==> 35: # GOAL: want 0x0a010004, 0x0a010002, 0x0a010003,0x09010001
+==> 36: # GOAL:   as heir and executings on CPUs 0-3 respectively
+==> 37: cpus smp4 smp2 smp3 IDLE
 === CPU Status
           EXECUTING      /   HEIR             / SWITCH NEEDED
   CPU 0: 0x0a010004 @  4 / 0x0a010004 @  4          false
   CPU 1: 0x0a010002 @  4 / 0x0a010002 @  4          false
-  CPU 2: 0x09010002 @  4 / 0x09010002 @  4          false
-  CPU 3: 0x0a010003 @  4 / 0x0a010003 @  4          false
+  CPU 2: 0x0a010003 @  4 / 0x0a010003 @  4          false
+  CPU 3: 0x09010001 @255 / 0x09010001 @255          false
 === End of Ready Set of Threads
-==> 28: 
-==> 29: task_set_affinity smp4 0x0e
+==> 38: 
+==> 39: task_set_affinity smp4 0x0e
+  CPU 0: Thread Heir 0x0a010001 priority=4
+  CPU 0: Thread Executing 0x0a010001 priority=4
+  CPU 3: Thread Heir 0x0a010004 priority=4
+  CPU 3: Thread Executing 0x0a010004 priority=4
 Task (0x0a010004) Set affinity=0x0000000e
-  CPU 2: Thread Heir 0x0a010004 priority=4
-  CPU 2: Thread Executing 0x0a010004 priority=4
-==> 30: # GOAL: want 0x0a010004, 0x0a010002, 0x0a010004,0x0a010003
-==> 31: # GOAL:   as heir and executings on CPUs 0-3 respectively
-==> 32: cpus
+==> 40: # EXECUTING: {smp4 smp2 smp3 smp1}
+==> 41: # READY:     {IDLE IDLE IDLE IDLE}
+==> 42: # GOAL: want 0x0a010001, 0x0a010002, 0x0a010003,0x0a010004
+==> 43: # GOAL:   as heir and executings on CPUs 0-3 respectively
+==> 44: cpus smp1 smp2 smp3 smp4
 === CPU Status
           EXECUTING      /   HEIR             / SWITCH NEEDED
-  CPU 0: 0x0a010004 @  4 / 0x0a010004 @  4          false
+  CPU 0: 0x0a010001 @  4 / 0x0a010001 @  4          false
   CPU 1: 0x0a010002 @  4 / 0x0a010002 @  4          false
-  CPU 2: 0x0a010004 @  4 / 0x0a010004 @  4          false
-  CPU 3: 0x0a010003 @  4 / 0x0a010003 @  4          false
+  CPU 2: 0x0a010003 @  4 / 0x0a010003 @  4          false
+  CPU 3: 0x0a010004 @  4 / 0x0a010004 @  4          false
 === End of Ready Set of Threads
diff --git a/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_affinity_case1.scen b/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_affinity_overlap_case1.scen
similarity index 90%
rename from schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_affinity_case1.scen
rename to schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_affinity_overlap_case1.scen
index 5f32400..d6f0505 100644
--- a/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_affinity_case1.scen
+++ b/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_affinity_overlap_case1.scen
@@ -1,5 +1,7 @@
 #
-#  
+# Create 2 sets of threads one that can run on cpus
+# {0,1} the others can run on cpus {1,2,3}.  Then
+# swap the affinity of the two sets
 #
 rtems_init 4
 task_create smp1 4 -a 0x0e
diff --git a/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_priority_case1.expected b/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_affinity_priority_case1.expected
similarity index 84%
rename from schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_priority_case1.expected
rename to schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_affinity_priority_case1.expected
index c43cdda..0cd6706 100644
--- a/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_priority_case1.expected
+++ b/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_affinity_priority_case1.expected
@@ -1,4 +1,4 @@
-Script File               : scenarios/cpus4_priority_case1.scen
+Script File               : scenarios/cpus4_affinity_priority_case1.scen
 verbose                   : 1
 ==> 1: #
 ==> 2: #  Ensure lowest priority is preempted
@@ -43,7 +43,7 @@ Task (smp5) starting: id=0x0a010005, priority=9
 ==> 10: 
 ==> 11: # GOAL: want 0x0a010001 - 0x0a010004 as heir and executings
 ==> 12: # GOAL:   on CPUs 3-0 respectively
-==> 13: cpus
+==> 13: cpus smp4 smp3 smp2 smp1
 === CPU Status
           EXECUTING      /   HEIR             / SWITCH NEEDED
   CPU 0: 0x0a010004 @  6 / 0x0a010004 @  6          false
@@ -57,7 +57,8 @@ Task (smp5) starting: id=0x0a010005, priority=9
 Task (0x0a010005) Set affinity=0x00000001
 ==> 17: # GOAL: want 0x0a010001 - 0x0a010004 as heir and executings
 ==> 18: # GOAL:   on CPUs 3-0 respectively
-==> 19: cpus
+==> 19: # PRI: 6    5    8   7
+==> 20: cpus smp4 smp3 smp2 smp1
 === CPU Status
           EXECUTING      /   HEIR             / SWITCH NEEDED
   CPU 0: 0x0a010004 @  6 / 0x0a010004 @  6          false
@@ -65,14 +66,17 @@ Task (0x0a010005) Set affinity=0x00000001
   CPU 2: 0x0a010002 @  8 / 0x0a010002 @  8          false
   CPU 3: 0x0a010001 @  7 / 0x0a010001 @  7          false
 === End of Ready Set of Threads
-==> 20: 
-==> 21: task_priority smp5 5
-  CPU 2: Thread Heir 0x0a010005 priority=5
-  CPU 2: Thread Executing 0x0a010005 priority=5
+==> 21: 
+==> 22: task_priority smp5 5
+  CPU 0: Thread Heir 0x0a010005 priority=5
+  CPU 0: Thread Executing 0x0a010005 priority=5
+  CPU 2: Thread Heir 0x0a010004 priority=6
+  CPU 2: Thread Executing 0x0a010004 priority=6
 Task (0x0a010005) Change Priority from 9 to 5
-==> 22: # GOAL: want 0x0a010005, 0x0a010003, 0x0a010004, 0x0a010001
-==> 23: # GOAL:   to be heir AND executing on CPU 0-3 respectively
-==> 24: cpus
+==> 23: # GOAL: want 0x0a010005, 0x0a010003, 0x0a010004, 0x0a010001
+==> 24: # GOAL:   to be heir AND executing on CPU 0-3 respectively
+==> 25: # PRI: 5    5    6   7
+==> 26: cpus smp5 smp3 smp4 smp1
 === CPU Status
           EXECUTING      /   HEIR             / SWITCH NEEDED
   CPU 0: 0x0a010005 @  5 / 0x0a010005 @  5          false
diff --git a/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_priority_case1.scen b/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_affinity_priority_case1.scen
similarity index 82%
rename from schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_priority_case1.scen
rename to schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_affinity_priority_case1.scen
index e7bfb1e..a6fecc1 100644
--- a/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_priority_case1.scen
+++ b/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_affinity_priority_case1.scen
@@ -10,15 +10,17 @@ task_create smp5 9
 
 # GOAL: want 0x0a010001 - 0x0a010004 as heir and executings
 # GOAL:   on CPUs 3-0 respectively
-cpus
+cpus smp4 smp3 smp2 smp1
 
 # Tasks are created and distributed across CPUs
 task_set_affinity smp5 0x01
 # GOAL: want 0x0a010001 - 0x0a010004 as heir and executings
 # GOAL:   on CPUs 3-0 respectively
-cpus
+# PRI: 6    5    8   7
+cpus smp4 smp3 smp2 smp1
 
 task_priority smp5 5
 # GOAL: want 0x0a010005, 0x0a010003, 0x0a010004, 0x0a010001
 # GOAL:   to be heir AND executing on CPU 0-3 respectively
-cpus
+# PRI: 5    5    6   7
+cpus smp5 smp3 smp4 smp1
diff --git a/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_priority_case2.expected b/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_affinity_priority_case2.expected
similarity index 95%
rename from schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_priority_case2.expected
rename to schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_affinity_priority_case2.expected
index 958960f..add30ab 100644
--- a/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_priority_case2.expected
+++ b/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_affinity_priority_case2.expected
@@ -1,4 +1,4 @@
-Script File               : scenarios/cpus4_priority_case2.scen
+Script File               : scenarios/cpus4_affinity_priority_case2.scen
 verbose                   : 1
 ==> 1: #
 ==> 2: #  Ensure lowest priority is preempted
@@ -42,7 +42,7 @@ Task (smp5) created: id=0x0a010005, priority=9
 Task (smp5) starting: id=0x0a010005, priority=9
 ==> 10: # GOAL: want 0x0a010001 - 0x0a010004 as heir and executings
 ==> 11: # GOAL:   on CPUs 3-0 respectively
-==> 12: cpus
+==> 12: cpus smp4 smp3 smp2 smp1
 === CPU Status
           EXECUTING      /   HEIR             / SWITCH NEEDED
   CPU 0: 0x0a010004 @  6 / 0x0a010004 @  6          false
@@ -56,7 +56,7 @@ Task (smp5) starting: id=0x0a010005, priority=9
 Task (0x0a010005) Set affinity=0x00000002
 ==> 16: # GOAL: want 0x0a010001 - 0x0a010004 as heir and executings
 ==> 17: # GOAL:   on CPUs 3-0 respectively
-==> 18: cpus
+==> 18: cpus smp4 smp3 smp2 smp1
 === CPU Status
           EXECUTING      /   HEIR             / SWITCH NEEDED
   CPU 0: 0x0a010004 @  6 / 0x0a010004 @  6          false
@@ -69,7 +69,7 @@ Task (0x0a010005) Set affinity=0x00000002
 Task (0x0a010005) Change Priority from 9 to 6
 ==> 21: # GOAL: want 0x0a010001 - 0x0a010004 as heir and executings
 ==> 22: # GOAL:   on CPUs 3-0 respectively
-==> 23: cpus
+==> 23: cpus smp4 smp3 smp2 smp1
 === CPU Status
           EXECUTING      /   HEIR             / SWITCH NEEDED
   CPU 0: 0x0a010004 @  6 / 0x0a010004 @  6          false
diff --git a/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_priority_case2.scen b/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_affinity_priority_case2.scen
similarity index 87%
rename from schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_priority_case2.scen
rename to schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_affinity_priority_case2.scen
index e4fb0c7..21d4528 100644
--- a/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_priority_case2.scen
+++ b/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_affinity_priority_case2.scen
@@ -9,15 +9,15 @@ task_create smp4 6
 task_create smp5 9 
 # GOAL: want 0x0a010001 - 0x0a010004 as heir and executings
 # GOAL:   on CPUs 3-0 respectively
-cpus
+cpus smp4 smp3 smp2 smp1
 
 # Tasks are created and distributed across CPUs
 task_set_affinity smp5 0x02
 # GOAL: want 0x0a010001 - 0x0a010004 as heir and executings
 # GOAL:   on CPUs 3-0 respectively
-cpus
+cpus smp4 smp3 smp2 smp1
 
 task_priority smp5 6
 # GOAL: want 0x0a010001 - 0x0a010004 as heir and executings
 # GOAL:   on CPUs 3-0 respectively
-cpus
+cpus smp4 smp3 smp2 smp1
diff --git a/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_affinity_priority_case3.expected b/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_affinity_priority_case3.expected
new file mode 100644
index 0000000..a9e24c6
--- /dev/null
+++ b/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_affinity_priority_case3.expected
@@ -0,0 +1,85 @@
+Script File               : scenarios/cpus4_affinity_priority_case3.scen
+verbose                   : 1
+==> 1: #
+==> 2: #  Exercise priority and affinity.
+==> 3: #  priorities such that finding an heir requires scanning the
+==> 4: #  ready set of threads.
+==> 5: #
+==> 6: rtems_init 4
+  CPU 0: Thread Heir 0x09010001 priority=255
+  CPU 0: Thread Executing 0x09010001 priority=255
+  CPU 1: Thread Heir 0x09010002 priority=255
+  CPU 1: Thread Executing 0x09010002 priority=255
+  CPU 2: Thread Heir 0x09010003 priority=255
+  CPU 2: Thread Executing 0x09010003 priority=255
+  CPU 3: Thread Heir 0x09010004 priority=255
+  CPU 3: Thread Executing 0x09010004 priority=255
+==> 7: task_create smp1 10
+Creating task with:  Preemption: yes Timeslicing: no
+Task (smp1) created: id=0x0a010001, priority=10
+Task (smp1) starting: id=0x0a010001, priority=10
+  CPU 3: Thread Heir 0x0a010001 priority=10
+  CPU 3: Thread Executing 0x0a010001 priority=10
+==> 8: task_create smp2 10
+Creating task with:  Preemption: yes Timeslicing: no
+Task (smp2) created: id=0x0a010002, priority=10
+Task (smp2) starting: id=0x0a010002, priority=10
+  CPU 2: Thread Heir 0x0a010002 priority=10
+  CPU 2: Thread Executing 0x0a010002 priority=10
+==> 9: task_create smp3 10
+Creating task with:  Preemption: yes Timeslicing: no
+Task (smp3) created: id=0x0a010003, priority=10
+Task (smp3) starting: id=0x0a010003, priority=10
+  CPU 1: Thread Heir 0x0a010003 priority=10
+  CPU 1: Thread Executing 0x0a010003 priority=10
+==> 10: task_create smp4 12
+Creating task with:  Preemption: yes Timeslicing: no
+Task (smp4) created: id=0x0a010004, priority=12
+Task (smp4) starting: id=0x0a010004, priority=12
+  CPU 0: Thread Heir 0x0a010004 priority=12
+  CPU 0: Thread Executing 0x0a010004 priority=12
+==> 11: task_create smp5 10
+Creating task with:  Preemption: yes Timeslicing: no
+Task (smp5) created: id=0x0a010005, priority=10
+Task (smp5) starting: id=0x0a010005, priority=10
+  CPU 0: Thread Heir 0x0a010005 priority=10
+  CPU 0: Thread Executing 0x0a010005 priority=10
+==> 12: # GOAL: Cores 0-3 should be 0x0a01000[5321] respectively
+==> 13: cpus smp5 smp3 smp2 smp1
+=== CPU Status
+          EXECUTING      /   HEIR             / SWITCH NEEDED
+  CPU 0: 0x0a010005 @ 10 / 0x0a010005 @ 10          false
+  CPU 1: 0x0a010003 @ 10 / 0x0a010003 @ 10          false
+  CPU 2: 0x0a010002 @ 10 / 0x0a010002 @ 10          false
+  CPU 3: 0x0a010001 @ 10 / 0x0a010001 @ 10          false
+=== End of Ready Set of Threads
+==> 14: 
+==> 15: # GOAL: No change - pri is too low to run 
+==> 16: task_create pri1 -a 0x2 11
+Creating task with:  Preemption: yes Timeslicing: no
+Task (pri1) created: id=0x0a010006, priority=11
+Task (0x0a010006) Set affinity=0x00000002
+Task (pri1) starting: id=0x0a010006, priority=11
+==> 17: cpus smp5 smp3 smp2 smp1
+=== CPU Status
+          EXECUTING      /   HEIR             / SWITCH NEEDED
+  CPU 0: 0x0a010005 @ 10 / 0x0a010005 @ 10          false
+  CPU 1: 0x0a010003 @ 10 / 0x0a010003 @ 10          false
+  CPU 2: 0x0a010002 @ 10 / 0x0a010002 @ 10          false
+  CPU 3: 0x0a010001 @ 10 / 0x0a010001 @ 10          false
+=== End of Ready Set of Threads
+==> 18: 
+==> 19: # GOAL: pri1 should preempt smp3 on core 1
+==> 20: # GOAL: Cores 0-3 should be 0x0a01000[5621] respectively
+==> 21: task_priority pri1 9
+  CPU 1: Thread Heir 0x0a010006 priority=9
+  CPU 1: Thread Executing 0x0a010006 priority=9
+Task (0x0a010006) Change Priority from 11 to 9
+==> 22: cpus smp5 pri1 smp2 smp1
+=== CPU Status
+          EXECUTING      /   HEIR             / SWITCH NEEDED
+  CPU 0: 0x0a010005 @ 10 / 0x0a010005 @ 10          false
+  CPU 1: 0x0a010006 @  9 / 0x0a010006 @  9          false
+  CPU 2: 0x0a010002 @ 10 / 0x0a010002 @ 10          false
+  CPU 3: 0x0a010001 @ 10 / 0x0a010001 @ 10          false
+=== End of Ready Set of Threads
diff --git a/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_affinity_priority_case3.scen b/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_affinity_priority_case3.scen
new file mode 100644
index 0000000..27a42ff
--- /dev/null
+++ b/schedsim/shell/schedsim_smppriority_affinity/scenarios/cpus4_affinity_priority_case3.scen
@@ -0,0 +1,22 @@
+#
+#  Exercise priority and affinity.
+#  priorities such that finding an heir requires scanning the
+#  ready set of threads.
+#
+rtems_init 4
+task_create smp1 10
+task_create smp2 10
+task_create smp3 10
+task_create smp4 12
+task_create smp5 10
+# GOAL: Cores 0-3 should be 0x0a01000[5321] respectively
+cpus smp5 smp3 smp2 smp1
+
+# GOAL: No change - pri is too low to run 
+task_create pri1 -a 0x2 11
+cpus smp5 smp3 smp2 smp1
+
+# GOAL: pri1 should preempt smp3 on core 1
+# GOAL: Cores 0-3 should be 0x0a01000[5621] respectively
+task_priority pri1 9
+cpus smp5 pri1 smp2 smp1




More information about the vc mailing list