[dpdk-stable] patch 'eal: use correct data type for bitmap slab operations' has been queued to LTS release 17.11.5

Yongseok Koh yskoh at mellanox.com
Fri Nov 30 00:10:58 CET 2018


Hi,

FYI, your patch has been queued to LTS release 17.11.5

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 12/01/18. 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. If the code is different (ie: not only metadata diffs), due for example to
a change in context or macro names, please double check it.

Thanks.

Yongseok

---
>From 9099640794309a3d040051de3d9b3c72674e280a Mon Sep 17 00:00:00 2001
From: Vivek Sharma <vivek.sharma at caviumnetworks.com>
Date: Tue, 25 Sep 2018 09:53:06 +0000
Subject: [PATCH] eal: use correct data type for bitmap slab operations

[ upstream commit bed70e5deb1bc927c5adb375d15c1d32c6c137d8 ]

Currently, slab operations use unsigned long data type for 64-bit slab
related operations. On target 'i686-native-linuxapp-gcc', unsigned long
is 32-bit and thus, slab operations breaks on this target. Changing slab
operations to use unsigned long long for correct functioning on
all targets.

Fixes: de3cfa2c9823 ("sched: initial import")
Fixes: 693f715da45c ("remove extra parentheses in return statement")

Signed-off-by: Vivek Sharma <vivek.sharma at caviumnetworks.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu at intel.com>
---
 lib/librte_eal/common/include/rte_bitmap.h | 14 +++++++-------
 test/test/test_bitmap.c                    | 18 ++++++++++++++++++
 2 files changed, 25 insertions(+), 7 deletions(-)

diff --git a/lib/librte_eal/common/include/rte_bitmap.h b/lib/librte_eal/common/include/rte_bitmap.h
index 13bfd9cbe..eb270b27c 100644
--- a/lib/librte_eal/common/include/rte_bitmap.h
+++ b/lib/librte_eal/common/include/rte_bitmap.h
@@ -117,7 +117,7 @@ __rte_bitmap_index1_inc(struct rte_bitmap *bmp)
 static inline uint64_t
 __rte_bitmap_mask1_get(struct rte_bitmap *bmp)
 {
-	return (~1lu) << bmp->offset1;
+	return (~1llu) << bmp->offset1;
 }
 
 static inline void
@@ -346,7 +346,7 @@ rte_bitmap_get(struct rte_bitmap *bmp, uint32_t pos)
 	index2 = pos >> RTE_BITMAP_SLAB_BIT_SIZE_LOG2;
 	offset2 = pos & RTE_BITMAP_SLAB_BIT_MASK;
 	slab2 = bmp->array2 + index2;
-	return (*slab2) & (1lu << offset2);
+	return (*slab2) & (1llu << offset2);
 }
 
 /**
@@ -371,8 +371,8 @@ rte_bitmap_set(struct rte_bitmap *bmp, uint32_t pos)
 	slab2 = bmp->array2 + index2;
 	slab1 = bmp->array1 + index1;
 
-	*slab2 |= 1lu << offset2;
-	*slab1 |= 1lu << offset1;
+	*slab2 |= 1llu << offset2;
+	*slab1 |= 1llu << offset1;
 }
 
 /**
@@ -399,7 +399,7 @@ rte_bitmap_set_slab(struct rte_bitmap *bmp, uint32_t pos, uint64_t slab)
 	slab1 = bmp->array1 + index1;
 
 	*slab2 |= slab;
-	*slab1 |= 1lu << offset1;
+	*slab1 |= 1llu << offset1;
 }
 
 static inline uint64_t
@@ -437,7 +437,7 @@ rte_bitmap_clear(struct rte_bitmap *bmp, uint32_t pos)
 	slab2 = bmp->array2 + index2;
 
 	/* Return if array2 slab is not all-zeros */
-	*slab2 &= ~(1lu << offset2);
+	*slab2 &= ~(1llu << offset2);
 	if (*slab2){
 		return;
 	}
@@ -453,7 +453,7 @@ rte_bitmap_clear(struct rte_bitmap *bmp, uint32_t pos)
 	index1 = pos >> (RTE_BITMAP_SLAB_BIT_SIZE_LOG2 + RTE_BITMAP_CL_BIT_SIZE_LOG2);
 	offset1 = (pos >> RTE_BITMAP_CL_BIT_SIZE_LOG2) & RTE_BITMAP_SLAB_BIT_MASK;
 	slab1 = bmp->array1 + index1;
-	*slab1 &= ~(1lu << offset1);
+	*slab1 &= ~(1llu << offset1);
 
 	return;
 }
diff --git a/test/test/test_bitmap.c b/test/test/test_bitmap.c
index 7045d332a..e8c3a7807 100644
--- a/test/test/test_bitmap.c
+++ b/test/test/test_bitmap.c
@@ -129,6 +129,7 @@ test_bitmap_slab_set_get(struct rte_bitmap *bmp)
 static int
 test_bitmap_set_get_clear(struct rte_bitmap *bmp)
 {
+	uint64_t val;
 	int i;
 
 	rte_bitmap_reset(bmp);
@@ -152,6 +153,23 @@ test_bitmap_set_get_clear(struct rte_bitmap *bmp)
 		}
 	}
 
+	rte_bitmap_reset(bmp);
+
+	/* Alternate slab set test */
+	for (i = 0; i < MAX_BITS; i++) {
+		if (i % RTE_BITMAP_SLAB_BIT_SIZE)
+			rte_bitmap_set(bmp, i);
+	}
+
+	for (i = 0; i < MAX_BITS; i++) {
+		val = rte_bitmap_get(bmp, i);
+		if (((i % RTE_BITMAP_SLAB_BIT_SIZE) && !val) ||
+		    (!(i % RTE_BITMAP_SLAB_BIT_SIZE) && val)) {
+			printf("Failed to get set bit.\n");
+			return TEST_FAILED;
+		}
+	}
+
 	return TEST_SUCCESS;
 }
 
-- 
2.11.0

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2018-11-29 15:01:48.057370448 -0800
+++ 0064-eal-use-correct-data-type-for-bitmap-slab-operations.patch	2018-11-29 15:01:45.167958000 -0800
@@ -1,8 +1,10 @@
-From bed70e5deb1bc927c5adb375d15c1d32c6c137d8 Mon Sep 17 00:00:00 2001
+From 9099640794309a3d040051de3d9b3c72674e280a Mon Sep 17 00:00:00 2001
 From: Vivek Sharma <vivek.sharma at caviumnetworks.com>
 Date: Tue, 25 Sep 2018 09:53:06 +0000
 Subject: [PATCH] eal: use correct data type for bitmap slab operations
 
+[ upstream commit bed70e5deb1bc927c5adb375d15c1d32c6c137d8 ]
+
 Currently, slab operations use unsigned long data type for 64-bit slab
 related operations. On target 'i686-native-linuxapp-gcc', unsigned long
 is 32-bit and thus, slab operations breaks on this target. Changing slab
@@ -11,7 +13,6 @@
 
 Fixes: de3cfa2c9823 ("sched: initial import")
 Fixes: 693f715da45c ("remove extra parentheses in return statement")
-Cc: stable at dpdk.org
 
 Signed-off-by: Vivek Sharma <vivek.sharma at caviumnetworks.com>
 Acked-by: Cristian Dumitrescu <cristian.dumitrescu at intel.com>
@@ -21,10 +22,10 @@
  2 files changed, 25 insertions(+), 7 deletions(-)
 
 diff --git a/lib/librte_eal/common/include/rte_bitmap.h b/lib/librte_eal/common/include/rte_bitmap.h
-index d9facc642..7a36ce73c 100644
+index 13bfd9cbe..eb270b27c 100644
 --- a/lib/librte_eal/common/include/rte_bitmap.h
 +++ b/lib/librte_eal/common/include/rte_bitmap.h
-@@ -88,7 +88,7 @@ __rte_bitmap_index1_inc(struct rte_bitmap *bmp)
+@@ -117,7 +117,7 @@ __rte_bitmap_index1_inc(struct rte_bitmap *bmp)
  static inline uint64_t
  __rte_bitmap_mask1_get(struct rte_bitmap *bmp)
  {
@@ -33,7 +34,7 @@
  }
  
  static inline void
-@@ -317,7 +317,7 @@ rte_bitmap_get(struct rte_bitmap *bmp, uint32_t pos)
+@@ -346,7 +346,7 @@ rte_bitmap_get(struct rte_bitmap *bmp, uint32_t pos)
  	index2 = pos >> RTE_BITMAP_SLAB_BIT_SIZE_LOG2;
  	offset2 = pos & RTE_BITMAP_SLAB_BIT_MASK;
  	slab2 = bmp->array2 + index2;
@@ -42,7 +43,7 @@
  }
  
  /**
-@@ -342,8 +342,8 @@ rte_bitmap_set(struct rte_bitmap *bmp, uint32_t pos)
+@@ -371,8 +371,8 @@ rte_bitmap_set(struct rte_bitmap *bmp, uint32_t pos)
  	slab2 = bmp->array2 + index2;
  	slab1 = bmp->array1 + index1;
  
@@ -53,7 +54,7 @@
  }
  
  /**
-@@ -370,7 +370,7 @@ rte_bitmap_set_slab(struct rte_bitmap *bmp, uint32_t pos, uint64_t slab)
+@@ -399,7 +399,7 @@ rte_bitmap_set_slab(struct rte_bitmap *bmp, uint32_t pos, uint64_t slab)
  	slab1 = bmp->array1 + index1;
  
  	*slab2 |= slab;
@@ -62,7 +63,7 @@
  }
  
  static inline uint64_t
-@@ -408,7 +408,7 @@ rte_bitmap_clear(struct rte_bitmap *bmp, uint32_t pos)
+@@ -437,7 +437,7 @@ rte_bitmap_clear(struct rte_bitmap *bmp, uint32_t pos)
  	slab2 = bmp->array2 + index2;
  
  	/* Return if array2 slab is not all-zeros */
@@ -71,7 +72,7 @@
  	if (*slab2){
  		return;
  	}
-@@ -424,7 +424,7 @@ rte_bitmap_clear(struct rte_bitmap *bmp, uint32_t pos)
+@@ -453,7 +453,7 @@ rte_bitmap_clear(struct rte_bitmap *bmp, uint32_t pos)
  	index1 = pos >> (RTE_BITMAP_SLAB_BIT_SIZE_LOG2 + RTE_BITMAP_CL_BIT_SIZE_LOG2);
  	offset1 = (pos >> RTE_BITMAP_CL_BIT_SIZE_LOG2) & RTE_BITMAP_SLAB_BIT_MASK;
  	slab1 = bmp->array1 + index1;
@@ -81,10 +82,10 @@
  	return;
  }
 diff --git a/test/test/test_bitmap.c b/test/test/test_bitmap.c
-index c3169e9d5..95c518488 100644
+index 7045d332a..e8c3a7807 100644
 --- a/test/test/test_bitmap.c
 +++ b/test/test/test_bitmap.c
-@@ -101,6 +101,7 @@ test_bitmap_slab_set_get(struct rte_bitmap *bmp)
+@@ -129,6 +129,7 @@ test_bitmap_slab_set_get(struct rte_bitmap *bmp)
  static int
  test_bitmap_set_get_clear(struct rte_bitmap *bmp)
  {
@@ -92,7 +93,7 @@
  	int i;
  
  	rte_bitmap_reset(bmp);
-@@ -124,6 +125,23 @@ test_bitmap_set_get_clear(struct rte_bitmap *bmp)
+@@ -152,6 +153,23 @@ test_bitmap_set_get_clear(struct rte_bitmap *bmp)
  		}
  	}
  


More information about the stable mailing list