From ce3bede01e74f45fff611fdcf97bd6fe82b3f9a0 Mon Sep 17 00:00:00 2001 From: Aaron Conole Date: Wed, 22 Mar 2017 16:19:31 -0400 Subject: [PATCH] eal: do not panic on memzone init failure 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 Acked-by: Bruce Richardson --- lib/librte_eal/bsdapp/eal/eal.c | 7 +++++-- lib/librte_eal/linuxapp/eal/eal.c | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c index ab34c0df71..a71566ca0f 100644 --- a/lib/librte_eal/bsdapp/eal/eal.c +++ b/lib/librte_eal/bsdapp/eal/eal.c @@ -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"); diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c index a671ed4639..5a92b2875b 100644 --- a/lib/librte_eal/linuxapp/eal/eal.c +++ b/lib/librte_eal/linuxapp/eal/eal.c @@ -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"); -- 2.20.1