eal: do not panic on memzone init failure
authorAaron Conole <aconole@redhat.com>
Wed, 22 Mar 2017 20:19:31 +0000 (16:19 -0400)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Mon, 27 Mar 2017 13:53:06 +0000 (15:53 +0200)
When memzone initialization fails, report the error to the calling
application rather than panic().  Without a good way of detaching /
releasing hugepages, at this point the application will have to restart.

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

index ab34c0d..a71566c 100644 (file)
@@ -569,8 +569,11 @@ rte_eal_init(int argc, char **argv)
        if (rte_eal_memory_init() < 0)
                rte_panic("Cannot init memory\n");
 
-       if (rte_eal_memzone_init() < 0)
-               rte_panic("Cannot init memzone\n");
+       if (rte_eal_memzone_init() < 0) {
+               rte_eal_init_alert("Cannot init memzone\n");
+               rte_errno = ENODEV;
+               return -1;
+       }
 
        if (rte_eal_tailqs_init() < 0)
                rte_panic("Cannot init tail queues for objects\n");
index a671ed4..5a92b28 100644 (file)
@@ -839,8 +839,11 @@ rte_eal_init(int argc, char **argv)
        /* the directories are locked during eal_hugepage_info_init */
        eal_hugedirs_unlock();
 
-       if (rte_eal_memzone_init() < 0)
-               rte_panic("Cannot init memzone\n");
+       if (rte_eal_memzone_init() < 0) {
+               rte_eal_init_alert("Cannot init memzone\n");
+               rte_errno = ENODEV;
+               return -1;
+       }
 
        if (rte_eal_tailqs_init() < 0)
                rte_panic("Cannot init tail queues for objects\n");