From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id E46FF1B107 for ; Wed, 21 Nov 2018 17:51:09 +0100 (CET) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4F34DC049581; Wed, 21 Nov 2018 16:51:09 +0000 (UTC) Received: from ktraynor.remote.csb (unknown [10.36.118.7]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3F7E15C241; Wed, 21 Nov 2018 16:51:08 +0000 (UTC) From: Kevin Traynor To: Vivek Sharma Cc: Cristian Dumitrescu , dpdk stable Date: Wed, 21 Nov 2018 16:48:22 +0000 Message-Id: <20181121164828.32249-68-ktraynor@redhat.com> In-Reply-To: <20181121164828.32249-1-ktraynor@redhat.com> References: <20181121164828.32249-1-ktraynor@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 21 Nov 2018 16:51:09 +0000 (UTC) Subject: [dpdk-stable] patch 'eal: use correct data type for bitmap slab operations' has been queued to stable release 18.08.1 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: , X-List-Received-Date: Wed, 21 Nov 2018 16:51:10 -0000 Hi, FYI, your patch has been queued to stable release 18.08.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 11/27/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. Kevin Traynor --- >>From 2438f09b91ab25d5e95f64305501b10d669548e8 Mon Sep 17 00:00:00 2001 From: Vivek Sharma 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 Acked-by: Cristian Dumitrescu --- 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 d9facc642..7a36ce73c 100644 --- a/lib/librte_eal/common/include/rte_bitmap.h +++ b/lib/librte_eal/common/include/rte_bitmap.h @@ -89,5 +89,5 @@ static inline uint64_t __rte_bitmap_mask1_get(struct rte_bitmap *bmp) { - return (~1lu) << bmp->offset1; + return (~1llu) << bmp->offset1; } @@ -318,5 +318,5 @@ rte_bitmap_get(struct rte_bitmap *bmp, uint32_t pos) offset2 = pos & RTE_BITMAP_SLAB_BIT_MASK; slab2 = bmp->array2 + index2; - return (*slab2) & (1lu << offset2); + return (*slab2) & (1llu << offset2); } @@ -343,6 +343,6 @@ rte_bitmap_set(struct rte_bitmap *bmp, uint32_t pos) slab1 = bmp->array1 + index1; - *slab2 |= 1lu << offset2; - *slab1 |= 1lu << offset1; + *slab2 |= 1llu << offset2; + *slab1 |= 1llu << offset1; } @@ -371,5 +371,5 @@ rte_bitmap_set_slab(struct rte_bitmap *bmp, uint32_t pos, uint64_t slab) *slab2 |= slab; - *slab1 |= 1lu << offset1; + *slab1 |= 1llu << offset1; } @@ -409,5 +409,5 @@ rte_bitmap_clear(struct rte_bitmap *bmp, uint32_t pos) /* Return if array2 slab is not all-zeros */ - *slab2 &= ~(1lu << offset2); + *slab2 &= ~(1llu << offset2); if (*slab2){ return; @@ -425,5 +425,5 @@ rte_bitmap_clear(struct rte_bitmap *bmp, uint32_t pos) 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 c3169e9d5..95c518488 100644 --- a/test/test/test_bitmap.c +++ b/test/test/test_bitmap.c @@ -102,4 +102,5 @@ static int test_bitmap_set_get_clear(struct rte_bitmap *bmp) { + uint64_t val; int i; @@ -125,4 +126,21 @@ 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.19.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2018-11-21 16:44:32.793333834 +0000 +++ 0068-eal-use-correct-data-type-for-bitmap-slab-operations.patch 2018-11-21 16:44:30.000000000 +0000 @@ -1,8 +1,10 @@ -From bed70e5deb1bc927c5adb375d15c1d32c6c137d8 Mon Sep 17 00:00:00 2001 +From 2438f09b91ab25d5e95f64305501b10d669548e8 Mon Sep 17 00:00:00 2001 From: Vivek Sharma 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@dpdk.org Signed-off-by: Vivek Sharma Acked-by: Cristian Dumitrescu