From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5A7E443E20; Sun, 7 Apr 2024 11:37:04 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D2600402BF; Sun, 7 Apr 2024 11:37:03 +0200 (CEST) Received: from mail.lysator.liu.se (mail.lysator.liu.se [130.236.254.3]) by mails.dpdk.org (Postfix) with ESMTP id EAC674029A for ; Sun, 7 Apr 2024 11:37:02 +0200 (CEST) Received: from mail.lysator.liu.se (localhost [127.0.0.1]) by mail.lysator.liu.se (Postfix) with ESMTP id 8528F1E660 for ; Sun, 7 Apr 2024 11:37:02 +0200 (CEST) Received: by mail.lysator.liu.se (Postfix, from userid 1004) id 791A61E69C; Sun, 7 Apr 2024 11:37:02 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on hermod.lysator.liu.se X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=ALL_TRUSTED,AWL, T_SCC_BODY_TEXT_LINE autolearn=disabled version=4.0.0 X-Spam-Score: -1.3 Received: from [192.168.1.59] (h-62-63-215-114.A163.priv.bahnhof.se [62.63.215.114]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.lysator.liu.se (Postfix) with ESMTPSA id 89CE91E65E; Sun, 7 Apr 2024 11:36:59 +0200 (CEST) Message-ID: <0c4ba365-94db-46ed-b843-2a70b0948368@lysator.liu.se> Date: Sun, 7 Apr 2024 11:36:59 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/4] latencystats: use alloca instead of vla trivial To: =?UTF-8?Q?Morten_Br=C3=B8rup?= , Tyler Retzlaff , Stephen Hemminger , Thomas Monjalon , Bruce Richardson Cc: dev@dpdk.org References: <20231107193220.GA15232@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> <1712250913-1977-1-git-send-email-roretzla@linux.microsoft.com> <1712250913-1977-2-git-send-email-roretzla@linux.microsoft.com> <98CBD80474FA8B44BF855DF32C47DC35E9F373@smartserver.smartshare.dk> Content-Language: en-US From: =?UTF-8?Q?Mattias_R=C3=B6nnblom?= In-Reply-To: <98CBD80474FA8B44BF855DF32C47DC35E9F373@smartserver.smartshare.dk> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: ClamAV using ClamSMTP X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On 2024-04-06 17:28, Morten Brørup wrote: >> From: Tyler Retzlaff [mailto:roretzla@linux.microsoft.com] >> Sent: Thursday, 4 April 2024 19.15 >> >> RFC sample illustrating simple conversion of VLA to alloca(). >> >> Signed-off-by: Tyler Retzlaff >> --- > > [...] > >> --- a/lib/latencystats/rte_latencystats.c >> +++ b/lib/latencystats/rte_latencystats.c >> @@ -159,7 +159,7 @@ struct latency_stats_nameoff { >> { >> unsigned int i, cnt = 0; >> uint64_t now; >> - float latency[nb_pkts]; >> + float *latency = alloca(sizeof(float) * nb_pkts); > > In cases where we are processing packet bursts, I would prefer introducing a global #define RTE_MAX_PKT_BURST_SIZE, indicating the max packet burst size supported by libraries and drivers. First question: what is meant by a "packet" here? An mbuf? A network-layer PDU? Something that in some way relates to zero or more packets, like an rte_event? Or just any object that are sent or receive of some DPDK API in batches or bursts? Second question: is RTE_MAX_PKT_BURST_SIZE meant as an upper bound, so no API can consumer or produce a burst larger than this, it does all APIs literally have to support that burst size. Third question: why not just keep VLAs? > For reference, rte_config.h already has #define RTE_GRAPH_BURST_SIZE 256. > > Such a common define should also be used by functions such as rte_pktmbuf_free_bulk(); although it also supports segmented packets, so it must still be able to handle more mbufs. > https://elixir.bootlin.com/dpdk/v24.03/source/lib/mbuf/rte_mbuf.c#L486 >