ping..
________________________________________
From: Jacob,  Jerin
Sent: Wednesday, June 10, 2015 7:38 PM
To: [email protected]
Cc: Jacob,  Jerin
Subject: [lng-odp] [PATCH 1/2] validation: timer: added an assert to catch any 
timer dispatch race to different worker and/or queue

timer validation program creates each worker thread and associate a
private queue for event delivery. With out this assert its difficult debug
if there is any race issue in timer event dispatch.

Signed-off-by: Jerin Jacob <[email protected]>
---
 test/validation/odp_timer.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/test/validation/odp_timer.c b/test/validation/odp_timer.c
index 88f5208..5dfc06a 100644
--- a/test/validation/odp_timer.c
+++ b/test/validation/odp_timer.c
@@ -44,7 +44,8 @@ struct test_timer {
        odp_timer_t tim; /* Timer handle */
        odp_event_t ev;  /* Timeout event */
        odp_event_t ev2; /* Copy of event handle */
-       uint64_t tick; /* Expiration tick or TICK_INVALID */
+       uint64_t tick;   /* Expiration tick or TICK_INVALID */
+       int tid;         /* Allocated thread id */
 };

 #define TICK_INVALID (~(uint64_t)0)
@@ -223,6 +224,8 @@ static void handle_tmo(odp_event_t ev, bool stale, uint64_t 
prev_tick)
        uint64_t tick = odp_timeout_tick(tmo);
        struct test_timer *ttp = odp_timeout_user_ptr(tmo);

+       CU_ASSERT_FATAL(ttp->tid == odp_thread_id());
+
        if (tim == ODP_TIMER_INVALID)
                CU_FAIL("odp_timeout_timer() invalid timer");
        if (ttp == NULL)
@@ -294,6 +297,7 @@ static void *worker_entrypoint(void *arg TEST_UNUSED)
                        CU_FAIL_FATAL("Failed to allocate timeout");
                tt[i].ev2 = tt[i].ev;
                tt[i].tick = TICK_INVALID;
+               tt[i].tid = odp_thread_id();
        }

        odp_barrier_wait(&test_barrier);
--
2.1.0

_______________________________________________
lng-odp mailing list
[email protected]
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to