@@ -6,7 +6,7 @@ include $(RTE_SDK)/mk/rte.vars.mk
DIRS-$(CONFIG_RTE_LIBRTE_KVARGS) += librte_kvargs
DIRS-$(CONFIG_RTE_LIBRTE_PROCESS_INFO) += librte_process_info
DIRS-$(CONFIG_RTE_LIBRTE_EAL) += librte_eal
-DEPDIRS-librte_eal := librte_kvargs
+DEPDIRS-librte_eal := librte_kvargs librte_process_info
DIRS-$(CONFIG_RTE_LIBRTE_PCI) += librte_pci
DEPDIRS-librte_pci := librte_eal
DIRS-$(CONFIG_RTE_LIBRTE_RING) += librte_ring
@@ -25,6 +25,7 @@
#include <rte_version.h>
#include <rte_devargs.h>
#include <rte_memcpy.h>
+#include <rte_process_info.h>
#include "eal_internal_cfg.h"
#include "eal_options.h"
@@ -82,6 +83,7 @@ eal_long_options[] = {
{OPT_LEGACY_MEM, 0, NULL, OPT_LEGACY_MEM_NUM },
{OPT_SINGLE_FILE_SEGMENTS, 0, NULL, OPT_SINGLE_FILE_SEGMENTS_NUM},
{OPT_MATCH_ALLOCATIONS, 0, NULL, OPT_MATCH_ALLOCATIONS_NUM},
+ {OPT_NO_PROCESS_INFO, 0, NULL, OPT_NO_PROCESS_INFO_NUM },
{0, 0, NULL, 0 }
};
@@ -126,6 +128,75 @@ static int master_lcore_parsed;
static int mem_parsed;
static int core_parsed;
+static char **eal_args;
+static char **eal_app_args;
+
+#define EAL_PARAM_REQ "/eal:params"
+#define EAL_APP_PARAM_REQ "/eal:app_params"
+
+/* callback handler for process_info library to report out EAL flags */
+int
+handle_eal_info_request(const char *cmd, const char *params __rte_unused,
+ char *buffer, int buf_len)
+{
+ char **args;
+ int used = 0;
+ int i = 0;
+
+ if (strcmp(cmd, EAL_PARAM_REQ) == 0)
+ args = eal_args;
+ else if (strcmp(cmd, EAL_APP_PARAM_REQ) == 0)
+ args = eal_app_args;
+ else /* version */
+ return snprintf(buffer, buf_len, "\"%s\"", rte_version());
+
+ if (args == NULL || args[0] == NULL)
+ return snprintf(buffer, buf_len, "[]"); /* empty list */
+
+ used = strlcpy(buffer, "[", buf_len);
+ while (args[i] != NULL)
+ used += snprintf(buffer + used, buf_len - used, "\"%s\",",
+ args[i++]);
+ buffer[used - 1] = ']';
+ return used;
+}
+
+int
+eal_save_args(int argc, char **argv)
+{
+ int i, j;
+
+ /* clone argv to report out later. We overprovision, but
+ * this does not waste huge amounts of memory
+ */
+ eal_args = calloc(argc + 1, sizeof(*eal_args));
+ if (eal_args == NULL)
+ return -1;
+
+ for (i = 0; i < argc; i++) {
+ eal_args[i] = strdup(argv[i]);
+ if (strcmp(argv[i], "--") == 0)
+ break;
+ }
+ eal_args[i++] = NULL; /* always finish with NULL */
+ rte_process_info_register(EAL_PARAM_REQ, handle_eal_info_request);
+
+ /* allow reporting of any app args we know about too */
+ if (i == argc)
+ return 0;
+
+ eal_app_args = calloc(argc - i + 1, sizeof(*eal_args));
+ if (eal_app_args == NULL)
+ return -1;
+
+ for (j = 0; i < argc; j++, i++)
+ eal_app_args[j] = strdup(argv[i]);
+ eal_app_args[j] = NULL;
+ rte_process_info_register(EAL_APP_PARAM_REQ, handle_eal_info_request);
+
+ return 0;
+}
+
static int
eal_option_device_add(enum rte_devtype type, const char *optarg)
{
@@ -1446,6 +1517,9 @@ eal_parse_common_option(int opt, const char *optarg,
return -1;
}
break;
+ case OPT_NO_PROCESS_INFO_NUM:
+ conf->no_process_info = 1;
+ break;
/* don't know what to do, leave this to caller */
default:
@@ -1687,6 +1761,7 @@ eal_common_usage(void)
" --"OPT_IN_MEMORY" Operate entirely in memory. This will\n"
" disable secondary process support\n"
" --"OPT_BASE_VIRTADDR" Base virtual address\n"
+ " --"OPT_NO_PROCESS_INFO" Disable process info\n"
"\nEAL options for DEBUG use only:\n"
" --"OPT_HUGE_UNLINK" Unlink hugepage files after init\n"
" --"OPT_NO_HUGE" Use malloc instead of hugetlbfs\n"
@@ -82,6 +82,7 @@ struct internal_config {
rte_cpuset_t ctrl_cpuset; /**< cpuset for ctrl threads */
volatile unsigned int init_complete;
/**< indicates whether EAL has completed initialization */
+ unsigned int no_process_info; /**< true to disable Process Info */
};
extern struct internal_config internal_config; /**< Global EAL configuration. */
@@ -69,6 +69,8 @@ enum {
OPT_IOVA_MODE_NUM,
#define OPT_MATCH_ALLOCATIONS "match-allocations"
OPT_MATCH_ALLOCATIONS_NUM,
+#define OPT_NO_PROCESS_INFO "no-process-info"
+ OPT_NO_PROCESS_INFO_NUM,
OPT_LONG_MAX_NUM
};
@@ -84,5 +86,8 @@ int eal_check_common_options(struct internal_config *internal_cfg);
void eal_common_usage(void);
enum rte_proc_type_t eal_proc_type_detect(void);
int eal_plugins_init(void);
+int eal_save_args(int argc, char **argv);
+int handle_eal_info_request(const char *cmd, const char *params __rte_unused,
+ char *buffer, int buf_len);
#endif /* EAL_OPTIONS_H */
@@ -19,6 +19,7 @@ LDLIBS += -lexecinfo
LDLIBS += -lpthread
LDLIBS += -lgcc_s
LDLIBS += -lrte_kvargs
+LDLIBS += -lrte_process_info
EXPORT_MAP := ../../rte_eal_version.map
@@ -44,6 +44,7 @@
#include <rte_option.h>
#include <rte_atomic.h>
#include <malloc_heap.h>
+#include <rte_process_info.h>
#include "eal_private.h"
#include "eal_thread.h"
@@ -724,6 +725,9 @@ rte_eal_init(int argc, char **argv)
eal_reset_internal_config(&internal_config);
+ /* clone argv to report out later in telemetry */
+ eal_save_args(argc, argv);
+
/* set log level as early as possible */
eal_log_level_parse(argc, argv);
@@ -952,6 +956,16 @@ rte_eal_init(int argc, char **argv)
rte_eal_init_alert("Cannot clear runtime directory\n");
return -1;
}
+ if (!internal_config.no_process_info) {
+ const char *error_str;
+ if (rte_process_info_init(rte_eal_get_runtime_dir(),
+ &error_str) != 0) {
+ rte_eal_init_alert(error_str);
+ return -1;
+ }
+ rte_process_info_register("/eal:version",
+ handle_eal_info_request);
+ }
eal_mcfg_complete();
@@ -23,6 +23,7 @@ LDLIBS += -lpthread
LDLIBS += -lgcc_s
LDLIBS += -lrt
LDLIBS += -lrte_kvargs
+LDLIBS += -lrte_process_info
ifeq ($(CONFIG_RTE_EAL_NUMA_AWARE_HUGEPAGES),y)
LDLIBS += -lnuma
endif
@@ -50,6 +50,7 @@
#include <malloc_heap.h>
#include <rte_vfio.h>
#include <rte_option.h>
+#include <rte_process_info.h>
#include "eal_private.h"
#include "eal_thread.h"
@@ -987,6 +988,9 @@ rte_eal_init(int argc, char **argv)
eal_reset_internal_config(&internal_config);
+ /* clone argv to report out later in telemetry */
+ eal_save_args(argc, argv);
+
/* set log level as early as possible */
eal_log_level_parse(argc, argv);
@@ -1291,6 +1295,17 @@ rte_eal_init(int argc, char **argv)
return -1;
}
+ if (!internal_config.no_process_info) {
+ const char *error_str;
+ if (rte_process_info_init(rte_eal_get_runtime_dir(),
+ &error_str) != 0) {
+ rte_eal_init_alert(error_str);
+ return -1;
+ }
+ rte_process_info_register("/eal:version",
+ handle_eal_info_request);
+ }
+
eal_mcfg_complete();
/* Call each registered callback, if enabled */
@@ -13,7 +13,7 @@ dpdk_conf.set('RTE_EXEC_ENV_' + exec_env.to_upper(), 1)
subdir(exec_env + '/eal')
allow_experimental_apis = true
-deps += 'kvargs'
+deps += ['kvargs', 'process_info']
if dpdk_conf.has('RTE_USE_LIBBSD')
ext_deps += libbsd
endif