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 A33CB45C82; Tue, 5 Nov 2024 04:18:12 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4E270427CE; Tue, 5 Nov 2024 04:17:46 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id D3A5C4279F for ; Tue, 5 Nov 2024 04:17:37 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1213) id 6F1772126CAA; Mon, 4 Nov 2024 19:17:36 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 6F1772126CAA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1730776656; bh=AkHtuc67+zKG4nF3hOBkIHhTl/VfBm28WLIW7gmN/Ok=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GrrYAKcQz1BH234Tqn1VNV4c/HH0FJhnHUHx+f2UtU/OC/c0gzvSbPFOA1XZRCGE4 Gepn+KEPWmrcblLCbf/JojN+VSI4Zqg9LXsziZ3UsyPeL5e5O0FlVyMfznRLfjeGDU /+jTp7mXXc3A0pP/oS1yPAuJ1zC8CFgxXPLFVd6M= From: Andre Muezerie To: stephen@networkplumber.org Cc: aman.deep.singh@intel.com, anatoly.burakov@intel.com, andrew.rybchenko@oktetlabs.ru, bruce.richardson@intel.com, dev@dpdk.org, dmitry.kozliuk@gmail.com, dsosnowski@nvidia.com, fanzhang.oss@gmail.com, fengchengwen@huawei.com, ferruh.yigit@amd.com, gakhil@marvell.com, harry.van.haaren@intel.com, hkalra@marvell.com, honnappa.nagarahalli@arm.com, hujiayu.hu@foxmail.com, jingjing.wu@intel.com, kevin.laatz@intel.com, konstantin.v.ananyev@yandex.ru, matan@nvidia.com, mb@smartsharesystems.com, orika@nvidia.com, pallavi.kadam@intel.com, reshma.pattan@intel.com, roretzla@linux.microsoft.com, sameh.gobriel@intel.com, suanmingm@nvidia.com, thomas@monjalon.net, vfialko@marvell.com, viacheslavo@nvidia.com, vladimir.medvedkin@intel.com, yipeng1.wang@intel.com, Konstantin Ananyev Subject: [PATCH v4 07/19] rcu: remove use of VLAs for Windows built code Date: Mon, 4 Nov 2024 19:15:41 -0800 Message-Id: <1730776553-31277-8-git-send-email-andremue@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1730776553-31277-1-git-send-email-andremue@linux.microsoft.com> References: <1713397319-26135-1-git-send-email-roretzla@linux.microsoft.com> <1730776553-31277-1-git-send-email-andremue@linux.microsoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 From: Konstantin Ananyev 1) ./lib/rcu/rte_rcu_qsbr.c:359:9 : warning: ISO C90 forbids variable length array ‘data’ [-Wvla] 2) ./lib/rcu/rte_rcu_qsbr.c:422:9 : warning: ISO C90 forbids variable length array ‘data’ [-Wvla] In both cases we allocate VLA for one element from RCU deferred queue. Right now, size of element in RCU queue is not limited by API. The approach is to introduce some reasonable limitation on RCU DQ element size. Choose 128B for now. With that in place we can replace both VLA occurencies with fixed size array. Note that such change need to be treated as API change. So can be applied only at 24.11. Signed-off-by: Konstantin Ananyev --- lib/rcu/rte_rcu_qsbr.c | 7 ++++--- lib/rcu/rte_rcu_qsbr.h | 5 +++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/rcu/rte_rcu_qsbr.c b/lib/rcu/rte_rcu_qsbr.c index 40d7c566c8..09a14a15f1 100644 --- a/lib/rcu/rte_rcu_qsbr.c +++ b/lib/rcu/rte_rcu_qsbr.c @@ -245,7 +245,8 @@ rte_rcu_qsbr_dq_create(const struct rte_rcu_qsbr_dq_parameters *params) if (params == NULL || params->free_fn == NULL || params->v == NULL || params->name == NULL || params->size == 0 || params->esize == 0 || - (params->esize % 4 != 0)) { + (params->esize % 4 != 0) || + params->esize > RTE_QSBR_ESIZE_MAX) { RCU_LOG(ERR, "Invalid input parameter"); rte_errno = EINVAL; @@ -323,7 +324,7 @@ int rte_rcu_qsbr_dq_enqueue(struct rte_rcu_qsbr_dq *dq, void *e) return 1; } - char data[dq->esize]; + char data[RTE_QSBR_ESIZE_MAX + __RTE_QSBR_TOKEN_SIZE]; dq_elem = (__rte_rcu_qsbr_dq_elem_t *)data; /* Start the grace period */ dq_elem->token = rte_rcu_qsbr_start(dq->v); @@ -386,7 +387,7 @@ rte_rcu_qsbr_dq_reclaim(struct rte_rcu_qsbr_dq *dq, unsigned int n, cnt = 0; - char data[dq->esize]; + char data[RTE_QSBR_ESIZE_MAX + __RTE_QSBR_TOKEN_SIZE]; /* Check reader threads quiescent state and reclaim resources */ while (cnt < n && rte_ring_dequeue_bulk_elem_start(dq->r, &data, diff --git a/lib/rcu/rte_rcu_qsbr.h b/lib/rcu/rte_rcu_qsbr.h index 550fadf56a..abcbd78914 100644 --- a/lib/rcu/rte_rcu_qsbr.h +++ b/lib/rcu/rte_rcu_qsbr.h @@ -86,6 +86,11 @@ struct __rte_cache_aligned rte_rcu_qsbr_cnt { #define __RTE_QSBR_CNT_MAX ((uint64_t)~0) #define __RTE_QSBR_TOKEN_SIZE sizeof(uint64_t) +/** + * Max allowable size (in bytes) of each element in the defer queue + */ +#define RTE_QSBR_ESIZE_MAX (2 * RTE_CACHE_LINE_MIN_SIZE) + /* RTE Quiescent State variable structure. * This structure has two elements that vary in size based on the * 'max_threads' parameter. -- 2.34.1