From: Aaron Conole <aconole@redhat.com>
To: dev@dpdk.org
Cc: Jeff Guo <jia.guo@intel.com>, Thomas Monjalon <thomas@monjalon.net>
Subject: [dpdk-dev] [PATCH] test/interrupt: account for race with callback
Date: Thu, 8 Aug 2019 13:38:35 -0400 [thread overview]
Message-ID: <20190808173835.5949-1-aconole@redhat.com> (raw)
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: f1a6c22424ce ("app/test: update interrupts test")
Signed-off-by: Aaron Conole <aconole@redhat.com>
---
NOTE: it's difficult to reproduce this race. I tried a bit, but have
only seen it sporadically. In Travis environment, the CPU
resource can be very limited and this test is quite racy.
app/test/test_interrupts.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/app/test/test_interrupts.c b/app/test/test_interrupts.c
index d8c2d8124..233b14a70 100644
--- a/app/test/test_interrupts.c
+++ b/app/test/test_interrupts.c
@@ -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");
--
2.21.0
next reply other threads:[~2019-08-08 17:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-08 17:38 Aaron Conole [this message]
2019-08-09 9:18 ` David Marchand
2019-09-13 15:01 ` Thomas Monjalon
2019-09-13 14:42 ` Aaron Conole
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190808173835.5949-1-aconole@redhat.com \
--to=aconole@redhat.com \
--cc=dev@dpdk.org \
--cc=jia.guo@intel.com \
--cc=thomas@monjalon.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).