From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8D535A00BE; Mon, 4 May 2020 16:14:20 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2ED531D168; Mon, 4 May 2020 16:14:20 +0200 (CEST) Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by dpdk.org (Postfix) with ESMTP id 5E8D11D167 for ; Mon, 4 May 2020 16:14:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588601657; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ywAzrGpMic0kDYpSkOz7p34aokqjoGS0LNTOBS6+K64=; b=J5nfmlPg17Wq1q5kEak6Cg88y83STPE5KbCoVlrUyQ54XaGCVm2TpPo0L4FodRBhSJ3PdM v89b7MVMYVYcM/XwOrOTE+xCfsSorT5SP2VVKW02948eHyVn3Ga1ZX3kqPQVRtbppHzRgA egOrcKTutV5Qs0kt2QTTgpwP9cACLDM= Received: from mail-vs1-f71.google.com (mail-vs1-f71.google.com [209.85.217.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-261-M1t9aac_N4-w6CqV16D2eg-1; Mon, 04 May 2020 10:14:16 -0400 X-MC-Unique: M1t9aac_N4-w6CqV16D2eg-1 Received: by mail-vs1-f71.google.com with SMTP id w18so2538317vsw.9 for ; Mon, 04 May 2020 07:14:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=iz6Fy0LzrqQVqR7nkVbJ3di2ITMfXMi2h1Py45dPGmE=; b=d5lZQamSsyZzd69LFs6e2NtY4r3+fpkvDlMYCmL50UaZDQpOXDLVBvvq1I2pcrnE5E hPsI34vequ6KrQQ9zBw/j4wmKcaIPz8F3XUIhUEjJVEWarCdkv8MP3RRwSq7QY2gbTQ9 d1Sr4F6k1lSKKrFt6QfTQ7fHqa0avjIyJ/Qi8b3RcO+48VqOEGyFv42JvRfEEIk4hob3 aiQ2A/4eNojsU+MvI/Qw3Tkpabwrzt1RdnCsVWfSU4gkMUOTDj7VoozcIt/V8ajZTtvA VTXbVUHm2wXQfFDZy2R3bjncFaiBwphsW/gdg6FAWkkN3Ba7vOODZ5k2Cpnx1lUDFOHd 4gNg== X-Gm-Message-State: AGi0PuZnzMU8wKOJMQxB8kkZlJBuc97Ja6d/up2ouK5NIO3T7rK3IvXE pm1vVP0OW++4mSwD+TEyxEZK9suM7k5NY4gSKpa/zHVYi1pbLyYh+hwoCIjzXg4r+RvKxzJWKb0 AS5LYjeszVp114da8PpM= X-Received: by 2002:a67:d817:: with SMTP id e23mr12009527vsj.39.1588601655890; Mon, 04 May 2020 07:14:15 -0700 (PDT) X-Google-Smtp-Source: APiQypK0TK2FmmVubO2wJ1FtJxeYClE+Pjkd7YhTKXsDRQqRg/FpGOlXH/tOswsqucz+MgIOlwjPXvs/Yrd8UxEXfog= X-Received: by 2002:a67:d817:: with SMTP id e23mr12009501vsj.39.1588601655590; Mon, 04 May 2020 07:14:15 -0700 (PDT) MIME-Version: 1.0 References: <20200503203135.6493-1-david.marchand@redhat.com> <20200503203135.6493-7-david.marchand@redhat.com> In-Reply-To: From: David Marchand Date: Mon, 4 May 2020 16:14:04 +0200 Message-ID: To: Sunil Kumar Kori Cc: "dev@dpdk.org" , "thomas@monjalon.net" , Jerin Jacob Kollanukkaran X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [dpdk-dev] [EXT] [PATCH 6/8] trace: remove limitation on patterns number X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Mon, May 4, 2020 at 10:48 AM Sunil Kumar Kori 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 =3D trace_obj_get(); > >- char *trace_args; > >- uint8_t nb_args; > >+ struct trace_arg *arg =3D malloc(sizeof(*arg)); > Won't "malloc(sizeof(struct trace_arg))" be more readable ? ptr =3D malloc(sizeof(*ptr)); is more common in EAL code. I prefer this form. > > > > >- nb_args =3D trace->args.nb_args; > >- > >- if (nb_args >=3D TRACE_MAX_ARGS) { > >- trace_err("ignoring trace %s as limit exceeds", val); > >- return 0; > >+ if (arg =3D=3D NULL) { > >+ trace_err("failed to allocate memory for %s", val); > >+ return -ENOMEM; > > } > > > >- trace_args =3D calloc(1, (strlen(val) + 1)); > >- if (trace_args =3D=3D NULL) { > >- trace_err("fail to allocate memory for %s", val); > >+ arg->val =3D strdup(val); > >+ if (arg->val =3D=3D 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++] =3D trace_args; > >- trace->args.nb_args =3D 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 > --=20 David Marchand