From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id AD172A0588;
	Thu, 16 Apr 2020 15:40:40 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 97CCF1DCE5;
	Thu, 16 Apr 2020 15:40:40 +0200 (CEST)
Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com
 [205.139.110.61]) by dpdk.org (Postfix) with ESMTP id 27ED91DCE0
 for <dev@dpdk.org>; Thu, 16 Apr 2020 15:40:39 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
 s=mimecast20190719; t=1587044438;
 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=NokdybV1ag/y8mcOwBBjI/TRzG/hjm9BoSICSz1hhaE=;
 b=JiUtIJT56FVfM8t5pFXJYV0Y0tJPFScOOYLOSI2amZSV0mxQPXV7npxR7/8uP6sXvGfiQu
 Runl0OQ9R4imMRfB9OH16uKtOR6D0ic9P21d1/6PPXjPFAViwgSsiHr469mWpYWkuD3ESi
 1h9altxae1tdJ5b1A4iJiTGoclWpSJE=
Received: from mail-vk1-f200.google.com (mail-vk1-f200.google.com
 [209.85.221.200]) (Using TLS) by relay.mimecast.com with ESMTP id
 us-mta-504-WGPrZHwvPseK3A5irP_hXA-1; Thu, 16 Apr 2020 09:40:37 -0400
X-MC-Unique: WGPrZHwvPseK3A5irP_hXA-1
Received: by mail-vk1-f200.google.com with SMTP id s62so3240481vks.7
 for <dev@dpdk.org>; Thu, 16 Apr 2020 06:40:37 -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=K7CivOZKGv5BeRnxkUqzFAi/C7PLaiS0mwjzD0Sj/G8=;
 b=sOg7a/ucAG1E4b5BKLlsBow2Onil2FNziM7aSbP77RiDPA9wtxhQeYTTn/tpUX2Ole
 Kht1vdqhwFnY9GoUVmdAY41AHo5J+EUZriG16W8l7GxtNdO0DMc+gpa3rf3sG1uEAQOG
 Wjtf9ImsrvCb+edvHGUQLlSCZlqMEpiUwfS+S+tZ7Rp/zxY8WEloAlF4xBzFaHRQ+2Z6
 jGvF+d+73tjXnFxzPxXB1h3iMxc9HBsTTgAAEARm1UPfWp6g2o/BnCaPvo2PRq/o51UE
 P1rIn/8Yh5mMQPvxkJnipIh/CxyAkrdo8AiuXYHWubNKs1XRiobruwYcp7leJmC1ht2+
 pZig==
X-Gm-Message-State: AGi0PuaWsMjV91EUCOlQMru4IurXjYX7/cD9QveSlQobwRFCLuXXkrEm
 rxDlI7mMxD2xt+GyVicNOwi7OEC8NTrm3Q7+B627mqNIGyUxRo6EkE/XilmRJkD5i1MOUFyzZaM
 XHzwdEoM6vdtpi8+3iz4=
X-Received: by 2002:a1f:aa4f:: with SMTP id t76mr23001234vke.18.1587044436897; 
 Thu, 16 Apr 2020 06:40:36 -0700 (PDT)
X-Google-Smtp-Source: APiQypIoWON3PcUtZpzdB4HN6ePDlO6pJ6Afum3QL+KUUUOpBcYwZnlOHHGFjKGeP++10AU6F0ytda43l1cwLlihjWY=
X-Received: by 2002:a1f:aa4f:: with SMTP id t76mr23001210vke.18.1587044436581; 
 Thu, 16 Apr 2020 06:40:36 -0700 (PDT)
MIME-Version: 1.0
References: <20200403153709.3703448-1-jerinj@marvell.com>
 <20200413150116.734047-1-jerinj@marvell.com>
 <20200413150116.734047-14-jerinj@marvell.com>
In-Reply-To: <20200413150116.734047-14-jerinj@marvell.com>
From: David Marchand <david.marchand@redhat.com>
Date: Thu, 16 Apr 2020 15:40:24 +0200
Message-ID: <CAJFAV8ztrTFGy5WC07c+dU+7YukehQHSY+BLfrjr38TG_fOzkQ@mail.gmail.com>
To: Jerin Jacob Kollanukkaran <jerinj@marvell.com>
Cc: Sunil Kumar Kori <skori@marvell.com>, dev <dev@dpdk.org>, 
 Thomas Monjalon <thomas@monjalon.net>,
 Bruce Richardson <bruce.richardson@intel.com>, 
 =?UTF-8?Q?Mattias_R=C3=B6nnblom?= <mattias.ronnblom@ericsson.com>
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] [PATCH v5 13/33] eal/trace: implement registration
	payload
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

On Mon, Apr 13, 2020 at 5:02 PM <jerinj@marvell.com> wrote:
> diff --git a/lib/librte_eal/common/eal_common_trace.c b/lib/librte_eal/co=
mmon/eal_common_trace.c
> index 8181c0f02..906e2d706 100644
> --- a/lib/librte_eal/common/eal_common_trace.c
> +++ b/lib/librte_eal/common/eal_common_trace.c
> @@ -403,6 +403,25 @@ trace_mem_per_thread_free(void)
>         rte_spinlock_unlock(&trace->lock);
>  }
>
> +void
> +__rte_trace_emit_ctf_field(size_t sz, const char *in, const char *dataty=
pe)
> +{
> +       char *field =3D RTE_PER_LCORE(ctf_field);
> +       int count =3D RTE_PER_LCORE(ctf_count);
> +       int rc;
> +
> +       RTE_PER_LCORE(trace_point_sz) +=3D sz;
> +       rc =3D snprintf(RTE_PTR_ADD(field, count),
> +                     RTE_MAX(0, TRACE_CTF_FIELD_SIZE - 1 - count),
> +                     "%s %s;", datatype, in);

rc <=3D 0 does not check if a truncation happened.

> +       if (rc <=3D 0) {
> +               RTE_PER_LCORE(trace_point_sz) =3D 0;
> +               trace_crit("CTF field is too long");
> +               return;
> +       }
> +       RTE_PER_LCORE(ctf_count) +=3D rc;
> +}
> +
>  int
>  __rte_trace_point_register(rte_trace_t *handle, const char *name,
>                            void (*register_fn)(void))



--=20
David Marchand