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 CA2FEA0518 for ; Fri, 24 Jul 2020 14:04:11 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C2D621BFE5; Fri, 24 Jul 2020 14:04:11 +0200 (CEST) Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) by dpdk.org (Postfix) with ESMTP id 6B5731BFE5 for ; Fri, 24 Jul 2020 14:04:10 +0200 (CEST) Received: by mail-wm1-f67.google.com with SMTP id t142so1673718wmt.4 for ; Fri, 24 Jul 2020 05:04:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=JqjMJkrAEzw8SteHyxo+i/pBHtWHuhJ80W3pkD0uNTc=; b=Lkxrhdx4bJnh/27LN6eXBwFmn3SzRypANsacYPQb5bSYp9rtzbE0OWjGZmaeYgkiic R27bIw8GOwpVXKOG2EjERULp9F2P4PJCOp25rIVPVfLBsDOQdbY34bo3NUDUPHVJPsD0 4k1PptMd4zI1itYWYdc7zRLrANMHX5fCek+Tfm9fsYiNUag3FC8ZEXB0LahVCJlfe6B7 mb1LLLKzJ49/E/wsqEKav4lgO4YeQODgDkD8Y9KyYNuSgSCQhzblQRn9o9deL+IPkVoX I7ykNSoVqtsk1SGIgfrpldHlDeffHjL6bboWQmr9xfjL1QHj9Hc36wFSreDTctVTFvZC 9Pvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JqjMJkrAEzw8SteHyxo+i/pBHtWHuhJ80W3pkD0uNTc=; b=Y10Xp3xf87bvbFcf529k1YsohWNNzGHnHYPgfX1xGZ+BmoKG9/d+vZIQv32/aE5Knk MGi2hohcSBvGWmnvgCz85OtsNq3inL1/ojLEdp4NIrGnpHJ558FdtuDQUiOHU2Z19wAj EscPcPGyruy9chxErYgN2FwFLxvsHQHzoip7YnSpG7Ca7n4ZspZLbkEsLK6dbbitOnss 92csM25q+/TRDBfrJR+lPur8G2SKX1yUZ4um0c57m7rUl4Ov/oj+TPOP4Lz2uhXQ58lb Qtr3QGIwhb/ScMUCHohrWtSMfTGSU2YjOSZ1SJ7bb+naYhD+OKoxNPlPibzG52hvv3rs T1hg== X-Gm-Message-State: AOAM533Ft8ST83a0x4nlcfRz2fpe2hk7kxGIaw8ZgdRgCidUW9ySDeVv xuF6MGve1ySkoEAfnQGS/cW2RHvubGsHlQ== X-Google-Smtp-Source: ABdhPJz2gkdW+6KoXmy/y0EdqmVPRi2fDqgkeIa5iFoV6/VBMb10o7a0rS1PI/ZihzPPboHeMkC01Q== X-Received: by 2002:a7b:c1c2:: with SMTP id a2mr1716505wmj.74.1595592250074; Fri, 24 Jul 2020 05:04:10 -0700 (PDT) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id w14sm1155915wrt.55.2020.07.24.05.04.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jul 2020 05:04:07 -0700 (PDT) From: luca.boccassi@gmail.com To: Xiaolong Ye Cc: Olivier Matz , dpdk stable Date: Fri, 24 Jul 2020 12:58:12 +0100 Message-Id: <20200724120030.1863487-54-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200724120030.1863487-1-luca.boccassi@gmail.com> References: <20200724120030.1863487-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'mbuf: fix free space update for dynamic field' has been queued to stable release 19.11.4 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, FYI, your patch has been queued to stable release 19.11.4 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 07/26/20. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Thanks. Luca Boccassi --- >From a02840d607a77d63f35c918100145d17474263c5 Mon Sep 17 00:00:00 2001 From: Xiaolong Ye Date: Sat, 13 Jun 2020 23:49:19 +0800 Subject: [PATCH] mbuf: fix free space update for dynamic field [ upstream commit 3a7fb882fdf32e1b50faac2331b2a48d89b4212e ] The value free_space[i] is used to save the size of biggest aligned element that can fit in the zone, current implementation has one flaw, for example, if user registers dynfield1 (size = 4, align = 4, req = 124) first, the free_space would be as below after registration: 0070: 08 08 08 08 08 08 08 08 0078: 08 08 08 08 00 00 00 00 Then if user continues to register dynfield2 (size = 4, align = 4), free_space would become: 0070: 00 00 00 00 04 04 04 04 0078: 04 04 04 04 00 00 00 00 Further request dynfield3 (size = 8, align = 8) would fail to register due to alignment requirement can't be satisfied, though there is enough space remained in mbuf. This patch fixes above issue by saving alignment only in aligned zone, after the fix, above registrations order can be satisfied, free_space would be like: After dynfield1 registration: 0070: 08 08 08 08 08 08 08 08 0078: 04 04 04 04 00 00 00 00 After dynfield2 registration: 0070: 08 08 08 08 08 08 08 08 0078: 00 00 00 00 00 00 00 00 After dynfield3 registration: 0070: 00 00 00 00 00 00 00 00 0078: 00 00 00 00 00 00 00 00 This patch also reduces iterations in process_score() by jumping align steps in each loop. Fixes: 4958ca3a443a ("mbuf: support dynamic fields and flags") Signed-off-by: Xiaolong Ye Acked-by: Olivier Matz --- lib/librte_mbuf/rte_mbuf_dyn.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/librte_mbuf/rte_mbuf_dyn.c b/lib/librte_mbuf/rte_mbuf_dyn.c index de7d2eb9a..fd51e1b68 100644 --- a/lib/librte_mbuf/rte_mbuf_dyn.c +++ b/lib/librte_mbuf/rte_mbuf_dyn.c @@ -67,13 +67,16 @@ process_score(void) shm->free_space[i] = 1; } - for (off = 0; off < sizeof(struct rte_mbuf); off++) { + off = 0; + while (off < sizeof(struct rte_mbuf)) { /* get the size of the free zone */ for (size = 0; (off + size) < sizeof(struct rte_mbuf) && shm->free_space[off + size]; size++) ; - if (size == 0) + if (size == 0) { + off++; continue; + } /* get the alignment of biggest object that can fit in * the zone at this offset. @@ -84,8 +87,10 @@ process_score(void) ; /* save it in free_space[] */ - for (i = off; i < off + size; i++) + for (i = off; i < off + align; i++) shm->free_space[i] = RTE_MAX(align, shm->free_space[i]); + + off += align; } } -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-07-24 12:53:50.685126954 +0100 +++ 0054-mbuf-fix-free-space-update-for-dynamic-field.patch 2020-07-24 12:53:48.275006236 +0100 @@ -1,8 +1,10 @@ -From 3a7fb882fdf32e1b50faac2331b2a48d89b4212e Mon Sep 17 00:00:00 2001 +From a02840d607a77d63f35c918100145d17474263c5 Mon Sep 17 00:00:00 2001 From: Xiaolong Ye Date: Sat, 13 Jun 2020 23:49:19 +0800 Subject: [PATCH] mbuf: fix free space update for dynamic field +[ upstream commit 3a7fb882fdf32e1b50faac2331b2a48d89b4212e ] + The value free_space[i] is used to save the size of biggest aligned element that can fit in the zone, current implementation has one flaw, for example, if user registers dynfield1 (size = 4, align = 4, req = 124) @@ -44,7 +46,6 @@ steps in each loop. Fixes: 4958ca3a443a ("mbuf: support dynamic fields and flags") -Cc: stable@dpdk.org Signed-off-by: Xiaolong Ye Acked-by: Olivier Matz