* [dpdk-dev] [PATCH] eal: fix telemetry logtype registration
@ 2021-04-06 9:25 David Marchand
2021-04-06 10:18 ` Bruce Richardson
0 siblings, 1 reply; 4+ messages in thread
From: David Marchand @ 2021-04-06 9:25 UTC (permalink / raw)
To: dev; +Cc: Bruce Richardson, Ciara Power
rte_log_register_type_and_pick_level() returns an int.
Casting to a uin32_t will make us miss the -1 passed in case of failure.
Fixes: 37b881a96194 ("telemetry: use log function from pointer")
Signed-off-by: David Marchand <david.marchand@redhat.com>
---
lib/librte_eal/freebsd/eal.c | 4 +++-
lib/librte_eal/linux/eal.c | 4 +++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/lib/librte_eal/freebsd/eal.c b/lib/librte_eal/freebsd/eal.c
index 32442e5ba6..5544701f20 100644
--- a/lib/librte_eal/freebsd/eal.c
+++ b/lib/librte_eal/freebsd/eal.c
@@ -941,8 +941,10 @@ rte_eal_init(int argc, char **argv)
return -1;
}
if (!internal_conf->no_telemetry) {
- uint32_t tlog = rte_log_register_type_and_pick_level(
+ int tlog = rte_log_register_type_and_pick_level(
"lib.telemetry", RTE_LOG_WARNING);
+ if (tlog < 0)
+ tlog = RTE_LOGTYPE_EAL;
if (rte_telemetry_init(rte_eal_get_runtime_dir(),
rte_version(),
&internal_conf->ctrl_cpuset, rte_log, tlog) != 0)
diff --git a/lib/librte_eal/linux/eal.c b/lib/librte_eal/linux/eal.c
index abbb537746..9b47fef6f8 100644
--- a/lib/librte_eal/linux/eal.c
+++ b/lib/librte_eal/linux/eal.c
@@ -1314,8 +1314,10 @@ rte_eal_init(int argc, char **argv)
return -1;
}
if (!internal_conf->no_telemetry) {
- uint32_t tlog = rte_log_register_type_and_pick_level(
+ int tlog = rte_log_register_type_and_pick_level(
"lib.telemetry", RTE_LOG_WARNING);
+ if (tlog < 0)
+ tlog = RTE_LOGTYPE_EAL;
if (rte_telemetry_init(rte_eal_get_runtime_dir(),
rte_version(),
&internal_conf->ctrl_cpuset, rte_log, tlog) != 0)
--
2.23.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-dev] [PATCH] eal: fix telemetry logtype registration
2021-04-06 9:25 [dpdk-dev] [PATCH] eal: fix telemetry logtype registration David Marchand
@ 2021-04-06 10:18 ` Bruce Richardson
2021-04-06 10:36 ` Thomas Monjalon
2021-04-08 16:41 ` David Marchand
0 siblings, 2 replies; 4+ messages in thread
From: Bruce Richardson @ 2021-04-06 10:18 UTC (permalink / raw)
To: David Marchand; +Cc: dev, Ciara Power
On Tue, Apr 06, 2021 at 11:25:45AM +0200, David Marchand wrote:
> rte_log_register_type_and_pick_level() returns an int.
> Casting to a uin32_t will make us miss the -1 passed in case of failure.
>
> Fixes: 37b881a96194 ("telemetry: use log function from pointer")
>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-dev] [PATCH] eal: fix telemetry logtype registration
2021-04-06 10:18 ` Bruce Richardson
@ 2021-04-06 10:36 ` Thomas Monjalon
2021-04-08 16:41 ` David Marchand
1 sibling, 0 replies; 4+ messages in thread
From: Thomas Monjalon @ 2021-04-06 10:36 UTC (permalink / raw)
To: David Marchand; +Cc: dev, Ciara Power, Bruce Richardson
06/04/2021 12:18, Bruce Richardson:
> On Tue, Apr 06, 2021 at 11:25:45AM +0200, David Marchand wrote:
> > rte_log_register_type_and_pick_level() returns an int.
> > Casting to a uin32_t will make us miss the -1 passed in case of failure.
> >
> > Fixes: 37b881a96194 ("telemetry: use log function from pointer")
> >
> > Signed-off-by: David Marchand <david.marchand@redhat.com>
> > ---
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Good catch, I missed it when doing the patch
"log: choose EAL log type on registration failure"
https://patches.dpdk.org/project/dpdk/patch/20210405100301.657768-2-thomas@monjalon.net/
About the title, I would not say it fixes the registration.
It is more about catching registration failure with a fallback.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-dev] [PATCH] eal: fix telemetry logtype registration
2021-04-06 10:18 ` Bruce Richardson
2021-04-06 10:36 ` Thomas Monjalon
@ 2021-04-08 16:41 ` David Marchand
1 sibling, 0 replies; 4+ messages in thread
From: David Marchand @ 2021-04-08 16:41 UTC (permalink / raw)
To: dev; +Cc: Ciara Power, Bruce Richardson, Thomas Monjalon
On Tue, Apr 6, 2021 at 12:18 PM Bruce Richardson
<bruce.richardson@intel.com> wrote:
>
> On Tue, Apr 06, 2021 at 11:25:45AM +0200, David Marchand wrote:
> > rte_log_register_type_and_pick_level() returns an int.
> > Casting to a uin32_t will make us miss the -1 passed in case of failure.
> >
> > Fixes: 37b881a96194 ("telemetry: use log function from pointer")
> >
> > Signed-off-by: David Marchand <david.marchand@redhat.com>
> > ---
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
>
Applied, thanks.
--
David Marchand
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-04-08 16:41 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-06 9:25 [dpdk-dev] [PATCH] eal: fix telemetry logtype registration David Marchand
2021-04-06 10:18 ` Bruce Richardson
2021-04-06 10:36 ` Thomas Monjalon
2021-04-08 16:41 ` David Marchand
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).