Refactor eal_init to remove panic() calls
cover Refactor eal_init to remove panic() calls
In many cases, it's enough to simply let the application know that the call to initialize DPDK has failed. A complete halt can then be decided by the application based on error returned (and the app could even attempt a possible re-attempt after some corrective action by the user or application).
There is still some work left in this series.
One bit of work left is to take the calls which could reasonably be corrected (and then init can be re-attempted), and make sure to clear the already-initialized flag.
Another piece of work is to fix the lcore master/slave errors to properly reflect thread state.
Finally, some real heavy testing should be done. The series wasn't tested much, and could use real soak time. Especially around some of the calls where it no longer returns an error (for instance, vdev init and plugin init).
Aaron Conole (23):
eal: CPU init will no longer panic
eal: return error instead of panic for cpu init
eal: No panic on hugepages info init
eal: do not panic on failed hugepage query
eal: failure to parse args returns error
eal-common: introduce a way to query cpu support
eal: Signal error when CPU isn't supported
eal: do not panic on memzone initialization fails
eal: set errno when exiting for already called
eal: Do not panic on log failures
eal: Do not panic on pci-probe
eal: do not panic on vfio failure
eal: do not panic on memory init
eal: do not panic on tailq init
eal: do not panic on alarm init
eal: convert timer_init not to call panic
eal: change the private pipe call to reflect errno
eal: Do not panic on interrupt thread init
eal: do not error if plugins fail to init
eal_pci: Continue probing even on failures
eal: do not panic on failed PCI probe
eal_common_dev: continue initializing vdevs
eal: do not panic (or abort) if vdev init fails
lib/librte_eal/common/eal_common_cpuflags.c | 13 ++- lib/librte_eal/common/eal_common_dev.c | 5 +- lib/librte_eal/common/eal_common_lcore.c | 7 +- lib/librte_eal/common/eal_common_pci.c | 15 ++- lib/librte_eal/common/eal_common_tailqs.c | 4 +- .../common/include/generic/rte_cpuflags.h | 9 ++ lib/librte_eal/linuxapp/eal/eal.c | 109 +++++++++++++++------ lib/librte_eal/linuxapp/eal/eal_hugepage_info.c | 6 +- lib/librte_eal/linuxapp/eal/eal_interrupts.c | 5 +- 9 files changed, 125 insertions(+), 48 deletions(-)
Signature · 1 line
2.7.4
RFC 1/23 eal: CPU init will no longer panic
After this change, the EAL CPU NUMA node resolution step can no longer emit an rte_panic. This aligns with the code in rte_eal_init, which expects failures to return an error code.
--- lib/librte_eal/common/eal_common_lcore.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
lib/librte_eal/common/eal_common_lcore.c +4 -3
@@ -83,16 +83,17 @@ rte_eal_cpu_init(void) config->lcore_role[lcore_id] =ROLE_RTE ; lcore_config[lcore_id].core_id =eal_cpu_core_id (lcore_id); lcore_config[lcore_id].socket_id =eal_cpu_socket_id (lcore_id); - if (lcore_config[lcore_id].socket_id >= RTE_MAX_NUMA_NODES) +if (lcore_config[lcore_id].socket_id >=RTE_MAX_NUMA_NODES ) {#ifdef RTE_EAL_ALLOW_INV_SOCKET_ID lcore_config[lcore_id].socket_id =0 ;#else -rte_panic ("Socket ID (%u) is greater than " +RTE_LOG (ERR ,EAL ,"Socket ID (%u) is greater than " "RTE_MAX_NUMA_NODES (%d)\n" , lcore_config[lcore_id].socket_id,RTE_MAX_NUMA_NODES ); +return -1 ;#endif - + } RTE_LOG(DEBUG, EAL, "Detected lcore %u as " "core %u on socket %u\n", lcore_id, lcore_config[lcore_id].core_id,
Signature · 1 line
2.7.4
RFC 2/23 eal: return error instead of panic for cpu init
In reply to Aaron ConoleThere may be a way to gracefully recover; at least the application should be notified that a failure happened, rather than completely aborting.
--- lib/librte_eal/linuxapp/eal/eal.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
lib/librte_eal/linuxapp/eal/eal.c +5 -2
@@ -766,8 +766,11 @@ rte_eal_init(int argc, char **argv)/* set log level as early as possible */ rte_set_log_level (internal_config.log_level); -if (rte_eal_cpu_init () <0 ) -rte_panic ("Cannot detect lcores\n" ); +if (rte_eal_cpu_init () <0 ) { +RTE_LOG (ERR ,EAL ,"Cannot detect lcores\n" ); + errno =ENOTSUP ; +return -1 ; + } fctret =eal_parse_args (argc, argv);if (fctret <0 )
Signature · 1 line
2.7.4
RFC 3/23 eal: No panic on hugepages info init
In reply to Aaron ConoleWhen attempting to scan hugepages, signal to the eal.c that an error has occured, rather than performing a panic.
--- lib/librte_eal/linuxapp/eal/eal_hugepage_info.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
lib/librte_eal/linuxapp/eal/eal_hugepage_info.c +4 -2
@@ -283,9 +283,11 @@ eal_hugepage_info_init(void)struct dirent *dirent; dir =opendir (sys_dir_path); -if (dir ==NULL ) -rte_panic ("Cannot open directory %s to read system hugepage " +if (dir ==NULL ) { +RTE_LOG (ERR ,EAL ,"Cannot open directory %s to read system hugepage " "info\n" , sys_dir_path); +return -1 ; + }for (dirent =readdir (dir); dirent !=NULL ; dirent =readdir (dir)) {struct hugepage_info *hpi;
Signature · 1 line
2.7.4
RFC 4/23 eal: do not panic on failed hugepage query
In reply to Aaron ConoleIf we fail to acquire hugepage information, simply signal an error to the application.
--- lib/librte_eal/linuxapp/eal/eal.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
lib/librte_eal/linuxapp/eal/eal.c +5 -2
@@ -779,8 +779,11 @@ rte_eal_init(int argc, char **argv)if (internal_config.no_hugetlbfs ==0 && internal_config.process_type !=RTE_PROC_SECONDARY && internal_config.xen_dom0_support ==0 && -eal_hugepage_info_init () <0 ) -rte_panic ("Cannot get hugepage information\n" ); +eal_hugepage_info_init () <0 ) { +RTE_LOG (ERR ,EAL ,"Cannot get hugepage information\n" ); + errno =EACCES ; +return -1 ; + }if (internal_config.memory ==0 && internal_config.force_sockets ==0 ) {if (internal_config.no_hugetlbfs)
Signature · 1 line
2.7.4
RFC 5/23 eal: failure to parse args returns error
In reply to Aaron ConoleIt's possible that the application could take a corrective action here, and either prompt the user for different arguments, or at least perform a better logging. Exiting this early prevents any useful information gathering from the application layer.
--- lib/librte_eal/linuxapp/eal/eal.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
lib/librte_eal/linuxapp/eal/eal.c +5 -2
@@ -773,8 +773,11 @@ rte_eal_init(int argc, char **argv) } fctret =eal_parse_args (argc, argv); -if (fctret <0 ) -exit (1 ); +if (fctret <0 ) { +RTE_LOG (ERR ,EAL ,"Invalid 'command line' arguments\n" ); + errno =EINVAL ; +return -1 ; + } if (internal_config.no_hugetlbfs == 0 && internal_config.process_type != RTE_PROC_SECONDARY &&
Signature · 1 line
2.7.4
RFC 6/23 eal-common: introduce a way to query cpu support
In reply to Aaron ConoleThis adds a new API to check for the eal cpu versions.
--- lib/librte_eal/common/eal_common_cpuflags.c | 13 +++++++++++-- lib/librte_eal/common/include/generic/rte_cpuflags.h | 9 +++++++++ 2 files changed, 20 insertions(+), 2 deletions(-)
lib/librte_eal/common/eal_common_cpuflags.c +11 -2
@@ -43,6 +43,13 @@void rte_cpu_check_supported (void ) { +if (!rte_cpu_is_supported ()) +exit (1 ); +} + +bool +rte_cpu_is_supported (void ) +{/* This is generated at compile-time by the build system */ static const enum rte_cpu_flag_t compile_time_flags[] = {RTE_COMPILE_TIME_CPUFLAGS
@@ -57,14 +64,16 @@ rte_cpu_check_supported(void)fprintf (stderr,"ERROR: CPU feature flag lookup failed with error %d\n" , ret); -exit (1 ); +return false; }if (!ret) {fprintf (stderr,"ERROR: This system does not support \"%s\".\n" "Please check that RTE_MACHINE is set correctly.\n" ,rte_cpu_get_flag_name (compile_time_flags[i])); -exit (1 ); +return false; } } + +return true; }
lib/librte_eal/common/include/generic/rte_cpuflags.h +9 -0
@@ -40,6 +40,7 @@*/ #include <errno.h> +#include <stdbool.h> /** * Enumeration of all CPU features supported
@@ -82,4 +83,12 @@ rte_cpu_get_flag_enabled(enum rte_cpu_flag_t feature);void rte_cpu_check_supported (void ); +/** +* This function checks that the currently used CPU supports the CPU features +* that were specified at compile time. It is called automatically within the +* EAL, so does not need to be used by applications. This version returns a +* result so that decisions may be made (for instance, graceful shutdowns). +*/ +bool +rte_cpu_is_supported (void );#endif /* _RTE_CPUFLAGS_H_ */
Signature · 1 line
2.7.4
RFC 7/23 eal: Signal error when CPU isn't supported
In reply to Aaron ConoleIt's now possible to gracefully exit the application, or for applications which support non-dpdk datapaths working in concert with DPDK datapaths, there no longer is the possibility of exiting for unsupported CPUs.
--- lib/librte_eal/linuxapp/eal/eal.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
lib/librte_eal/linuxapp/eal/eal.c +4 -1
@@ -751,7 +751,10 @@ rte_eal_init(int argc, char **argv)char thread_name[RTE_MAX_THREAD_NAME_LEN ];/* checks if the machine is adequate */ -rte_cpu_check_supported (); +if (!rte_cpu_is_supported ()) { + errno =ENOTSUP ; +return -1 ; + }if (!rte_atomic32_test_and_set (&run_once))return -1 ;
Signature · 1 line
2.7.4
RFC 8/23 eal: do not panic on memzone initialization fails
In reply to Aaron ConoleWhen memzone initialization fails, report the error to the calling application rather than panic().
--- lib/librte_eal/linuxapp/eal/eal.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
lib/librte_eal/linuxapp/eal/eal.c +5 -2
@@ -828,8 +828,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_LOG (ERR ,EAL ,"Cannot init memzone\n" ); + errno =ENODEV ; +return -1 ; + }if (rte_eal_tailqs_init () <0 )rte_panic ("Cannot init tail queues for objects\n" );
Signature · 1 line
2.7.4
RFC 9/23 eal: set errno when exiting for already called
In reply to Aaron Conole--- lib/librte_eal/linuxapp/eal/eal.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
lib/librte_eal/linuxapp/eal/eal.c +3 -1
@@ -756,8 +756,10 @@ rte_eal_init(int argc, char **argv)return -1 ; } -if (!rte_atomic32_test_and_set (&run_once)) +if (!rte_atomic32_test_and_set (&run_once)) { + errno =EALREADY ;return -1 ; + } logid =strrchr (argv[0 ],'/' ); logid =strdup (logid ? logid +1 : argv[0 ]);
Signature · 1 line
2.7.4
RFC 10/23 eal: Do not panic on log failures
In reply to Aaron ConoleWhen log initialization fails, it's generally because the fopencookie failed. While this is rare in practice, it could happen. Return 'Operation Not Supported' in errno, and let the caller know this error occured.
--- lib/librte_eal/linuxapp/eal/eal.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
lib/librte_eal/linuxapp/eal/eal.c +5 -2
@@ -813,8 +813,11 @@ rte_eal_init(int argc, char **argv)rte_config_init (); -if (rte_eal_log_init (logid, internal_config.syslog_facility) <0 ) -rte_panic ("Cannot init logs\n" ); +if (rte_eal_log_init (logid, internal_config.syslog_facility) <0 ) { +RTE_LOG (ERR ,EAL ,"Cannot init logs\n" ); + errno =ENOTSUP ; +return -1 ; + }if (rte_eal_pci_init () <0 )rte_panic ("Cannot init PCI\n" );
Signature · 1 line
2.7.4
RFC 11/23 eal: Do not panic on pci-probe
In reply to Aaron Conole--- lib/librte_eal/linuxapp/eal/eal.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
lib/librte_eal/linuxapp/eal/eal.c +5 -2
@@ -819,8 +819,11 @@ rte_eal_init(int argc, char **argv)return -1 ; } -if (rte_eal_pci_init () <0 ) -rte_panic ("Cannot init PCI\n" ); +if (rte_eal_pci_init () <0 ) { +RTE_LOG (ERR ,EAL ,"Cannot init PCI\n" ); + errno =EPERM ; +return -1 ; + }#ifdef VFIO_PRESENT if (rte_eal_vfio_setup () <0 )
Signature · 1 line
2.7.4
RFC 12/23 eal: do not panic on vfio failure
In reply to Aaron Conole--- lib/librte_eal/linuxapp/eal/eal.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
lib/librte_eal/linuxapp/eal/eal.c +5 -2
@@ -826,8 +826,11 @@ rte_eal_init(int argc, char **argv) }#ifdef VFIO_PRESENT -if (rte_eal_vfio_setup () <0 ) -rte_panic ("Cannot init VFIO\n" ); +if (rte_eal_vfio_setup () <0 ) { +RTE_LOG (ERR ,EAL ,"Cannot init VFIO\n" ); + errno =ENOTSUP ; +return -1 ; + }#endif if (rte_eal_memory_init () <0 )
Signature · 1 line
2.7.4
RFC 13/23 eal: do not panic on memory init
In reply to Aaron ConoleThis can only happen when access to hugepages (either as primary or secondary process) fails (and that is usually permissions).
--- lib/librte_eal/linuxapp/eal/eal.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
lib/librte_eal/linuxapp/eal/eal.c +5 -2
@@ -833,8 +833,11 @@ rte_eal_init(int argc, char **argv) }#endif -if (rte_eal_memory_init () <0 ) -rte_panic ("Cannot init memory\n" ); +if (rte_eal_memory_init () <0 ) { +RTE_LOG (ERR ,EAL ,"Cannot init memory\n" ); + errno =EACCES ; +return -1 ; + }/* the directories are locked during eal_hugepage_info_init */ eal_hugedirs_unlock ();
Signature · 1 line
2.7.4
RFC 14/23 eal: do not panic on tailq init
In reply to Aaron ConoleThere are some theoretical racy conditions in the system that _could_ cause early tailq init to fail; however, no need to panic the application. While it can't continue using DPDK, it could make better alerts to the user.
--- lib/librte_eal/common/eal_common_tailqs.c | 4 ++-- lib/librte_eal/linuxapp/eal/eal.c | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-)
lib/librte_eal/common/eal_common_tailqs.c +2 -2
@@ -188,8 +188,8 @@ rte_eal_tailqs_init(void)if (t->head ==NULL ) {RTE_LOG (ERR ,EAL ,"Cannot initialize tailq: %s\n" , t->name); -/* no need to TAILQ_REMOVE, we are going to panic in -* rte_eal_init() */ +/* no need to TAILQ_REMOVE, we are going to disallow re-attemtps +* for rte_eal_init(). */ goto fail; } }
lib/librte_eal/linuxapp/eal/eal.c +5 -2
@@ -848,8 +848,11 @@ rte_eal_init(int argc, char **argv)return -1 ; } -if (rte_eal_tailqs_init () <0 ) -rte_panic ("Cannot init tail queues for objects\n" ); +if (rte_eal_tailqs_init () <0 ) { +RTE_LOG (ERR ,EAL ,"Cannot init tail queues for objects\n" ); + errno =ENOTSUP ; +return -1 ; + }if (rte_eal_alarm_init () <0 )rte_panic ("Cannot init interrupt-handling thread\n" );
Signature · 1 line
2.7.4
RFC 15/23 eal: do not panic on alarm init
In reply to Aaron Conolerte_eal_alarm_init() call uses the linux timerfd framework to create a poll()-able timer using standard posix file operations. This could fail for a few reasons given in the man-pages, but many could be corrected by the user application. No need to panic.
--- lib/librte_eal/linuxapp/eal/eal.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
lib/librte_eal/linuxapp/eal/eal.c +7 -2
@@ -61,6 +61,7 @@#include <rte_launch.h> #include <rte_eal.h> #include <rte_eal_memconfig.h> +#include <rte_errno.h> #include <rte_per_lcore.h> #include <rte_lcore.h> #include <rte_log.h>
@@ -854,8 +855,12 @@ rte_eal_init(int argc, char **argv)return -1 ; } -if (rte_eal_alarm_init () <0 ) -rte_panic ("Cannot init interrupt-handling thread\n" ); +if (rte_eal_alarm_init () <0 ) { +RTE_LOG (ERR ,EAL ,"Cannot init interrupt-handling thread\n" ); +/* rte_eal_alarm_init sets rte_errno on failure. */ + errno = rte_errno; +return -1 ; + }if (rte_eal_timer_init () <0 )rte_panic ("Cannot init HPET or TSC timers\n" );
Signature · 1 line
2.7.4
RFC 16/23 eal: convert timer_init not to call panic
In reply to Aaron ConoleAfter code inspection, there is no way for eal_timer_init() to fail. It simply returns 0 in all cases. As such, this test could either go-away or stay here as 'future-proofing'.
--- lib/librte_eal/linuxapp/eal/eal.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
lib/librte_eal/linuxapp/eal/eal.c +5 -2
@@ -862,8 +862,11 @@ rte_eal_init(int argc, char **argv)return -1 ; } -if (rte_eal_timer_init () <0 ) -rte_panic ("Cannot init HPET or TSC timers\n" ); +if (rte_eal_timer_init () <0 ) { +RTE_LOG (ERR ,EAL ,"Cannot init HPET or TSC timers\n" ); + errno =ENOTSUP ; +return -1 ; + }eal_check_mem_on_local_socket ();
Signature · 1 line
2.7.4
RFC 17/23 eal: change the private pipe call to reflect errno
In reply to Aaron ConoleThere could be some confusion as to why the call failed - this change will always reflect the value of the error in rte_error.
--- lib/librte_eal/linuxapp/eal/eal_interrupts.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
lib/librte_eal/linuxapp/eal/eal_interrupts.c +4 -1
@@ -872,13 +872,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 {
Signature · 1 line
2.7.4
RFC 18/23 eal: Do not panic on interrupt thread init
In reply to Aaron ConoleWhen 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.
--- lib/librte_eal/linuxapp/eal/eal.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
lib/librte_eal/linuxapp/eal/eal.c +5 -2
@@ -881,8 +881,11 @@ 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_LOG (ERR ,EAL ,"Cannot init interrupt-handling thread\n" ); + errno = rte_errno; +return -1 ; + }RTE_LCORE_FOREACH_SLAVE (i) {
Signature · 1 line
2.7.4
RFC 19/23 eal: do not error if plugins fail to init
In reply to Aaron ConolePlugins are useful and important. However, it seems crazy to abort everything just because they don't initialize properly.
--- lib/librte_eal/linuxapp/eal/eal.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
lib/librte_eal/linuxapp/eal/eal.c +3 -2
@@ -870,8 +870,9 @@ rte_eal_init(int argc, char **argv)eal_check_mem_on_local_socket (); -if (eal_plugins_init () <0 ) -rte_panic ("Cannot init plugins\n" ); +if (eal_plugins_init () <0 ) { +RTE_LOG (ERR ,EAL ,"Cannot init plugins\n" ); + }eal_thread_init_master (rte_config.master_lcore);
Signature · 1 line
2.7.4
RFC 20/23 eal_pci: Continue probing even on failures
In reply to Aaron ConoleSome devices may be inaccessible for a variety of reasons, or the PCI-bus may be unavailable causing the whole thing to fail. Still, better to continue attempts at probes.
--- lib/librte_eal/common/eal_common_pci.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
lib/librte_eal/common/eal_common_pci.c +10 -5
@@ -69,6 +69,7 @@#include <sys/queue.h> #include <sys/mman.h> +#include <rte_errno.h> #include <rte_interrupts.h> #include <rte_log.h> #include <rte_pci.h>
@@ -413,6 +414,7 @@ rte_eal_pci_probe(void)struct rte_pci_device *dev =NULL ;struct rte_devargs *devargs;int probe_all =0 ; +int ret_1 =0 ;int ret =0 ;if (rte_eal_devargs_type_count (RTE_DEVTYPE_WHITELISTED_PCI ) ==0 )
@@ -427,17 +429,20 @@ rte_eal_pci_probe(void)/* probe all or only whitelisted devices */ if (probe_all) - ret =pci_probe_all_drivers (dev); + ret_1 =pci_probe_all_drivers (dev);else if (devargs !=NULL && devargs->type ==RTE_DEVTYPE_WHITELISTED_PCI ) - ret =pci_probe_all_drivers (dev); -if (ret <0 ) -rte_exit (EXIT_FAILURE ,"Requested device " PCI_PRI_FMT + ret_1 =pci_probe_all_drivers (dev); +if (ret_1 <0 ) { +RTE_LOG (ERR ,EAL ,"Requested device " PCI_PRI_FMT " cannot be used\n" , dev->addr.domain, dev->addr.bus, dev->addr.devid, dev->addr.function); + rte_errno = errno; + ret =1 ; + } } -return 0 ; +return -ret; }/* dump one device */
Signature · 1 line
2.7.4
RFC 21/23 eal: do not panic on failed PCI probe
In reply to Aaron ConoleIt may even be possible to simply log the error and continue on letting the user check the logs and restart the application when things are failed.
--- lib/librte_eal/linuxapp/eal/eal.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
lib/librte_eal/linuxapp/eal/eal.c +5 -2
@@ -925,8 +925,11 @@ rte_eal_init(int argc, char **argv)rte_eal_mp_wait_lcore ();/* Probe & Initialize PCI devices */ -if (rte_eal_pci_probe ()) -rte_panic ("Cannot probe PCI\n" ); +if (rte_eal_pci_probe ()) { +RTE_LOG (ERR ,EAL ,"Cannot probe PCI\n" ); + errno =ENOTSUP ; +return -1 ; + }if (rte_eal_dev_init () <0 )rte_panic ("Cannot init pmd devices\n" );
Signature · 1 line
2.7.4
RFC 22/23 eal_common_dev: continue initializing vdevs
In reply to Aaron ConoleEven if one vdev should fail, there's no need to prevent further processing. Log the error, and reflect it to the higher levels to decide.
--- lib/librte_eal/common/eal_common_dev.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
lib/librte_eal/common/eal_common_dev.c +3 -2
@@ -80,6 +80,7 @@ intrte_eal_dev_init (void) {struct rte_devargs *devargs; +int ret =0 ;/* * Note that the dev_driver_list is populated here
@@ -97,11 +98,11 @@ rte_eal_dev_init(void) devargs->args)) {RTE_LOG (ERR ,EAL ,"failed to initialize %s device\n" , devargs->virt.drv_name); -return -1 ; + ret =-1 ; } } -return 0 ; +return ret; }int rte_eal_dev_attach (const char *name,const char *devargs)
Signature · 1 line
2.7.4
RFC 23/23 eal: do not panic (or abort) if vdev init fails
In reply to Aaron ConoleSeems like it's possible to continue. At least, the error is reflected properly in the logs. A user could then go and correct or investigate the situation.
--- lib/librte_eal/linuxapp/eal/eal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/librte_eal/linuxapp/eal/eal.c +1 -1
@@ -932,7 +932,7 @@ rte_eal_init(int argc, char **argv) }if (rte_eal_dev_init () <0 ) -rte_panic ("Cannot init pmd devices\n" ); +RTE_LOG (ERR ,EAL ,"Cannot init pmd devices\n" );rte_eal_mcfg_complete ();
Signature · 1 line
2.7.4
Hi Aaron,
2016-12-30 10:25, Aaron Conole:
Quoted 7 lines
In many cases, it's enough to simply let the application know that the call to initialize DPDK has failed. A complete halt can then be decided by the application based on error returned (and the app could even attempt a possible re-attempt after some corrective action by the user or application).
There is still some work left in this series.
Thanks for starting the work.
I think it is candidate for 17.05 and can be promoted in the roadmap:
http://dpdk.org/dev/roadmap
Have you checked wether these changes are modifying the API? Some doxygen comments may need to be updated when a new error code is used.
Quoted 9 lines · Thomas Monjalon
Hi Aaron,
2016-12-30 10:25, Aaron Conole:
Quoted 6 lines
In many cases, it's enough to simply let the application know that the call to initialize DPDK has failed. A complete halt can then be decided by the application based on error returned (and the app could even attempt a possible re-attempt after some corrective action by the user or application).
Quoted 5 lines
Quoted 1 line
There is still some work left in this series.
Thanks for starting the work.
I think it is candidate for 17.05 and can be promoted in the roadmap:
http://dpdk.org/dev/roadmap
Okay.
Quoted 1 line
Have you checked wether these changes are modifying the API?
That'll be my last pass through.
Quoted 2 lines
Some doxygen comments may need to be updated when a new error code is used.
Agreed; I also want to ensure that there's a consistent set of error codes, and a consistent place to check for them.
I'll probably prefer to put them in rte_errno.
Thanks for your thoughts, Thomas!
Quoted 9 lines · Thomas Monjalon
Hi Aaron,
2016-12-30 10:25, Aaron Conole:
Quoted 6 lines
In many cases, it's enough to simply let the application know that the call to initialize DPDK has failed. A complete halt can then be decided by the application based on error returned (and the app could even attempt a possible re-attempt after some corrective action by the user or application).
Quoted 7 lines
Quoted 1 line
There is still some work left in this series.
Thanks for starting the work.
I think it is candidate for 17.05 and can be promoted in the roadmap:
http://dpdk.org/dev/roadmapHave you checked wether these changes are modifying the API?
Looks like no API changes occur with this series.
Quoted 2 lines
Some doxygen comments may need to be updated when a new error code is used.
I haven't seen any instances, but if you'd like I can add that to the series as some of the error values for rte_eal_init().
-Aaron