From: David Marchand <david.marchand@redhat.com>
To: Sunil Kumar Kori <skori@marvell.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
"thomas@monjalon.net" <thomas@monjalon.net>,
Jerin Jacob Kollanukkaran <jerinj@marvell.com>
Subject: Re: [dpdk-dev] [EXT] [PATCH 6/8] trace: remove limitation on patterns number
Date: Mon, 4 May 2020 16:14:04 +0200 [thread overview]
Message-ID: <CAJFAV8zL85OJ8CyyXwV4za7aa9C4Lag1m+iRO8dtvxq6WZ0vTA@mail.gmail.com> (raw)
In-Reply-To: <BY5PR18MB310518DDF6A39CF6B06E9739B4A60@BY5PR18MB3105.namprd18.prod.outlook.com>
On Mon, May 4, 2020 at 10:48 AM Sunil Kumar Kori <skori@marvell.com> wrote:
> >diff --git a/lib/librte_eal/common/eal_common_trace_utils.c
> >b/lib/librte_eal/common/eal_common_trace_utils.c
> >index 4077acf428..15384ce4f1 100644
> >--- a/lib/librte_eal/common/eal_common_trace_utils.c
> >+++ b/lib/librte_eal/common/eal_common_trace_utils.c
> >@@ -138,25 +138,20 @@ int
> > eal_trace_args_save(const char *val)
> > {
> > struct trace *trace = trace_obj_get();
> >- char *trace_args;
> >- uint8_t nb_args;
> >+ struct trace_arg *arg = malloc(sizeof(*arg));
> Won't "malloc(sizeof(struct trace_arg))" be more readable ?
ptr = malloc(sizeof(*ptr)); is more common in EAL code.
I prefer this form.
>
> >
> >- nb_args = trace->args.nb_args;
> >-
> >- if (nb_args >= TRACE_MAX_ARGS) {
> >- trace_err("ignoring trace %s as limit exceeds", val);
> >- return 0;
> >+ if (arg == NULL) {
> >+ trace_err("failed to allocate memory for %s", val);
> >+ return -ENOMEM;
> > }
> >
> >- trace_args = calloc(1, (strlen(val) + 1));
> >- if (trace_args == NULL) {
> >- trace_err("fail to allocate memory for %s", val);
> >+ arg->val = strdup(val);
> >+ if (arg->val == NULL) {
> >+ trace_err("failed to allocate memory for %s", val);
> "arg" needs to be freed here.
argh, indeed.
>
> > return -ENOMEM;
> > }
> >
> >- memcpy(trace_args, val, strlen(val));
> >- trace->args.args[nb_args++] = trace_args;
> >- trace->args.nb_args = nb_args;
> >+ STAILQ_INSERT_TAIL(&trace->args, arg, next);
> > return 0;
> > }
> >
> >diff --git a/lib/librte_eal/common/eal_trace.h
> >b/lib/librte_eal/common/eal_trace.h
> >index 7d95bd2aa9..943b5ecbc5 100644
> >--- a/lib/librte_eal/common/eal_trace.h
> >+++ b/lib/librte_eal/common/eal_trace.h
> >@@ -46,9 +46,9 @@ struct thread_mem_meta {
> > enum trace_area_e area;
> > };
> >
> >-struct trace_args {
> >- uint8_t nb_args;
> >- char *args[TRACE_MAX_ARGS];
> >+struct trace_arg {
> >+ STAILQ_ENTRY(trace_arg) next;
> >+ char *val;
> > };
> >
> > struct trace {
> >@@ -59,7 +59,7 @@ struct trace {
> > enum rte_trace_mode mode;
> > rte_uuid_t uuid;
> > uint32_t buff_len;
> >- struct trace_args args;
> >+ STAILQ_HEAD(trace_arg_head, trace_arg) args;
> "trace_arg_head" is not required. It can be removed.
Ack.
>
> > uint32_t nb_trace_points;
> > uint32_t nb_trace_mem_list;
> > struct thread_mem_meta *lcore_meta;
> >--
> >2.23.0
>
--
David Marchand
next prev parent reply other threads:[~2020-05-04 14:14 UTC|newest]
Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-03 20:31 [dpdk-dev] [PATCH 0/8] Traces cleanup for rc2 David Marchand
2020-05-03 20:31 ` [dpdk-dev] [PATCH 1/8] cryptodev: fix trace points registration David Marchand
2020-05-04 7:41 ` [dpdk-dev] [EXT] " Sunil Kumar Kori
2020-05-03 20:31 ` [dpdk-dev] [PATCH 2/8] trace: simplify trace point registration David Marchand
2020-05-04 2:46 ` Jerin Jacob
2020-05-04 14:02 ` Thomas Monjalon
2020-05-04 14:04 ` David Marchand
2020-05-04 14:39 ` Jerin Jacob
2020-05-04 17:08 ` David Marchand
2020-05-04 17:19 ` Jerin Jacob
2020-05-04 17:40 ` David Marchand
2020-05-04 17:54 ` Jerin Jacob
2020-05-04 21:31 ` Thomas Monjalon
2020-05-05 3:43 ` Jerin Jacob
2020-05-05 7:01 ` Thomas Monjalon
2020-05-05 7:17 ` Jerin Jacob
2020-05-05 7:24 ` Thomas Monjalon
2020-05-05 7:33 ` Jerin Jacob
2020-05-05 8:23 ` David Marchand
2020-05-05 10:12 ` Jerin Jacob
2020-05-05 10:26 ` Thomas Monjalon
2020-05-05 10:46 ` Jerin Jacob
2020-05-05 11:48 ` Olivier Matz
2020-05-05 11:35 ` David Marchand
2020-05-05 12:26 ` Jerin Jacob
2020-05-05 15:25 ` Jerin Jacob
2020-05-05 16:28 ` David Marchand
2020-05-05 16:46 ` Jerin Jacob
2020-05-05 16:58 ` Thomas Monjalon
2020-05-05 17:08 ` Jerin Jacob
2020-05-05 17:09 ` Jerin Jacob
2020-05-05 17:20 ` Thomas Monjalon
2020-05-05 17:28 ` Jerin Jacob
2020-05-05 20:10 ` Thomas Monjalon
2020-05-06 6:11 ` Jerin Jacob
2020-07-04 14:31 ` Jerin Jacob
2020-07-04 15:14 ` [dpdk-dev] [PATCH v2] " David Marchand
2020-07-05 19:41 ` Thomas Monjalon
2020-05-03 20:31 ` [dpdk-dev] [PATCH 3/8] trace: simplify trace point headers David Marchand
2020-05-04 6:12 ` Jerin Jacob
2020-05-03 20:31 ` [dpdk-dev] [PATCH 4/8] trace: avoid confusion on optarg David Marchand
2020-05-04 7:55 ` [dpdk-dev] [EXT] " Sunil Kumar Kori
2020-05-04 14:09 ` David Marchand
2020-05-05 5:45 ` Sunil Kumar Kori
2020-05-05 5:47 ` Sunil Kumar Kori
2020-05-03 20:31 ` [dpdk-dev] [PATCH 5/8] trace: remove unneeded checks in internal API David Marchand
2020-05-04 8:16 ` [dpdk-dev] [EXT] " Sunil Kumar Kori
2020-05-03 20:31 ` [dpdk-dev] [PATCH 6/8] trace: remove limitation on patterns number David Marchand
2020-05-04 8:48 ` [dpdk-dev] [EXT] " Sunil Kumar Kori
2020-05-04 14:14 ` David Marchand [this message]
2020-05-05 5:54 ` Sunil Kumar Kori
2020-05-03 20:31 ` [dpdk-dev] [PATCH 7/8] trace: remove string duplication David Marchand
2020-05-04 9:01 ` [dpdk-dev] [EXT] " Sunil Kumar Kori
2020-05-03 20:31 ` [dpdk-dev] [PATCH 8/8] trace: fix build with gcc 10 David Marchand
2020-05-06 13:06 ` [dpdk-dev] [PATCH 0/8] Traces cleanup for rc2 David Marchand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAJFAV8zL85OJ8CyyXwV4za7aa9C4Lag1m+iRO8dtvxq6WZ0vTA@mail.gmail.com \
--to=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=jerinj@marvell.com \
--cc=skori@marvell.com \
--cc=thomas@monjalon.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).