[dpdk-stable] patch 'mbuf: fix free space update for dynamic field' has been queued to stable release 19.11.4

luca.boccassi at gmail.com luca.boccassi at gmail.com
Fri Jul 24 13:58:12 CEST 2020


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 <xiaolong.ye at intel.com>
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 <xiaolong.ye at intel.com>
Acked-by: Olivier Matz <olivier.matz at 6wind.com>
---
 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 <xiaolong.ye at intel.com>
 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 at dpdk.org
 
 Signed-off-by: Xiaolong Ye <xiaolong.ye at intel.com>
 Acked-by: Olivier Matz <olivier.matz at 6wind.com>


More information about the stable mailing list