Skip to content

Commit

Permalink
test/interrupt: account for race with callback
Browse files Browse the repository at this point in the history
[ upstream commit 73afc9d ]

Because the eal interrupt framework can race when invoking the callback
and a separate unregister call, the test needs to accommodate the chance
that the two collide.  Do this by checking the return value of unregister
against the race-condition flag (EAGAIN).

Fixes: f1a6c22 ("app/test: update interrupts test")

Signed-off-by: Aaron Conole <aconole@redhat.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
  • Loading branch information
apconole authored and kevintraynor committed Nov 22, 2019
1 parent d0690d9 commit a9a4cf7
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions test/test/test_interrupts.c
Expand Up @@ -370,9 +370,13 @@ test_interrupt_full_path_check(enum test_interrupt_handle_type intr_type)
rte_delay_ms(TEST_INTERRUPT_CHECK_INTERVAL);

rte_delay_ms(TEST_INTERRUPT_CHECK_INTERVAL);
if (rte_intr_callback_unregister(&test_intr_handle,
test_interrupt_callback, &test_intr_handle) < 0)
return -1;
while ((count =
rte_intr_callback_unregister(&test_intr_handle,
test_interrupt_callback,
&test_intr_handle)) < 0) {
if (count != -EAGAIN)
return -1;
}

if (flag == 0) {
printf("callback has not been called\n");
Expand Down

0 comments on commit a9a4cf7

Please sign in to comment.