From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id C407EA00E6 for ; Thu, 8 Aug 2019 19:38:41 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B50F01BE9B; Thu, 8 Aug 2019 19:38:40 +0200 (CEST) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id ABA951BE95 for ; Thu, 8 Aug 2019 19:38:38 +0200 (CEST) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E24B530A5418; Thu, 8 Aug 2019 17:38:37 +0000 (UTC) Received: from dhcp-25.97.bos.redhat.com (unknown [10.18.25.67]) by smtp.corp.redhat.com (Postfix) with ESMTP id 546E45D9CC; Thu, 8 Aug 2019 17:38:37 +0000 (UTC) From: Aaron Conole To: dev@dpdk.org Cc: Jeff Guo , Thomas Monjalon Date: Thu, 8 Aug 2019 13:38:35 -0400 Message-Id: <20190808173835.5949-1-aconole@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Thu, 08 Aug 2019 17:38:37 +0000 (UTC) Subject: [dpdk-dev] [PATCH] test/interrupt: account for race with callback X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- 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