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 56A4DA04AF; Mon, 4 May 2020 10:48:50 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D00A01D16A; Mon, 4 May 2020 10:48:49 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 617221D168 for ; Mon, 4 May 2020 10:48:48 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0448glQG025740; Mon, 4 May 2020 01:48:47 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pfpt0818; bh=vpyJURZo1y2Q7kWSPfirZTWFf7liqXSlCwjSCOWdQYs=; b=jNu9hMsN4WAm8ldUqW/rS54LEVd9i2U5Y/UzBhKm3hv8Q3KmJpxsEYNnJUsaYuqesbdn H68TuDT5SPykkM3vQFdpdghXg4MwVK0ykRkDzoroRPF8PBTYq973G9hJ+Hj1lJVj4/b5 VTs7S+PpcmzkBd6b1q2KpYi2P3UIKCw/lHizGSTsM67Vl1B1U57DUu9wSRwfDZVqo3jk yswDbL/o6+BwozbMPbJO40rHbWVAHA/p2Ky4iAWK5h2Muk8DC4rl3FZHDqoevjkaCoSH R4DAEuCjSdF8d+Q+nQZxo56PMHngeZ4f8jk7WzmbyGvlx6h1cvW/I6Via41BZLV88Jac Yw== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0a-0016f401.pphosted.com with ESMTP id 30s67q647r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 04 May 2020 01:48:47 -0700 Received: from SC-EXCH04.marvell.com (10.93.176.84) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 4 May 2020 01:48:45 -0700 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.173) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1497.2 via Frontend Transport; Mon, 4 May 2020 01:48:45 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MK4YPR3Zc5p7Gd2tkIU5IIHWXc2IWRXZhXMOnE9hcZvWTsSo/mQVDqxq+3Wn9A1cm38sPXUMftrQxwHCh5Ym0BJSM2zi5t2Jx/FOknbguT/iabzodUXpQ3EBWsRmNbmzsOAtDBwCsUsCcC+h0ccyOKB1Fo7WE2WrBdfQHTm9MU/oCAXUwqIlIDBLftbfc6J7NDX575N6A8P5SV5scNwzrNG8u7czotVpFHkRs5/G/LPVPczHB6sTSgrDcwpkXufK07OM5mWX8dA70tZQMfQI1UXuuOcAF7zQnfkYrov61dANNcbXfnkJTZW2Ojk5HJWwn9luKkz8Uq+eOeXlPjWkFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vpyJURZo1y2Q7kWSPfirZTWFf7liqXSlCwjSCOWdQYs=; b=D+aLCGy6MRsquogkEKcezoeRwc77NOlHUbl74iNfiMWjxICwrddlSX1VuAW2InQc8uYNsR1bCp2q9Bu//ciAxg2uT+CWz2qZN2B4kbsDJM9atE2nAp4ICyNljDjprsx+3EJB3rAVeS+OX8E+wgNpNJVdUMPzQuE3dKOVwjZYzK5HaP3UXCzHHSNYbjj3QUk4VgQgqxZ9ebDVk+Hd239ilupk7p2qETGlYCiLVGkWrpOOlKkhEJoLGG0kI5OyI1lvhS4eUlm4u8IUA5yaniYspFAvmU/OF18fAiObPBqAklva29p2LauPsQecEvx0T1uwRQrMm8wb0U5wfLzX0UDtVQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=marvell.com; dmarc=pass action=none header.from=marvell.com; dkim=pass header.d=marvell.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector1-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vpyJURZo1y2Q7kWSPfirZTWFf7liqXSlCwjSCOWdQYs=; b=Mp0GC6pe/XMMTre4r6IIZ2d67Z79YU7sgILT8Lr6gC1z5lG4/AGY8i3Dx9U21Hmv2lJbgzQc235CQFcqWYyifHoG4nEOLhiBoyaYCIvyKsvPoIv6xMS2n7dQAEZkObkwLiRens28+4wWrOGHYPolYOtG8oGViWFHNH3MVJO6rLw= Received: from BY5PR18MB3105.namprd18.prod.outlook.com (10.255.136.94) by BY5PR18MB3363.namprd18.prod.outlook.com (10.255.139.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.19; Mon, 4 May 2020 08:48:43 +0000 Received: from BY5PR18MB3105.namprd18.prod.outlook.com ([fe80::cc6:c7ae:dc40:7ddf]) by BY5PR18MB3105.namprd18.prod.outlook.com ([fe80::cc6:c7ae:dc40:7ddf%7]) with mapi id 15.20.2958.030; Mon, 4 May 2020 08:48:43 +0000 From: Sunil Kumar Kori To: David Marchand , "dev@dpdk.org" CC: "thomas@monjalon.net" , Jerin Jacob Kollanukkaran Thread-Topic: [EXT] [PATCH 6/8] trace: remove limitation on patterns number Thread-Index: AQHWIYn5/fulYQkq+Eq5e4lyTgc3I6iXmjqw Date: Mon, 4 May 2020 08:48:43 +0000 Message-ID: References: <20200503203135.6493-1-david.marchand@redhat.com> <20200503203135.6493-7-david.marchand@redhat.com> In-Reply-To: <20200503203135.6493-7-david.marchand@redhat.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=none action=none header.from=marvell.com; x-originating-ip: [2401:4900:1699:86aa:a1b6:3b55:e266:80e3] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 58ef3de0-9e0a-4b7f-b665-08d7f007f36f x-ms-traffictypediagnostic: BY5PR18MB3363: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:219; x-forefront-prvs: 03932714EB x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 8QXnzF+md0xO8rpxoJeCAT93Xdx926IqHWgbM/mApt10fBALLa5n6S6Aw44o2xhHpJbS2p/LR2oZ72ICu+gUcmfe4HLAGz9xlU0akk6e75wgrt1bVjeDa6vfNTIZq3pJcP6YJkcNG3vZJCIYljfWH68tdYv9MePahYCFSGiJ1qE8deAlQvqe4m4P/alSzuUVDZk2ZCqDyRe8VZ8wg62eo5z7+wwuhBGg/fWfQAdggGSQly9TM7KgX+pyxnh5sJizcWG7zJWVaDazvbJKjkEoO2LdA6JzrzxSecTdhHnti7u5m04z9FBJdFAstp/OTw0UivS5Ay9q53Ec3mWUnh40Yl+8WXhV9xy3+hGEyQRprNybGOD58tw5YG3ys1kvvJED9f8NucRrXd/ukXFLlsAuw3lelOn+oDfApJxZj75hpSANHsOLZpXVfRmQRb2mf6Xx x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BY5PR18MB3105.namprd18.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(136003)(396003)(376002)(346002)(366004)(39850400004)(8936002)(55016002)(107886003)(9686003)(4326008)(52536014)(316002)(8676002)(2906002)(76116006)(6506007)(478600001)(33656002)(5660300002)(186003)(64756008)(66556008)(86362001)(110136005)(71200400001)(66446008)(66476007)(7696005)(66946007)(54906003); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: YeKzKmlKCT4uM3OpCEfda6EzCbiTQQbpjXh377uSWOgVhv1/Fi6x4BUGnD3VmX4/M+ixwr6vbE6j10haSphcdJvEYfRufpNRB9zN6wlaV6MiXBbr6rxRj7T/KWUq9uB19/rlqehGqMU0D5ZqpAXzroe406FTXrVB/3Aw3THnI7wZJRdsUggIHH8cCZM3jDuOL55qEHioprsfbmHWSz7UonXvp9ku+P0IZSakxAozRh9J0C2ZLbh0WvgT5sz3/GWiaDl81E8pKGYQ7eF4u8qAweD9pGUYeVcR4kW/Vma/NdIgrILF0ngCFVg59QVn4+KxVP15VK2nnHa9kjbKuX42P2QdZUPXONG4ocmSYwJ60Bk8DDZ7y1d7W4fYpWx6lXWk/6GwcNfRiHCzhiRWAggSleEHOtkd5S5H51PrrFjYr89Yq6Mjz6yaQgdedXItVaHTZWgH+pcNtetdb25iEsPe7vHdE/op7F/rB83Ef96ND5AbWEc70aMzzCy8Of0XoZVKFQ6WkaDrdO2LgmgbQ0F4GZpXAtvjZV7WgW4aeUjpJTdapZrM04bbOdEIUdo5Mc5+sGqX7JMEUvrMREmJLrb/01mXVPbufkQfRAW1YbtmTOvzsdCjB8fy6YYUDqMUNnoMdu+ZUx8vnA+giWZ/O6gP+k9cNme+7TbBnHawPfUr17Kp285YkmOLaaY11NCeY2+YisX7S12GOwiJogLJTksYtIU/I5f3PeVJLhvOLOvwog75tBjjc5xWt8G69YoZzvpmo5v2uwlV3N6Y7Bt+NYUttF27Ff9kx1wMaS5t6s7j/JC0bDnDgEj37IkytOXC6htFAcWsxMLuTMCEAO50grtsZ+KD0xk/+17ZZtEYDWkpDMjpB7M8PN4ttjnlosAghv01 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 58ef3de0-9e0a-4b7f-b665-08d7f007f36f X-MS-Exchange-CrossTenant-originalarrivaltime: 04 May 2020 08:48:43.4677 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: FXhFyXxl2/OiVsL0DLbzTy4SciFEx/VydF9Sg7PcBdXW/TpHuEhZ2MAvg2OWaUvnMFEdToatxC5N+VCWBI00Sg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR18MB3363 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.676 definitions=2020-05-04_05:2020-05-01, 2020-05-04 signatures=0 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" >-----Original Message----- >From: David Marchand >Sent: Monday, May 4, 2020 2:02 AM >To: dev@dpdk.org >Cc: thomas@monjalon.net; Jerin Jacob Kollanukkaran ; >Sunil Kumar Kori >Subject: [EXT] [PATCH 6/8] trace: remove limitation on patterns number > >External Email > >---------------------------------------------------------------------- >There is nothing performance sensitive in this list, use dynamic allocatio= ns and >remove the arbitrary limit on the number of trace patterns a user can pass= . > >Signed-off-by: David Marchand >--- > lib/librte_eal/common/eal_common_trace.c | 10 +++--- > .../common/eal_common_trace_utils.c | 33 ++++++++----------- > lib/librte_eal/common/eal_trace.h | 8 ++--- > 3 files changed, 23 insertions(+), 28 deletions(-) > >diff --git a/lib/librte_eal/common/eal_common_trace.c >b/lib/librte_eal/common/eal_common_trace.c >index 5a365c61da..875553d7e5 100644 >--- a/lib/librte_eal/common/eal_common_trace.c >+++ b/lib/librte_eal/common/eal_common_trace.c >@@ -21,7 +21,7 @@ static RTE_DEFINE_PER_LCORE(char, >ctf_field[TRACE_CTF_FIELD_SIZE]); static RTE_DEFINE_PER_LCORE(int, >ctf_count); > > static struct trace_point_head tp_list =3D STAILQ_HEAD_INITIALIZER(tp_lis= t); - >static struct trace trace; >+static struct trace trace =3D { .args =3D >+STAILQ_HEAD_INITIALIZER(trace.args), }; > > struct trace * > trace_obj_get(void) >@@ -38,7 +38,7 @@ trace_list_head_get(void) int > eal_trace_init(void) > { >- uint8_t i; >+ struct trace_arg *arg; > > /* Trace memory should start with 8B aligned for natural alignment */ > RTE_BUILD_BUG_ON((offsetof(struct __rte_trace_header, mem) % 8) >!=3D 0); @@ -49,7 +49,7 @@ eal_trace_init(void) > goto fail; > } > >- if (trace.args.nb_args) >+ if (!STAILQ_EMPTY(&trace.args)) > trace.status =3D true; > > if (!rte_trace_is_enabled()) >@@ -82,8 +82,8 @@ eal_trace_init(void) > goto fail; > > /* Apply global configurations */ >- for (i =3D 0; i < trace.args.nb_args; i++) >- trace_args_apply(trace.args.args[i]); >+ STAILQ_FOREACH(arg, &trace.args, next) >+ trace_args_apply(arg->val); > > rte_trace_mode_set(trace.mode); > >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 ? > >- 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. > 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; > } > >@@ -164,13 +159,13 @@ void > eal_trace_args_free(void) > { > struct trace *trace =3D trace_obj_get(); >- int i; >+ struct trace_arg *arg; > >- for (i =3D 0; i < trace->args.nb_args; i++) { >- if (trace->args.args[i]) { >- free((void *)trace->args.args[i]); >- trace->args.args[i] =3D NULL; >- } >+ while (!STAILQ_EMPTY(&trace->args)) { >+ arg =3D STAILQ_FIRST(&trace->args); >+ STAILQ_REMOVE_HEAD(&trace->args, next); >+ free(arg->val); >+ free(arg); > } > } > >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. > uint32_t nb_trace_points; > uint32_t nb_trace_mem_list; > struct thread_mem_meta *lcore_meta; >-- >2.23.0