telemetry: fix error and warning printfs
PATCH 1/1 telemetry: fix error and warning printfs
Initially, printf was used to indicate and error/warning resulting from telemetry initialisation. This is now fixed to use EAL logs for warnings, and the unnecessary printf for an error is removed.
--- lib/librte_eal/freebsd/eal.c | 4 +++- lib/librte_eal/linux/eal.c | 4 +++- lib/librte_telemetry/rte_telemetry.h | 9 +++++++++ lib/librte_telemetry/telemetry.c | 2 -- 4 files changed, 15 insertions(+), 4 deletions(-)
lib/librte_eal/freebsd/eal.c +3 -1
@@ -956,13 +956,15 @@ rte_eal_init(int argc, char **argv)return -1 ; }if (!internal_config.no_telemetry) { -const char *error_str; +const char *error_str =NULL ;if (rte_telemetry_init (rte_eal_get_runtime_dir (), &internal_config.ctrl_cpuset, &error_str) !=0 ) {rte_eal_init_alert (error_str);return -1 ; } +if (error_str !=NULL ) +RTE_LOG (WARNING ,EAL ,"%s\n" , error_str); }eal_mcfg_complete ();
lib/librte_eal/linux/eal.c +3 -1
@@ -1294,13 +1294,15 @@ rte_eal_init(int argc, char **argv)return -1 ; }if (!internal_config.no_telemetry) { -const char *error_str; +const char *error_str =NULL ;if (rte_telemetry_init (rte_eal_get_runtime_dir (), &internal_config.ctrl_cpuset, &error_str) !=0 ) {rte_eal_init_alert (error_str);return -1 ; } +if (error_str !=NULL ) +RTE_LOG (WARNING ,EAL ,"%s\n" , error_str); }eal_mcfg_complete ();
lib/librte_telemetry/rte_telemetry.h +9 -0
@@ -241,8 +241,17 @@ int rte_telemetry_register_cmd(const char *cmd, telemetry_cb fn, const char *help);/** +* @internal * Initialize Telemetry. * +* @param runtime_dir +* The runtime directory of DPDK. +* @param cpuset +* The CPU set to be used for setting the thread affinity. +* @param err_str +* This err_str pointer should point to NULL on entry. In the case of an error +* or warning, it will be non-NULL on exit. +* * @return * 0 on success. * @return
lib/librte_telemetry/telemetry.c +0 -2
@@ -403,12 +403,10 @@ rte_telemetry_init(const char *runtime_dir, rte_cpuset_t *cpuset, {if (telemetry_v2_init (runtime_dir, cpuset) !=0 ) { *err_str = telemetry_log_error; -printf ("Error initialising telemetry - %s\n" , *err_str);return -1 ; }if (telemetry_legacy_init (runtime_dir, cpuset) !=0 ) { *err_str = telemetry_log_error; -printf ("No telemetry legacy support - %s\n" , *err_str); }return 0 ; }
Signature · 1 line
2.17.1
Quoted 9 lines · Ciara Power
Initially, printf was used to indicate and error/warning resulting from telemetry initialisation. This is now fixed to use EAL logs for warnings, and the unnecessary printf for an error is removed.
Fixes eeb486f3ba65 ("eal: add telemetry as dependency")Fixes dd6275a424ac ("telemetry: fix error log output")Signed-off-by Ciara Power <[email protected]>
Quoted 46 lines · Ciara Power
Initially, printf was used to indicate and error/warning resulting from telemetry initialisation. This is now fixed to use EAL logs for warnings, and the unnecessary printf for an error is removed.
Fixes eeb486f3ba65 ("eal: add telemetry as dependency")Fixes dd6275a424ac ("telemetry: fix error log output")Signed-off-by Ciara Power <[email protected]>--- lib/librte_eal/freebsd/eal.c | 4 +++- lib/librte_eal/linux/eal.c | 4 +++- lib/librte_telemetry/rte_telemetry.h | 9 +++++++++ lib/librte_telemetry/telemetry.c | 2 -- 4 files changed, 15 insertions(+), 4 deletions(-)lib/librte_eal/freebsd/eal.c +3
-1@@ -956,13 +956,15 @@ rte_eal_init(int argc, char **argv)return -1 ; }if (!internal_config.no_telemetry) { -const char *error_str; +const char *error_str =NULL ;if (rte_telemetry_init (rte_eal_get_runtime_dir (), &internal_config.ctrl_cpuset, &error_str) !=0 ) {rte_eal_init_alert (error_str);return -1 ; } +if (error_str !=NULL ) +RTE_LOG (WARNING ,EAL ,"%s\n" , error_str); }eal_mcfg_complete ();lib/librte_eal/linux/eal.c +0
-0@@ -1294,13 +1294,15 @@ rte_eal_init(int argc, char **argv)return -1 ; }if (!internal_config.no_telemetry) {
lib/librte_eal/linux/eal.c rte_eal_init(int argc, char **argv) · line 1305
Quoted 10 lines
lib/librte_eal/linux/eal.c +3
-1-const char *error_str; +const char *error_str =NULL ;if (rte_telemetry_init (rte_eal_get_runtime_dir (), &internal_config.ctrl_cpuset, &error_str) !=0 ) {rte_eal_init_alert (error_str);return -1 ; } +if (error_str !=NULL ) +RTE_LOG (WARNING ,EAL ,"%s\n" , error_str);
"EAL: No legacy callbacks, legacy socket not created" comes all the times now. Should we treat this as a warning? as it comes for with for the built-in applications?
If it is important why not have a default handler in the EAL library?
Quoted 45 lines
lib/librte_eal/linux/eal.c +0
-0}eal_mcfg_complete ();lib/librte_telemetry/rte_telemetry.h +9
-0@@ -241,8 +241,17 @@ int rte_telemetry_register_cmd(const char *cmd, telemetry_cb fn, const char *help);/** +* @internal * Initialize Telemetry. * +* @param runtime_dir +* The runtime directory of DPDK. +* @param cpuset +* The CPU set to be used for setting the thread affinity. +* @param err_str +* This err_str pointer should point to NULL on entry. In the case of an error +* or warning, it will be non-NULL on exit. +* * @return * 0 on success. * @return lib/librte_telemetry/telemetry.c +0
-3@@ -403,12 +403,10 @@ rte_telemetry_init(const char *runtime_dir, rte_cpuset_t *cpuset, {if (telemetry_v2_init (runtime_dir, cpuset) !=0 ) { *err_str = telemetry_log_error; -printf ("Error initialising telemetry - %s\n" , *err_str);return -1 ; }if (telemetry_legacy_init (runtime_dir, cpuset) !=0 ) { *err_str = telemetry_log_error; -printf ("No telemetry legacy support - %s\n" , *err_str); }return 0 ; } --2.17.1
Quoted 54 lines · Jerin Jacob
Quoted 53 lines · Ciara Power
Initially, printf was used to indicate and error/warning resulting from telemetry initialisation. This is now fixed to use EAL logs for warnings, and the unnecessary printf for an error is removed.
Fixes eeb486f3ba65 ("eal: add telemetry as dependency")Fixes dd6275a424ac ("telemetry: fix error log output")Signed-off-by Ciara Power <[email protected]>--- lib/librte_eal/freebsd/eal.c | 4 +++- lib/librte_eal/linux/eal.c | 4 +++- lib/librte_telemetry/rte_telemetry.h | 9 +++++++++ lib/librte_telemetry/telemetry.c | 2 -- 4 files changed, 15 insertions(+), 4 deletions(-)lib/librte_eal/freebsd/eal.c +3
-1@@ -956,13 +956,15 @@ rte_eal_init(int argc, char **argv)return -1 ; }if (!internal_config.no_telemetry) { -const char *error_str; +const char *error_str =NULL ;if (rte_telemetry_init (rte_eal_get_runtime_dir (), &internal_config.ctrl_cpuset, &error_str) !=0 ) {rte_eal_init_alert (error_str);return -1 ; } +if (error_str !=NULL ) +RTE_LOG (WARNING ,EAL ,"%s\n" , error_str); }eal_mcfg_complete ();lib/librte_eal/linux/eal.c +1
-1@@ -1294,13 +1294,15 @@ rte_eal_init(int argc, char **argv)return -1 ; }if (!internal_config.no_telemetry) { -const char *error_str; +const char *error_str =NULL ;if (rte_telemetry_init (rte_eal_get_runtime_dir (), &internal_config.ctrl_cpuset, &error_str) !=0 ) {rte_eal_init_alert (error_str);return -1 ;
Quoted 9 lines
lib/librte_eal/linux/eal.c rte_eal_init(int argc, char **argv) · line 1305
Quoted 3 lines
lib/librte_eal/linux/eal.c +2
-0} +if (error_str !=NULL ) +RTE_LOG (WARNING ,EAL ,"%s\n" , error_str);"EAL: No legacy callbacks, legacy socket not created" comes all the times now. Should we treat this as a warning? as it comes for with for the built-in applications?
If it is important why not have a default handler in the EAL library?
Perhaps the warning level could be changed to INFO.
BTW: if you compile with jansson library available, the legacy callbacks will be available and this will be silenced.
/Bruce
Quoted 65 lines · Bruce Richardson
Quoted 54 lines · Jerin Jacob
Quoted 53 lines · Ciara Power
Initially, printf was used to indicate and error/warning resulting from telemetry initialisation. This is now fixed to use EAL logs for warnings, and the unnecessary printf for an error is removed.
Fixes eeb486f3ba65 ("eal: add telemetry as dependency")Fixes dd6275a424ac ("telemetry: fix error log output")Signed-off-by Ciara Power <[email protected]>--- lib/librte_eal/freebsd/eal.c | 4 +++- lib/librte_eal/linux/eal.c | 4 +++- lib/librte_telemetry/rte_telemetry.h | 9 +++++++++ lib/librte_telemetry/telemetry.c | 2 -- 4 files changed, 15 insertions(+), 4 deletions(-)lib/librte_eal/freebsd/eal.c +3
-1@@ -956,13 +956,15 @@ rte_eal_init(int argc, char **argv)return -1 ; }if (!internal_config.no_telemetry) { -const char *error_str; +const char *error_str =NULL ;if (rte_telemetry_init (rte_eal_get_runtime_dir (), &internal_config.ctrl_cpuset, &error_str) !=0 ) {rte_eal_init_alert (error_str);return -1 ; } +if (error_str !=NULL ) +RTE_LOG (WARNING ,EAL ,"%s\n" , error_str); }eal_mcfg_complete ();lib/librte_eal/linux/eal.c +1
-1@@ -1294,13 +1294,15 @@ rte_eal_init(int argc, char **argv)return -1 ; }if (!internal_config.no_telemetry) { -const char *error_str; +const char *error_str =NULL ;if (rte_telemetry_init (rte_eal_get_runtime_dir (), &internal_config.ctrl_cpuset, &error_str) !=0 ) {rte_eal_init_alert (error_str);return -1 ;Quoted 9 lines
lib/librte_eal/linux/eal.c rte_eal_init(int argc, char **argv) · line 1305
Quoted 3 lines
lib/librte_eal/linux/eal.c +2
-0} +if (error_str !=NULL ) +RTE_LOG (WARNING ,EAL ,"%s\n" , error_str);"EAL: No legacy callbacks, legacy socket not created" comes all the times now. Should we treat this as a warning? as it comes for with for the built-in applications?
If it is important why not have a default handler in the EAL library?
Quoted 1 line
Perhaps the warning level could be changed to INFO.
OK.
Quoted 2 lines
BTW: if you compile with jansson library available, the legacy callbacks will be available and this will be silenced.
I see.
Quoted 2 lines
/Bruce
22/05/2020 18:48, Bruce Richardson:
Quoted 23 lines · Jerin Jacob
Quoted 10 lines · Ciara Power
Quoted 9 lines
Initially, printf was used to indicate and error/warning resulting from telemetry initialisation. This is now fixed to use EAL logs for warnings, and the unnecessary printf for an error is removed.
Fixes eeb486f3ba65 ("eal: add telemetry as dependency")Fixes dd6275a424ac ("telemetry: fix error log output")Quoted 11 lines
lib/librte_eal/linux/eal.c
Quoted 6 lines
Signed-off-by Ciara Power <[email protected]>---
lib/librte_eal/linux/eal.c +2
-0+if (error_str !=NULL ) +RTE_LOG (WARNING ,EAL ,"%s\n" , error_str);"EAL: No legacy callbacks, legacy socket not created" comes all the times now. Should we treat this as a warning? as it comes for with for the built-in applications?
If it is important why not have a default handler in the EAL library?
Quoted 3 lines
Perhaps the warning level could be changed to INFO.
BTW: if you compile with jansson library available, the legacy callbacks will be available and this will be silenced.
Applied with log level set as NOTICE.
Quoted 24 lines · Thomas Monjalon
22/05/2020 18:48, Bruce Richardson:
Quoted 23 lines · Jerin Jacob
Quoted 21 lines · Ciara Power
Quoted 13 lines
Initially, printf was used to indicate and error/warning resulting from telemetry initialisation. This is now fixed to use EAL logs for warnings, and the unnecessary printf for an error is removed.
Fixes eeb486f3ba65 ("eal: add telemetry as dependency")Fixes dd6275a424ac ("telemetry: fix error log output")Signed-off-by Ciara Power <[email protected]>---
lib/librte_eal/linux/eal.c
Quoted 2 lines
lib/librte_eal/linux/eal.c +2
-0+if (error_str !=NULL ) +RTE_LOG (WARNING ,EAL ,"%s\n" , error_str);"EAL: No legacy callbacks, legacy socket not created" comes all the times now. Should we treat this as a warning? as it comes for with for the built-in applications?
If it is important why not have a default handler in the EAL library?
Quoted 6 lines
Quoted 3 lines
Perhaps the warning level could be changed to INFO.
BTW: if you compile with jansson library available, the legacy callbacks will be available and this will be silenced.Applied with log level set as NOTICE.
Thanks.