eal: do not panic on interrupt thread init
authorAaron Conole <aconole@redhat.com>
Wed, 22 Mar 2017 20:19:35 +0000 (16:19 -0400)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Mon, 27 Mar 2017 13:56:59 +0000 (15:56 +0200)
There could be some confusion as to why the call failed - this change
will always reflect the value of the error in rte_error.

When initializing the interrupt thread, there are a number of possible
reasons for failure - some of which are correctable by the application.
Do not panic() needlessly, and give the application a change to reflect
this information to the user.

Signed-off-by: Aaron Conole <aconole@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
lib/librte_eal/bsdapp/eal/eal.c
lib/librte_eal/linuxapp/eal/eal.c
lib/librte_eal/linuxapp/eal/eal_interrupts.c

index ff4225f..0c157b4 100644 (file)
@@ -593,8 +593,10 @@ rte_eal_init(int argc, char **argv)
                return -1;
        }
 
-       if (rte_eal_intr_init() < 0)
-               rte_panic("Cannot init interrupt-handling thread\n");
+       if (rte_eal_intr_init() < 0) {
+               rte_eal_init_alert("Cannot init interrupt-handling thread\n");
+               return -1;
+       }
 
        if (rte_eal_timer_init() < 0) {
                rte_eal_init_alert("Cannot init HPET or TSC timers\n");
index 9fb5421..ecf567a 100644 (file)
@@ -890,8 +890,10 @@ rte_eal_init(int argc, char **argv)
                rte_config.master_lcore, (int)thread_id, cpuset,
                ret == 0 ? "" : "...");
 
-       if (rte_eal_intr_init() < 0)
-               rte_panic("Cannot init interrupt-handling thread\n");
+       if (rte_eal_intr_init() < 0) {
+               rte_eal_init_alert("Cannot init interrupt-handling thread\n");
+               return -1;
+       }
 
        if (rte_bus_scan())
                rte_panic("Cannot scan the buses for devices\n");
index 92a19cb..5bb833e 100644 (file)
@@ -898,13 +898,16 @@ rte_eal_intr_init(void)
         * create a pipe which will be waited by epoll and notified to
         * rebuild the wait list of epoll.
         */
-       if (pipe(intr_pipe.pipefd) < 0)
+       if (pipe(intr_pipe.pipefd) < 0) {
+               rte_errno = errno;
                return -1;
+       }
 
        /* create the host thread to wait/handle the interrupt */
        ret = pthread_create(&intr_thread, NULL,
                        eal_intr_thread_main, NULL);
        if (ret != 0) {
+               rte_errno = ret;
                RTE_LOG(ERR, EAL,
                        "Failed to create thread for interrupt handling\n");
        } else {