<div dir="ltr">Please ignore this patch and refer to <a href="https://lists.rtems.org/pipermail/devel/2020-September/061766.html">https://lists.rtems.org/pipermail/devel/2020-September/061766.html</a>.<div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Sep 2, 2020 at 8:56 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 | 62 +++++++++++++++--------<br>
1 file changed, 40 insertions(+), 22 deletions(-)<br>
<br>
diff --git a/testsuites/smptests/smpstrongapa01/init.c b/testsuites/smptests/smpstrongapa01/init.c<br>
index bf8bc05231..3053bed785 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,7 +17,7 @@<br>
#include "config.h"<br>
#endif<br>
<br>
-#include "tmacros.h"<br>
+#include <tmacros.h><br>
<br>
#include <rtems.h><br>
<br>
@@ -24,15 +25,22 @@ const char rtems_test_name[] = "SMPSTRONGAPA 1";<br>
<br>
#define CPU_COUNT 4<br>
<br>
-#define TASK_COUNT (3 * CPU_COUNT)<br>
+#define TASK_COUNT 5<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, cpu2, cpu3) ( (cpu3 < 3) | (cpu2 << 2 ) | (cpu1 << 1) | cpu0 )<br>
<br>
-#define NAME rtems_build_name('S', 'A', 'P', 'A')<br>
+typedef enum {<br>
+ T0,<br>
+ T1,<br>
+ T2,<br>
+ T3,<br>
+ T4,<br>
+ IDLE<br>
+} task_index;<br>
<br>
typedef struct {<br>
enum {<br>
@@ -43,7 +51,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,7 +73,7 @@ typedef struct {<br>
KIND_RESET, \<br>
0, \<br>
{ 0 }, \<br>
- { IDLE, IDLE, IDLE, IDLE } \<br>
+ { IDLE, IDLE, IDLE, IDLE} \<br>
}<br>
<br>
#define SET_PRIORITY(index, prio, cpu0, cpu1, cpu2, cpu3) \<br>
@@ -73,7 +81,7 @@ typedef struct {<br>
KIND_SET_PRIORITY, \<br>
index, \<br>
{ .priority = prio }, \<br>
- { cpu0, cpu1, cpu2, cpu3 } \<br>
+ { cpu0, cpu1, cpu2, cpu3} \<br>
}<br>
<br>
#define SET_AFFINITY(index, aff, cpu0, cpu1, cpu2, cpu3) \<br>
@@ -97,22 +105,29 @@ typedef struct {<br>
KIND_UNBLOCK, \<br>
index, \<br>
{ 0 }, \<br>
- { cpu0, cpu1, cpu2, cpu3 } \<br>
+ { cpu0, cpu1, cpu2, cpu3} \<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, IDLE, IDLE),<br>
+ UNBLOCK( T1, T0, T1, IDLE, IDLE),<br>
+ UNBLOCK( T2, T0, T1, T2, IDLE),<br>
+ UNBLOCK( T3, T0, T1, T2, T3),<br>
+ UNBLOCK( T4, T0, T1, T2, T3),<br>
+ SET_PRIORITY( T0, P(0), T0, T1, T2, T3),<br>
+ SET_PRIORITY( T1, P(1), T0, T1, T2, T3),<br>
+ SET_PRIORITY( T2, P(2), T0, T1, T2, T3),<br>
+ /*<br>
+ * Introduce Task 4 intially with lowest priority to imitate late arrival<br>
+ */<br>
+ SET_PRIORITY( T4, P(5), T0, T1, T2, T3), <br>
+ SET_PRIORITY( T3, P(4), T0, T1, T2, T3),<br>
+ SET_AFFINITY( T4, A(1, 0, 0, 0), T0, T1, T2, T3),<br>
+ /*<br>
+ * Show that higher priority task gets dislodged from its processor<br>
+ */<br>
+ SET_PRIORITY( T4, P(3), T4, T1, T2, T0), <br>
RESET<br>
};<br>
<br>
@@ -182,7 +197,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 +294,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 +307,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>