DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jerin Jacob <jerinjacobk@gmail.com>
To: David Marchand <david.marchand@redhat.com>
Cc: dev@dpdk.org, jerinj@marvell.com, skori@marvell.com
Subject: Re: [PATCH v4 08/11] trace: remove limitation on trace point name
Date: Tue, 18 Oct 2022 19:06:10 +0530	[thread overview]
Message-ID: <CALBAE1OKziL90-fbmQNM1Nn5r8fGL1nykdBLdMvggE2UcUGEbg@mail.gmail.com> (raw)
In-Reply-To: <20221018132654.3760561-9-david.marchand@redhat.com>

On Tue, Oct 18, 2022 at 6:58 PM David Marchand
<david.marchand@redhat.com> wrote:
>
> The name of a trace point is provided as a constant string via the
> RTE_TRACE_POINT_REGISTER macro.
> We can rely on an explicit constant string in the binary and simply point
> at it.
> There is then no need for a (fixed size) copy.
>
> Signed-off-by: David Marchand <david.marchand@redhat.com>

Acked-by: Jerin Jacob <jerinj@marvell.com>


> ---
> Changes since v2:
> - stored trace point name in a static variable to make sure the string
>   is put in .data,
>
> ---
>  lib/eal/common/eal_common_trace.c          | 10 +++-------
>  lib/eal/common/eal_common_trace_utils.c    |  2 +-
>  lib/eal/common/eal_trace.h                 |  3 +--
>  lib/eal/include/rte_trace_point_register.h |  3 ++-
>  4 files changed, 7 insertions(+), 11 deletions(-)
>
> diff --git a/lib/eal/common/eal_common_trace.c b/lib/eal/common/eal_common_trace.c
> index ec168e37b3..5caaac8e59 100644
> --- a/lib/eal/common/eal_common_trace.c
> +++ b/lib/eal/common/eal_common_trace.c
> @@ -235,7 +235,7 @@ rte_trace_point_lookup(const char *name)
>                 return NULL;
>
>         STAILQ_FOREACH(tp, &tp_list, next)
> -               if (strncmp(tp->name, name, TRACE_POINT_NAME_SIZE) == 0)
> +               if (strcmp(tp->name, name) == 0)
>                         return tp->handle;
>
>         return NULL;
> @@ -492,10 +492,7 @@ __rte_trace_point_register(rte_trace_point_t *handle, const char *name,
>         }
>
>         /* Initialize the trace point */
> -       if (rte_strscpy(tp->name, name, TRACE_POINT_NAME_SIZE) < 0) {
> -               trace_err("name is too long");
> -               goto free;
> -       }
> +       tp->name = name;
>
>         /* Copy the accumulated fields description and clear it for the next
>          * trace point.
> @@ -517,8 +514,7 @@ __rte_trace_point_register(rte_trace_point_t *handle, const char *name,
>
>         /* All Good !!! */
>         return 0;
> -free:
> -       free(tp);
> +
>  fail:
>         if (trace.register_errno == 0)
>                 trace.register_errno = rte_errno;
> diff --git a/lib/eal/common/eal_common_trace_utils.c b/lib/eal/common/eal_common_trace_utils.c
> index 7bf1c05e12..72108d36a6 100644
> --- a/lib/eal/common/eal_common_trace_utils.c
> +++ b/lib/eal/common/eal_common_trace_utils.c
> @@ -42,7 +42,7 @@ trace_entry_compare(const char *name)
>         int count = 0;
>
>         STAILQ_FOREACH(tp, tp_list, next) {
> -               if (strncmp(tp->name, name, TRACE_POINT_NAME_SIZE) == 0)
> +               if (strcmp(tp->name, name) == 0)
>                         count++;
>                 if (count > 1) {
>                         trace_err("found duplicate entry %s", name);
> diff --git a/lib/eal/common/eal_trace.h b/lib/eal/common/eal_trace.h
> index 72a5a461ae..26a18a2c48 100644
> --- a/lib/eal/common/eal_trace.h
> +++ b/lib/eal/common/eal_trace.h
> @@ -24,14 +24,13 @@
>
>  #define TRACE_PREFIX_LEN 12
>  #define TRACE_DIR_STR_LEN (sizeof("YYYY-mm-dd-AM-HH-MM-SS") + TRACE_PREFIX_LEN)
> -#define TRACE_POINT_NAME_SIZE 64
>  #define TRACE_CTF_MAGIC 0xC1FC1FC1
>  #define TRACE_MAX_ARGS 32
>
>  struct trace_point {
>         STAILQ_ENTRY(trace_point) next;
>         rte_trace_point_t *handle;
> -       char name[TRACE_POINT_NAME_SIZE];
> +       const char *name;
>         char *ctf_field;
>  };
>
> diff --git a/lib/eal/include/rte_trace_point_register.h b/lib/eal/include/rte_trace_point_register.h
> index 2e61439940..a32f4d731b 100644
> --- a/lib/eal/include/rte_trace_point_register.h
> +++ b/lib/eal/include/rte_trace_point_register.h
> @@ -20,9 +20,10 @@ RTE_DECLARE_PER_LCORE(volatile int, trace_point_sz);
>
>  #define RTE_TRACE_POINT_REGISTER(trace, name) \
>  rte_trace_point_t __attribute__((section("__rte_trace_point"))) __##trace; \
> +static const char __##trace##_name[] = RTE_STR(name); \
>  RTE_INIT(trace##_init) \
>  { \
> -       __rte_trace_point_register(&__##trace, RTE_STR(name), \
> +       __rte_trace_point_register(&__##trace, __##trace##_name, \
>                 (void (*)(void)) trace); \
>  }
>
> --
> 2.37.3
>

  reply	other threads:[~2022-10-18 13:36 UTC|newest]

Thread overview: 74+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-21 12:03 [PATCH 0/8] Trace subsystem fixes David Marchand
2022-09-21 12:03 ` [PATCH 1/8] trace: fix mode for new trace point David Marchand
2022-09-21 12:03 ` [PATCH 2/8] trace: fix mode change David Marchand
2022-09-21 12:03 ` [PATCH 3/8] trace: fix leak with regexp David Marchand
2022-09-22 11:00   ` [EXT] " Sunil Kumar Kori
2022-09-23  6:35     ` David Marchand
2022-09-23  7:37       ` Sunil Kumar Kori
2022-09-21 12:03 ` [PATCH 4/8] trace: fix dynamically enabling trace points David Marchand
2022-09-22 11:18   ` [EXT] " Sunil Kumar Kori
2022-09-23  6:36     ` David Marchand
2022-09-21 12:03 ` [PATCH 5/8] trace: fix race in debug dump David Marchand
2022-10-11 14:37   ` Jerin Jacob
2022-09-21 12:03 ` [PATCH 6/8] trace: fix metadata dump David Marchand
2022-09-21 12:03 ` [PATCH 7/8] trace: remove limitation on trace point name David Marchand
2022-10-11 14:49   ` Jerin Jacob
2022-10-12  7:48     ` David Marchand
2022-10-12  9:41       ` Jerin Jacob
2022-09-21 12:03 ` [PATCH 8/8] trace: remove limitation on directory David Marchand
2022-10-11 15:05   ` Jerin Jacob
2022-10-04  9:44 ` [PATCH v2 0/9] Trace subsystem fixes David Marchand
2022-10-04  9:44   ` [PATCH v2 1/9] trace: fix mode for new trace point David Marchand
2022-10-11 14:16     ` Jerin Jacob
2022-10-12  9:05     ` [EXT] " Sunil Kumar Kori
2022-10-04  9:44   ` [PATCH v2 2/9] trace: fix mode change David Marchand
2022-10-11 14:20     ` Jerin Jacob
2022-10-12  9:07     ` [EXT] " Sunil Kumar Kori
2022-10-04  9:44   ` [PATCH v2 3/9] trace: fix leak with regexp David Marchand
2022-10-11 14:21     ` Jerin Jacob
2022-10-12  9:10     ` [EXT] " Sunil Kumar Kori
2022-10-04  9:44   ` [PATCH v2 4/9] trace: rework loop on trace points David Marchand
2022-10-11 14:21     ` Jerin Jacob
2022-10-12  9:13     ` [EXT] " Sunil Kumar Kori
2022-10-04  9:44   ` [PATCH v2 5/9] trace: fix dynamically enabling " David Marchand
2022-10-12  9:23     ` [EXT] " Sunil Kumar Kori
2022-10-12  9:57       ` David Marchand
2022-10-12 10:15         ` Sunil Kumar Kori
2022-10-04  9:44   ` [PATCH v2 6/9] trace: fix race in debug dump David Marchand
2022-10-12  9:25     ` [EXT] " Sunil Kumar Kori
2022-10-04  9:44   ` [PATCH v2 7/9] trace: fix metadata dump David Marchand
2022-10-12  9:28     ` [EXT] " Sunil Kumar Kori
2022-10-04  9:44   ` [PATCH v2 8/9] trace: remove limitation on trace point name David Marchand
2022-10-04  9:44   ` [PATCH v2 9/9] trace: remove limitation on directory David Marchand
2022-10-12  9:32     ` [EXT] " Sunil Kumar Kori
2022-10-12 12:31 ` [PATCH v3 0/9] Trace subsystem fixes David Marchand
2022-10-12 12:31   ` [PATCH v3 1/9] trace: fix mode for new trace point David Marchand
2022-10-12 12:31   ` [PATCH v3 2/9] trace: fix mode change David Marchand
2022-10-12 12:31   ` [PATCH v3 3/9] trace: fix leak with regexp David Marchand
2022-10-12 12:31   ` [PATCH v3 4/9] trace: rework loop on trace points David Marchand
2022-10-12 12:31   ` [PATCH v3 5/9] trace: fix dynamically enabling " David Marchand
2022-10-13 14:53     ` [EXT] " Harman Kalra
2022-10-13 15:51       ` David Marchand
2022-10-13 17:07         ` Harman Kalra
2022-10-13 19:10           ` David Marchand
2022-10-14  4:26             ` Jerin Jacob
2022-10-14  8:19               ` David Marchand
2022-10-14  8:37                 ` Jerin Jacob
2022-10-12 12:31   ` [PATCH v3 6/9] trace: fix race in debug dump David Marchand
2022-10-12 12:31   ` [PATCH v3 7/9] trace: fix metadata dump David Marchand
2022-10-12 12:31   ` [PATCH v3 8/9] trace: remove limitation on trace point name David Marchand
2022-10-12 12:31   ` [PATCH v3 9/9] trace: remove limitation on directory David Marchand
2022-10-18 13:26 ` [PATCH v4 00/11] Trace subsystem fixes and more David Marchand
2022-10-18 13:26   ` [PATCH v4 01/11] trace: fix mode for new trace point David Marchand
2022-10-18 13:26   ` [PATCH v4 02/11] trace: fix mode change David Marchand
2022-10-18 13:26   ` [PATCH v4 03/11] trace: fix leak with regexp David Marchand
2022-10-18 13:26   ` [PATCH v4 04/11] trace: rework loop on trace points David Marchand
2022-10-18 13:26   ` [PATCH v4 05/11] trace: fix dynamically enabling " David Marchand
2022-10-18 13:26   ` [PATCH v4 06/11] trace: fix race in debug dump David Marchand
2022-10-18 13:26   ` [PATCH v4 07/11] trace: fix metadata dump David Marchand
2022-10-18 13:26   ` [PATCH v4 08/11] trace: remove limitation on trace point name David Marchand
2022-10-18 13:36     ` Jerin Jacob [this message]
2022-10-18 13:26   ` [PATCH v4 09/11] trace: remove limitation on directory David Marchand
2022-10-18 13:26   ` [PATCH v4 10/11] trace: create new directory for each trace dump David Marchand
2022-10-18 13:26   ` [PATCH v4 11/11] trace: enable trace operations via telemetry David Marchand
2022-10-20 11:51   ` [PATCH v4 00/11] Trace subsystem fixes and more 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=CALBAE1OKziL90-fbmQNM1Nn5r8fGL1nykdBLdMvggE2UcUGEbg@mail.gmail.com \
    --to=jerinjacobk@gmail.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=jerinj@marvell.com \
    --cc=skori@marvell.com \
    /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).