<div dir="ltr">Hi,<div><br></div><div>The Strong APA scheduler (<a href="https://lists.rtems.org/pipermail/devel/2020-August/061662.html">https://lists.rtems.org/pipermail/devel/2020-August/061662.html</a>) passes this test as well. This test is again based on the example from page 6 of the <a href="https://people.mpi-sws.org/~bbb/papers/pdf/rtss14f.pdf">paper</a>. This test does not exactly work like the example in the paper does, but I need your help in figuring out how to make tasks that have a WCET (i.e. that they die out in some time, using a timer) to make something like that.</div><div><br></div><div>Thanks,</div><div>Richi.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Aug 29, 2020 at 3:23 PM Richi Dubey <<a href="mailto:richidubey@gmail.com">richidubey@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">---<br>
 testsuites/smptests/smpstrongapa01/init.c | 72 ++++++++++++++---------<br>
 1 file changed, 43 insertions(+), 29 deletions(-)<br>
<br>
diff --git a/testsuites/smptests/smpstrongapa01/init.c b/testsuites/smptests/smpstrongapa01/init.c<br>
index bf8bc05231..0daa768b48 100644<br>
--- a/testsuites/smptests/smpstrongapa01/init.c<br>
+++ b/testsuites/smptests/smpstrongapa01/init.c<br>
@@ -1,4 +1,5 @@<br>
 /*<br>
+ * Copyright (c) 2020 Richi Dubey ( <a href="mailto:richidubey@gmail.com" target="_blank">richidubey@gmail.com</a> )<br>
  * Copyright (c) 2016, 2017 embedded brains GmbH.  All rights reserved.<br>
  *<br>
  *  embedded brains GmbH<br>
@@ -16,23 +17,28 @@<br>
 #include "config.h"<br>
 #endif<br>
<br>
-#include "tmacros.h"<br>
+#include <tmacros.h><br>
<br>
 #include <rtems.h><br>
<br>
 const char rtems_test_name[] = "SMPSTRONGAPA 1";<br>
<br>
-#define CPU_COUNT 4<br>
+#define CPU_COUNT 2<br>
<br>
-#define TASK_COUNT (3 * CPU_COUNT)<br>
+#define TASK_COUNT 3<br>
<br>
 #define P(i) (UINT32_C(2) + i)<br>
<br>
 #define ALL ((UINT32_C(1) << CPU_COUNT) - 1)<br>
<br>
-#define IDLE UINT8_C(255)<br>
+#define A(cpu0, cpu1) ( (cpu1 << 1) | cpu0 )<br>
<br>
-#define NAME rtems_build_name('S', 'A', 'P', 'A')<br>
+typedef enum {<br>
+  T0,<br>
+  T1,<br>
+  T2,<br>
+  IDLE<br>
+} task_index;<br>
<br>
 typedef struct {<br>
   enum {<br>
@@ -43,7 +49,7 @@ typedef struct {<br>
     KIND_UNBLOCK<br>
   } kind;<br>
<br>
-  size_t index;<br>
+  task_index index;<br>
<br>
   struct {<br>
     rtems_task_priority priority;<br>
@@ -65,54 +71,59 @@ typedef struct {<br>
     KIND_RESET, \<br>
     0, \<br>
     { 0 }, \<br>
-    { IDLE, IDLE, IDLE, IDLE } \<br>
+    { IDLE, IDLE} \<br>
   }<br>
<br>
-#define SET_PRIORITY(index, prio, cpu0, cpu1, cpu2, cpu3) \<br>
+#define SET_PRIORITY(index, prio, cpu0, cpu1) \<br>
   { \<br>
     KIND_SET_PRIORITY, \<br>
     index, \<br>
     { .priority = prio }, \<br>
-    { cpu0, cpu1, cpu2, cpu3 } \<br>
+    { cpu0, cpu1} \<br>
   }<br>
<br>
-#define SET_AFFINITY(index, aff, cpu0, cpu1, cpu2, cpu3) \<br>
+#define SET_AFFINITY(index, aff, cpu0, cpu1) \<br>
   { \<br>
     KIND_SET_AFFINITY, \<br>
     index, \<br>
     { .cpu_set = aff }, \<br>
-    { cpu0, cpu1, cpu2, cpu3 } \<br>
+    { cpu0, cpu1 } \<br>
   }<br>
<br>
-#define BLOCK(index, cpu0, cpu1, cpu2, cpu3) \<br>
+#define BLOCK(index, cpu0, cpu1) \<br>
   { \<br>
     KIND_BLOCK, \<br>
     index, \<br>
     { 0 }, \<br>
-    { cpu0, cpu1, cpu2, cpu3 } \<br>
+    { cpu0, cpu1 } \<br>
   }<br>
<br>
-#define UNBLOCK(index, cpu0, cpu1, cpu2, cpu3) \<br>
+#define UNBLOCK(index, cpu0, cpu1) \<br>
   { \<br>
     KIND_UNBLOCK, \<br>
     index, \<br>
     { 0 }, \<br>
-    { cpu0, cpu1, cpu2, cpu3 } \<br>
+    { cpu0, cpu1} \<br>
   }<br>
<br>
 static const test_action test_actions[] = {<br>
   RESET,<br>
-  UNBLOCK(      0,           0, IDLE, IDLE, IDLE),<br>
-  UNBLOCK(      1,           0,    1, IDLE, IDLE),<br>
-  UNBLOCK(      2,           0,    1,    2, IDLE),<br>
-  UNBLOCK(      3,           0,    1,    2,    3),<br>
-  UNBLOCK(      5,           0,    1,    2,    3),<br>
-  SET_PRIORITY( 3,  P(4),    0,    1,    2,    3),<br>
-  SET_PRIORITY( 5,  P(3),    0,    1,    2,    5),<br>
-  BLOCK(        5,           0,    1,    2,    3),<br>
-  SET_AFFINITY( 5,   ALL,    0,    1,    2,    3),<br>
-  RESET,<br>
-  UNBLOCK(      0,           0, IDLE, IDLE, IDLE),<br>
+  UNBLOCK(      T0,            T0, IDLE),<br>
+  UNBLOCK(      T1,            T0,    T1),<br>
+  UNBLOCK(      T2,            T0,    T1),<br>
+  SET_PRIORITY( T0,  P(0),     T0,    T1),<br>
+  /*<br>
+   * Introduce Task 2 intially with lowest priority to imitate late arrival<br>
+   */<br>
+  SET_PRIORITY( T2,  P(4),     T0,    T1),  <br>
+  SET_PRIORITY( T1,  P(3),     T0,    T1),<br>
+  SET_AFFINITY( T0,   ALL,     T0,    T1),<br>
+  SET_AFFINITY( T1,   A(0, 1), T0,    T1),<br>
+  SET_AFFINITY( T2,   A(1, 0), T0,    T1),<br>
+  /*<br>
+   * Show that higher priority task gets dislodged from its processor<br>
+   */<br>
+  SET_PRIORITY( T2,   P(2),    T2,    T0),<br>
   RESET<br>
 };<br>
<br>
@@ -182,7 +193,7 @@ static void check_cpu_allocations(test_context *ctx, const test_action *action)<br>
   size_t i;<br>
<br>
   for (i = 0; i < CPU_COUNT; ++i) {<br>
-    size_t e;<br>
+    task_index e;<br>
     const Per_CPU_Control *c;<br>
     const Thread_Control *h;<br>
<br>
@@ -279,7 +290,7 @@ static void test(void)<br>
<br>
   for (i = 0; i < TASK_COUNT; ++i) {<br>
     sc = rtems_task_create(<br>
-      NAME,<br>
+      rtems_build_name(' ', ' ', 'T', '0' + i),<br>
       P(i),<br>
       RTEMS_MINIMUM_STACK_SIZE,<br>
       RTEMS_DEFAULT_MODES,<br>
@@ -292,7 +303,10 @@ static void test(void)<br>
     rtems_test_assert(sc == RTEMS_SUCCESSFUL);<br>
   }<br>
<br>
-  sc = rtems_timer_create(NAME, &ctx->timer_id);<br>
+  sc = rtems_timer_create(<br>
+    rtems_build_name('A', 'C', 'T', 'N'),<br>
+    &ctx->timer_id<br>
+  );<br>
   rtems_test_assert(sc == RTEMS_SUCCESSFUL);<br>
<br>
   sc = rtems_timer_fire_after(ctx->timer_id, 1, timer, ctx);<br>
-- <br>
2.17.1<br>
<br>
</blockquote></div>