From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <arnon@qwilt.com>
Received: from mta.qwilt.com (mta.qwilt.com [52.9.191.255])
 by dpdk.org (Postfix) with ESMTP id 1AFC958C6
 for <dev@dpdk.org>; Wed, 25 Apr 2018 00:17:22 +0200 (CEST)
Received: from localhost (localhost [127.0.0.1])
 by mta.qwilt.com (Postfix) with ESMTP id 885E680C4BE;
 Tue, 24 Apr 2018 22:17:21 +0000 (UTC)
X-Virus-Scanned: amavisd-new at qwilt.com
Received: from mta.qwilt.com ([127.0.0.1])
 by localhost (mta.qwilt.com [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id 7mgdMNwvplyu; Tue, 24 Apr 2018 22:17:21 +0000 (UTC)
Received: from rd01.it.qwilt.com.qwilt.com (80.179.204.39.cable.012.net.il
 [80.179.204.39])
 by mta.qwilt.com (Postfix) with ESMTPSA id 2065880C4D1;
 Tue, 24 Apr 2018 22:17:18 +0000 (UTC)
From: Arnon Warshavsky <arnon@qwilt.com>
To: thomas@monjalon.net, anatoly.burakov@intel.com, wenzhuo.lu@intel.com,
 declan.doherty@intel.com, jerin.jacob@caviumnetworks.com,
 bruce.richardson@intel.com, ferruh.yigit@intel.com
Cc: dev@dpdk.org,
	arnon@qwilt.com
Date: Wed, 25 Apr 2018 01:16:50 +0300
Message-Id: <1524608213-2080-9-git-send-email-arnon@qwilt.com>
X-Mailer: git-send-email 1.8.3.1
In-Reply-To: <1524608213-2080-1-git-send-email-arnon@qwilt.com>
References: <1524608213-2080-1-git-send-email-arnon@qwilt.com>
Subject: [dpdk-dev] [PATCH v7 08/11] eal: replace rte_panic instances in
	interrupts thread
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Tue, 24 Apr 2018 22:17:22 -0000

replace panic calls with log and return value.
Thread function removes the noreturn attribute.

Signed-off-by: Arnon Warshavsky <arnon@qwilt.com>
---
 lib/librte_eal/linuxapp/eal/eal_interrupts.c | 25 ++++++++++++++++++-------
 1 file changed, 18 insertions(+), 7 deletions(-)

diff --git a/lib/librte_eal/linuxapp/eal/eal_interrupts.c b/lib/librte_eal/linuxapp/eal/eal_interrupts.c
index 58e9328..77e6f2a 100644
--- a/lib/librte_eal/linuxapp/eal/eal_interrupts.c
+++ b/lib/librte_eal/linuxapp/eal/eal_interrupts.c
@@ -785,7 +785,7 @@ struct rte_intr_source {
  * @return
  *  never return;
  */
-static __attribute__((noreturn)) void *
+static void *
 eal_intr_thread_main(__rte_unused void *arg)
 {
 	struct epoll_event ev;
@@ -803,8 +803,11 @@ static __attribute__((noreturn)) void *
 
 		/* create epoll fd */
 		int pfd = epoll_create(1);
-		if (pfd < 0)
-			rte_panic("Cannot create epoll instance\n");
+		if (pfd < 0) {
+			RTE_LOG(CRIT, EAL, "%s(): Cannot create epoll instance\n",
+					__func__);
+			return NULL;
+		}
 
 		pipe_event.data.fd = intr_pipe.readfd;
 		/**
@@ -813,8 +816,11 @@ static __attribute__((noreturn)) void *
 		 */
 		if (epoll_ctl(pfd, EPOLL_CTL_ADD, intr_pipe.readfd,
 						&pipe_event) < 0) {
-			rte_panic("Error adding fd to %d epoll_ctl, %s\n",
+			RTE_LOG(CRIT, EAL, "%s(): Error adding fd to %d "
+					"epoll_ctl, %s\n",
+					__func__,
 					intr_pipe.readfd, strerror(errno));
+			return NULL;
 		}
 		numfds++;
 
@@ -831,9 +837,12 @@ static __attribute__((noreturn)) void *
 			 * into wait list.
 			 */
 			if (epoll_ctl(pfd, EPOLL_CTL_ADD,
-					src->intr_handle.fd, &ev) < 0){
-				rte_panic("Error adding fd %d epoll_ctl, %s\n",
-					src->intr_handle.fd, strerror(errno));
+					src->intr_handle.fd, &ev) < 0) {
+				RTE_LOG(CRIT, EAL, "%s(): Error adding fd %d epoll_ctl, %s\n",
+					__func__,
+					src->intr_handle.fd,
+					strerror(errno));
+				return NULL;
 			}
 			else
 				numfds++;
@@ -848,6 +857,8 @@ static __attribute__((noreturn)) void *
 		 */
 		close(pfd);
 	}
+
+	return NULL;
 }
 
 int
-- 
1.8.3.1