test/ring: fix long compilation time
diff mbox series

Message ID 20200430015650.18243-1-honnappa.nagarahalli@arm.com
State Rejected
Delegated to: David Marchand
Headers show
Series
  • test/ring: fix long compilation time
Related show

Checks

Context Check Description
ci/iol-testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-mellanox-Performance success Performance Testing PASS
ci/travis-robot warning Travis build: errored
ci/iol-nxp-Performance success Performance Testing PASS
ci/iol-intel-Performance fail Performance Testing issues
ci/checkpatch success coding style OK

Commit Message

Honnappa Nagarahalli April 30, 2020, 1:56 a.m. UTC
test_ring.c takes lot of time to compile with clang. It is
reproducable with compiler version 8.0 on Ubuntu 18.04.
Amount of testing is reduced, but attempt is made to keep
the same coverage.

Reported-by: Aaron Conole <aconole@redhat.com>
Reported-by: Thomas Monjalon <thomas@monjalon.net>
Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
 app/test/test_ring.c | 588 +++++++++++++++++++++----------------------
 1 file changed, 283 insertions(+), 305 deletions(-)

Comments

Thomas Monjalon April 30, 2020, 10:23 a.m. UTC | #1
30/04/2020 03:56, Honnappa Nagarahalli:
> test_ring.c takes lot of time to compile with clang. It is
> reproducable with compiler version 8.0 on Ubuntu 18.04.
> Amount of testing is reduced, but attempt is made to keep
> the same coverage.
> 
> Reported-by: Aaron Conole <aconole@redhat.com>
> Reported-by: Thomas Monjalon <thomas@monjalon.net>
> Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> ---
>  app/test/test_ring.c | 588 +++++++++++++++++++++----------------------
>  1 file changed, 283 insertions(+), 305 deletions(-)

That's a lot better!

Please could you explain (in the commit log) what was taking
so long to compile in the previous code?

nit: reproducable -> reproducible
Aaron Conole April 30, 2020, 12:55 p.m. UTC | #2
Honnappa Nagarahalli <honnappa.nagarahalli@arm.com> writes:

> test_ring.c takes lot of time to compile with clang. It is
> reproducable with compiler version 8.0 on Ubuntu 18.04.
> Amount of testing is reduced, but attempt is made to keep
> the same coverage.
>
> Reported-by: Aaron Conole <aconole@redhat.com>
> Reported-by: Thomas Monjalon <thomas@monjalon.net>
> Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> ---

Thanks, Honnappa!

One thing to note, I don't see this with just clang - it occurs with gcc
as well.  I'm going to test this patch today.
Honnappa Nagarahalli April 30, 2020, 4:03 p.m. UTC | #3
<snip>

> Subject: Re: [PATCH] test/ring: fix long compilation time
> 
> Honnappa Nagarahalli <honnappa.nagarahalli@arm.com> writes:
> 
> > test_ring.c takes lot of time to compile with clang. It is
> > reproducable with compiler version 8.0 on Ubuntu 18.04.
> > Amount of testing is reduced, but attempt is made to keep the same
> > coverage.
> >
> > Reported-by: Aaron Conole <aconole@redhat.com>
> > Reported-by: Thomas Monjalon <thomas@monjalon.net>
> > Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
> > Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> > ---
> 
> Thanks, Honnappa!
> 
> One thing to note, I don't see this with just clang - it occurs with gcc as well.
> I'm going to test this patch today.
Which gcc version are you using? I do not see test_ring.c taking much time for compilation for gcc on my x86 platform.
The clang issue is seen on x8, on Arm it does not show issues.
Aaron Conole April 30, 2020, 5:01 p.m. UTC | #4
Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com> writes:

> <snip>
>
>> Subject: Re: [PATCH] test/ring: fix long compilation time
>> 
>> Honnappa Nagarahalli <honnappa.nagarahalli@arm.com> writes:
>> 
>> > test_ring.c takes lot of time to compile with clang. It is
>> > reproducable with compiler version 8.0 on Ubuntu 18.04.
>> > Amount of testing is reduced, but attempt is made to keep the same
>> > coverage.
>> >
>> > Reported-by: Aaron Conole <aconole@redhat.com>
>> > Reported-by: Thomas Monjalon <thomas@monjalon.net>
>> > Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
>> > Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
>> > ---
>> 
>> Thanks, Honnappa!
>> 
>> One thing to note, I don't see this with just clang - it occurs with gcc as well.
>> I'm going to test this patch today.
> Which gcc version are you using? I do not see test_ring.c taking much
> time for compilation for gcc on my x86 platform.

7.4.0, but I'm also adding asan and ubsan to it.

> The clang issue is seen on x8, on Arm it does not show issues.

I didn't check arm, yet
Honnappa Nagarahalli April 30, 2020, 7:51 p.m. UTC | #5
> > <snip>
> >
> >> Subject: Re: [PATCH] test/ring: fix long compilation time
> >>
> >> Honnappa Nagarahalli <honnappa.nagarahalli@arm.com> writes:
> >>
> >> > test_ring.c takes lot of time to compile with clang. It is
> >> > reproducable with compiler version 8.0 on Ubuntu 18.04.
> >> > Amount of testing is reduced, but attempt is made to keep the same
> >> > coverage.
> >> >
> >> > Reported-by: Aaron Conole <aconole@redhat.com>
> >> > Reported-by: Thomas Monjalon <thomas@monjalon.net>
> >> > Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
> >> > Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> >> > ---
> >>
> >> Thanks, Honnappa!
> >>
> >> One thing to note, I don't see this with just clang - it occurs with gcc as
> well.
> >> I'm going to test this patch today.
> > Which gcc version are you using? I do not see test_ring.c taking much
> > time for compilation for gcc on my x86 platform.
> 
> 7.4.0, but I'm also adding asan and ubsan to it.
Ok, ubsan+ gcc 8.4.0 is taking time on Arm as well.

> 
> > The clang issue is seen on x8, on Arm it does not show issues.
> 
> I didn't check arm, yet
Aaron Conole May 1, 2020, 12:56 p.m. UTC | #6
Aaron Conole <aconole@redhat.com> writes:

> Honnappa Nagarahalli <honnappa.nagarahalli@arm.com> writes:
>
>> test_ring.c takes lot of time to compile with clang. It is
>> reproducable with compiler version 8.0 on Ubuntu 18.04.
>> Amount of testing is reduced, but attempt is made to keep
>> the same coverage.
>>
>> Reported-by: Aaron Conole <aconole@redhat.com>
>> Reported-by: Thomas Monjalon <thomas@monjalon.net>
>> Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
>> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
>> ---
>
> Thanks, Honnappa!
>
> One thing to note, I don't see this with just clang - it occurs with gcc
> as well.  I'm going to test this patch today.

Sorry I forgot to send the reply.  This got me further in my work, so
I'm happy with it from that perspective.

BUT, it still did take a bit longer with this version than with
Konstantin's patch.  I have no opinion which is the more "technically
correct" version.
Thomas Monjalon June 16, 2020, 12:47 p.m. UTC | #7
Konstantin, Honnappa,
Any update about a fix for compilation time please?


30/04/2020 12:23, Thomas Monjalon:
> 30/04/2020 03:56, Honnappa Nagarahalli:
> > test_ring.c takes lot of time to compile with clang. It is
> > reproducable with compiler version 8.0 on Ubuntu 18.04.
> > Amount of testing is reduced, but attempt is made to keep
> > the same coverage.
> > 
> > Reported-by: Aaron Conole <aconole@redhat.com>
> > Reported-by: Thomas Monjalon <thomas@monjalon.net>
> > Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
> > Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> > ---
> >  app/test/test_ring.c | 588 +++++++++++++++++++++----------------------
> >  1 file changed, 283 insertions(+), 305 deletions(-)
> 
> That's a lot better!
> 
> Please could you explain (in the commit log) what was taking
> so long to compile in the previous code?
David Marchand June 25, 2020, 8:19 a.m. UTC | #8
On Tue, Jun 16, 2020 at 2:48 PM Thomas Monjalon <thomas@monjalon.net> wrote:
>
> Konstantin, Honnappa,
> Any update about a fix for compilation time please?

+1
A good amount of time waiting for builds is on this code.
Ananyev, Konstantin June 25, 2020, 11:05 a.m. UTC | #9
Hi everyone,

> >
> > Konstantin, Honnappa,
> > Any update about a fix for compilation time please?
> 
> +1
> A good amount of time waiting for builds is on this code.
> 

Between 69567 and 69559:
http://patches.dpdk.org/patch/69567/
http://patches.dpdk.org/patch/69559/
my preference is still 69559, as it compiles faster and doesn't reduce test coverage.
But as I said before - I can live with both.
As I remember Honnappa had some concerns regarding 69559.
If that is still the case, then to unblock the situation I am ok
to go ahead with 69567.
Konstantin
Honnappa Nagarahalli July 2, 2020, 8:42 p.m. UTC | #10
<snip>

> 
> Hi everyone,
> 
> > >
> > > Konstantin, Honnappa,
> > > Any update about a fix for compilation time please?
> >
> > +1
> > A good amount of time waiting for builds is on this code.
> >
> 
> Between 69567 and 69559:
> http://patches.dpdk.org/patch/69567/
> http://patches.dpdk.org/patch/69559/
> my preference is still 69559, as it compiles faster and doesn't reduce test
> coverage.
> But as I said before - I can live with both.
> As I remember Honnappa had some concerns regarding 69559.
> If that is still the case, then to unblock the situation I am ok to go ahead with
> 69567.
> Konstantin
Apologies for missing these emails.

Thanks Konstantin.
I ran the tests with both the patches and I see that both of them are showing the same exact numbers on Arm platform.
I liked your patch because I think it is better for future additions of test cases.
With my patch, I am concerned that we might hit the issue in the future again. I will add my acked-by to your patch and mark my patch rejected.

>

Patch
diff mbox series

diff --git a/app/test/test_ring.c b/app/test/test_ring.c
index e21557cd9..82148566a 100644
--- a/app/test/test_ring.c
+++ b/app/test/test_ring.c
@@ -203,83 +203,77 @@  test_ring_negative_tests(void)
  * Random number of elements are enqueued and dequeued.
  */
 static int
-test_ring_burst_bulk_tests1(unsigned int api_type, unsigned int create_flags,
-	const char *tname)
+test_ring_burst_bulk_tests1(unsigned int api_type, const unsigned int esize,
+	unsigned int create_flags, const char *tname)
 {
 	struct rte_ring *r;
 	void **src = NULL, **cur_src = NULL, **dst = NULL, **cur_dst = NULL;
 	int ret;
-	unsigned int i, j;
+	unsigned int j;
 	int rand;
 	const unsigned int rsz = RING_SIZE - 1;
 
-	for (i = 0; i < RTE_DIM(esize); i++) {
-		test_ring_print_test_string(tname, api_type, esize[i]);
-
-		/* Create the ring */
-		r = test_ring_create("test_ring_burst_bulk_tests", esize[i],
-					RING_SIZE, SOCKET_ID_ANY, create_flags);
-
-		/* alloc dummy object pointers */
-		src = test_ring_calloc(RING_SIZE * 2, esize[i]);
-		if (src == NULL)
-			goto fail;
-		test_ring_mem_init(src, RING_SIZE * 2, esize[i]);
-		cur_src = src;
-
-		/* alloc some room for copied objects */
-		dst = test_ring_calloc(RING_SIZE * 2, esize[i]);
-		if (dst == NULL)
-			goto fail;
-		cur_dst = dst;
-
-		printf("Random full/empty test\n");
-
-		for (j = 0; j != TEST_RING_FULL_EMTPY_ITER; j++) {
-			/* random shift in the ring */
-			rand = RTE_MAX(rte_rand() % RING_SIZE, 1UL);
-			printf("%s: iteration %u, random shift: %u;\n",
-			    __func__, i, rand);
-			ret = test_ring_enqueue(r, cur_src, esize[i], rand,
-							api_type);
-			TEST_RING_VERIFY(ret != 0);
-
-			ret = test_ring_dequeue(r, cur_dst, esize[i], rand,
-							api_type);
-			TEST_RING_VERIFY(ret == rand);
-
-			/* fill the ring */
-			ret = test_ring_enqueue(r, cur_src, esize[i], rsz,
-							api_type);
-			TEST_RING_VERIFY(ret != 0);
-
-			TEST_RING_VERIFY(rte_ring_free_count(r) == 0);
-			TEST_RING_VERIFY(rsz == rte_ring_count(r));
-			TEST_RING_VERIFY(rte_ring_full(r));
-			TEST_RING_VERIFY(rte_ring_empty(r) == 0);
-
-			/* empty the ring */
-			ret = test_ring_dequeue(r, cur_dst, esize[i], rsz,
-							api_type);
-			TEST_RING_VERIFY(ret == (int)rsz);
-			TEST_RING_VERIFY(rsz == rte_ring_free_count(r));
-			TEST_RING_VERIFY(rte_ring_count(r) == 0);
-			TEST_RING_VERIFY(rte_ring_full(r) == 0);
-			TEST_RING_VERIFY(rte_ring_empty(r));
-
-			/* check data */
-			TEST_RING_VERIFY(memcmp(src, dst, rsz) == 0);
-		}
+	test_ring_print_test_string(tname, api_type, esize);
+
+	/* Create the ring */
+	r = test_ring_create("test_ring_burst_bulk_tests", esize,
+				RING_SIZE, SOCKET_ID_ANY, create_flags);
+
+	/* alloc dummy object pointers */
+	src = test_ring_calloc(RING_SIZE * 2, esize);
+	if (src == NULL)
+		goto fail;
+	test_ring_mem_init(src, RING_SIZE * 2, esize);
+	cur_src = src;
+
+	/* alloc some room for copied objects */
+	dst = test_ring_calloc(RING_SIZE * 2, esize);
+	if (dst == NULL)
+		goto fail;
+	cur_dst = dst;
+
+	printf("Random full/empty test\n");
+
+	for (j = 0; j != TEST_RING_FULL_EMTPY_ITER; j++) {
+		/* random shift in the ring */
+		rand = RTE_MAX(rte_rand() % RING_SIZE, 1UL);
+		printf("%s: iteration %u, random shift: %u;\n",
+		    __func__, j, rand);
+		ret = test_ring_enqueue(r, cur_src, esize, rand, api_type);
+		TEST_RING_VERIFY(ret != 0);
+
+		ret = test_ring_dequeue(r, cur_dst, esize, rand, api_type);
+		TEST_RING_VERIFY(ret == rand);
+
+		/* fill the ring */
+		ret = test_ring_enqueue(r, cur_src, esize, rsz, api_type);
+		TEST_RING_VERIFY(ret != 0);
+
+		TEST_RING_VERIFY(rte_ring_free_count(r) == 0);
+		TEST_RING_VERIFY(rsz == rte_ring_count(r));
+		TEST_RING_VERIFY(rte_ring_full(r));
+		TEST_RING_VERIFY(rte_ring_empty(r) == 0);
+
+		/* empty the ring */
+		ret = test_ring_dequeue(r, cur_dst, esize, rsz, api_type);
+		TEST_RING_VERIFY(ret == (int)rsz);
+		TEST_RING_VERIFY(rsz == rte_ring_free_count(r));
+		TEST_RING_VERIFY(rte_ring_count(r) == 0);
+		TEST_RING_VERIFY(rte_ring_full(r) == 0);
+		TEST_RING_VERIFY(rte_ring_empty(r));
 
-		/* Free memory before test completed */
-		rte_ring_free(r);
-		rte_free(src);
-		rte_free(dst);
-		r = NULL;
-		src = NULL;
-		dst = NULL;
+		/* check data */
+		TEST_RING_VERIFY(memcmp(src, dst, rsz) == 0);
 	}
 
+	/* Free memory before test completed */
+	rte_ring_free(r);
+	rte_free(src);
+	rte_free(dst);
+	r = NULL;
+	src = NULL;
+	dst = NULL;
+
 	return 0;
 fail:
 	rte_ring_free(r);
@@ -294,89 +288,84 @@  test_ring_burst_bulk_tests1(unsigned int api_type, unsigned int create_flags,
  * dequeued data.
  */
 static int
-test_ring_burst_bulk_tests2(unsigned int api_type, unsigned int create_flags,
-	const char *tname)
+test_ring_burst_bulk_tests2(unsigned int api_type, const unsigned int esize,
+	unsigned int create_flags, const char *tname)
 {
 	struct rte_ring *r;
 	void **src = NULL, **cur_src = NULL, **dst = NULL, **cur_dst = NULL;
 	int ret;
-	unsigned int i;
-
-	for (i = 0; i < RTE_DIM(esize); i++) {
-		test_ring_print_test_string(tname, api_type, esize[i]);
-
-		/* Create the ring */
-		r = test_ring_create("test_ring_burst_bulk_tests", esize[i],
-					RING_SIZE, SOCKET_ID_ANY, create_flags);
-
-		/* alloc dummy object pointers */
-		src = test_ring_calloc(RING_SIZE * 2, esize[i]);
-		if (src == NULL)
-			goto fail;
-		test_ring_mem_init(src, RING_SIZE * 2, esize[i]);
-		cur_src = src;
-
-		/* alloc some room for copied objects */
-		dst = test_ring_calloc(RING_SIZE * 2, esize[i]);
-		if (dst == NULL)
-			goto fail;
-		cur_dst = dst;
-
-		printf("enqueue 1 obj\n");
-		ret = test_ring_enqueue(r, cur_src, esize[i], 1, api_type);
-		if (ret != 1)
-			goto fail;
-		cur_src = test_ring_inc_ptr(cur_src, esize[i], 1);
 
-		printf("enqueue 2 objs\n");
-		ret = test_ring_enqueue(r, cur_src, esize[i], 2, api_type);
-		if (ret != 2)
-			goto fail;
-		cur_src = test_ring_inc_ptr(cur_src, esize[i], 2);
-
-		printf("enqueue MAX_BULK objs\n");
-		ret = test_ring_enqueue(r, cur_src, esize[i], MAX_BULK,
-						api_type);
-		if (ret != MAX_BULK)
-			goto fail;
-		cur_src = test_ring_inc_ptr(cur_src, esize[i], MAX_BULK);
-
-		printf("dequeue 1 obj\n");
-		ret = test_ring_dequeue(r, cur_dst, esize[i], 1, api_type);
-		if (ret != 1)
-			goto fail;
-		cur_dst = test_ring_inc_ptr(cur_dst, esize[i], 1);
-
-		printf("dequeue 2 objs\n");
-		ret = test_ring_dequeue(r, cur_dst, esize[i], 2, api_type);
-		if (ret != 2)
-			goto fail;
-		cur_dst = test_ring_inc_ptr(cur_dst, esize[i], 2);
-
-		printf("dequeue MAX_BULK objs\n");
-		ret = test_ring_dequeue(r, cur_dst, esize[i], MAX_BULK,
-						api_type);
-		if (ret != MAX_BULK)
-			goto fail;
-		cur_dst = test_ring_inc_ptr(cur_dst, esize[i], MAX_BULK);
-
-		/* check data */
-		if (memcmp(src, dst, cur_dst - dst)) {
-			rte_hexdump(stdout, "src", src, cur_src - src);
-			rte_hexdump(stdout, "dst", dst, cur_dst - dst);
-			printf("data after dequeue is not the same\n");
-			goto fail;
-		}
-
-		/* Free memory before test completed */
-		rte_ring_free(r);
-		rte_free(src);
-		rte_free(dst);
-		r = NULL;
-		src = NULL;
-		dst = NULL;
+	test_ring_print_test_string(tname, api_type, esize);
+
+	/* Create the ring */
+	r = test_ring_create("test_ring_burst_bulk_tests", esize,
+				RING_SIZE, SOCKET_ID_ANY, create_flags);
+
+	/* alloc dummy object pointers */
+	src = test_ring_calloc(RING_SIZE * 2, esize);
+	if (src == NULL)
+		goto fail;
+	test_ring_mem_init(src, RING_SIZE * 2, esize);
+	cur_src = src;
+
+	/* alloc some room for copied objects */
+	dst = test_ring_calloc(RING_SIZE * 2, esize);
+	if (dst == NULL)
+		goto fail;
+	cur_dst = dst;
+
+	printf("enqueue 1 obj\n");
+	ret = test_ring_enqueue(r, cur_src, esize, 1, api_type);
+	if (ret != 1)
+		goto fail;
+	cur_src = test_ring_inc_ptr(cur_src, esize, 1);
+
+	printf("enqueue 2 objs\n");
+	ret = test_ring_enqueue(r, cur_src, esize, 2, api_type);
+	if (ret != 2)
+		goto fail;
+	cur_src = test_ring_inc_ptr(cur_src, esize, 2);
+
+	printf("enqueue MAX_BULK objs\n");
+	ret = test_ring_enqueue(r, cur_src, esize, MAX_BULK, api_type);
+	if (ret != MAX_BULK)
+		goto fail;
+	cur_src = test_ring_inc_ptr(cur_src, esize, MAX_BULK);
+
+	printf("dequeue 1 obj\n");
+	ret = test_ring_dequeue(r, cur_dst, esize, 1, api_type);
+	if (ret != 1)
+		goto fail;
+	cur_dst = test_ring_inc_ptr(cur_dst, esize, 1);
+
+	printf("dequeue 2 objs\n");
+	ret = test_ring_dequeue(r, cur_dst, esize, 2, api_type);
+	if (ret != 2)
+		goto fail;
+	cur_dst = test_ring_inc_ptr(cur_dst, esize, 2);
+
+	printf("dequeue MAX_BULK objs\n");
+	ret = test_ring_dequeue(r, cur_dst, esize, MAX_BULK, api_type);
+	if (ret != MAX_BULK)
+		goto fail;
+	cur_dst = test_ring_inc_ptr(cur_dst, esize, MAX_BULK);
+
+	/* check data */
+	if (memcmp(src, dst, cur_dst - dst)) {
+		rte_hexdump(stdout, "src", src, cur_src - src);
+		rte_hexdump(stdout, "dst", dst, cur_dst - dst);
+		printf("data after dequeue is not the same\n");
+		goto fail;
 	}
 
+	/* Free memory before test completed */
+	rte_ring_free(r);
+	rte_free(src);
+	rte_free(dst);
+	r = NULL;
+	src = NULL;
+	dst = NULL;
+
 	return 0;
 fail:
 	rte_ring_free(r);
@@ -390,68 +379,62 @@  test_ring_burst_bulk_tests2(unsigned int api_type, unsigned int create_flags,
  * Enqueue and dequeue to cover the entire ring length.
  */
 static int
-test_ring_burst_bulk_tests3(unsigned int api_type, unsigned int create_flags,
-	const char *tname)
+test_ring_burst_bulk_tests3(unsigned int api_type, const unsigned int esize,
+	unsigned int create_flags, const char *tname)
 {
 	struct rte_ring *r;
 	void **src = NULL, **cur_src = NULL, **dst = NULL, **cur_dst = NULL;
 	int ret;
-	unsigned int i, j;
-
-	for (i = 0; i < RTE_DIM(esize); i++) {
-		test_ring_print_test_string(tname, api_type, esize[i]);
-
-		/* Create the ring */
-		r = test_ring_create("test_ring_burst_bulk_tests", esize[i],
-					RING_SIZE, SOCKET_ID_ANY, create_flags);
-
-		/* alloc dummy object pointers */
-		src = test_ring_calloc(RING_SIZE * 2, esize[i]);
-		if (src == NULL)
+	unsigned int j;
+
+	test_ring_print_test_string(tname, api_type, esize);
+
+	/* Create the ring */
+	r = test_ring_create("test_ring_burst_bulk_tests", esize,
+				RING_SIZE, SOCKET_ID_ANY, create_flags);
+
+	/* alloc dummy object pointers */
+	src = test_ring_calloc(RING_SIZE * 2, esize);
+	if (src == NULL)
+		goto fail;
+	test_ring_mem_init(src, RING_SIZE * 2, esize);
+	cur_src = src;
+
+	/* alloc some room for copied objects */
+	dst = test_ring_calloc(RING_SIZE * 2, esize);
+	if (dst == NULL)
+		goto fail;
+	cur_dst = dst;
+
+	printf("fill and empty the ring\n");
+	for (j = 0; j < RING_SIZE / MAX_BULK; j++) {
+		ret = test_ring_enqueue(r, cur_src, esize, MAX_BULK, api_type);
+		if (ret != MAX_BULK)
 			goto fail;
-		test_ring_mem_init(src, RING_SIZE * 2, esize[i]);
-		cur_src = src;
+		cur_src = test_ring_inc_ptr(cur_src, esize, MAX_BULK);
 
-		/* alloc some room for copied objects */
-		dst = test_ring_calloc(RING_SIZE * 2, esize[i]);
-		if (dst == NULL)
-			goto fail;
-		cur_dst = dst;
-
-		printf("fill and empty the ring\n");
-		for (j = 0; j < RING_SIZE / MAX_BULK; j++) {
-			ret = test_ring_enqueue(r, cur_src, esize[i], MAX_BULK,
-							api_type);
-			if (ret != MAX_BULK)
-				goto fail;
-			cur_src = test_ring_inc_ptr(cur_src, esize[i],
-								MAX_BULK);
-
-			ret = test_ring_dequeue(r, cur_dst, esize[i], MAX_BULK,
-							api_type);
-			if (ret != MAX_BULK)
-				goto fail;
-			cur_dst = test_ring_inc_ptr(cur_dst, esize[i],
-								MAX_BULK);
-		}
-
-		/* check data */
-		if (memcmp(src, dst, cur_dst - dst)) {
-			rte_hexdump(stdout, "src", src, cur_src - src);
-			rte_hexdump(stdout, "dst", dst, cur_dst - dst);
-			printf("data after dequeue is not the same\n");
+		ret = test_ring_dequeue(r, cur_dst, esize, MAX_BULK, api_type);
+		if (ret != MAX_BULK)
 			goto fail;
-		}
+		cur_dst = test_ring_inc_ptr(cur_dst, esize, MAX_BULK);
+	}
 
-		/* Free memory before test completed */
-		rte_ring_free(r);
-		rte_free(src);
-		rte_free(dst);
-		r = NULL;
-		src = NULL;
-		dst = NULL;
+	/* check data */
+	if (memcmp(src, dst, cur_dst - dst)) {
+		rte_hexdump(stdout, "src", src, cur_src - src);
+		rte_hexdump(stdout, "dst", dst, cur_dst - dst);
+		printf("data after dequeue is not the same\n");
+		goto fail;
 	}
 
+	/* Free memory before test completed */
+	rte_ring_free(r);
+	rte_free(src);
+	rte_free(dst);
+	r = NULL;
+	src = NULL;
+	dst = NULL;
+
 	return 0;
 fail:
 	rte_ring_free(r);
@@ -465,123 +448,116 @@  test_ring_burst_bulk_tests3(unsigned int api_type, unsigned int create_flags,
  * Enqueue till the ring is full and dequeue till the ring becomes empty.
  */
 static int
-test_ring_burst_bulk_tests4(unsigned int api_type, unsigned int create_flags,
-	const char *tname)
+test_ring_burst_bulk_tests4(unsigned int api_type, const unsigned int esize,
+	unsigned int create_flags, const char *tname)
 {
 	struct rte_ring *r;
 	void **src = NULL, **cur_src = NULL, **dst = NULL, **cur_dst = NULL;
 	int ret;
-	unsigned int i, j;
+	unsigned int j;
 	unsigned int num_elems;
 
-	for (i = 0; i < RTE_DIM(esize); i++) {
-		test_ring_print_test_string(tname, api_type, esize[i]);
+	test_ring_print_test_string(tname, api_type, esize);
 
-		/* Create the ring */
-		r = test_ring_create("test_ring_burst_bulk_tests", esize[i],
-					RING_SIZE, SOCKET_ID_ANY, create_flags);
-
-		/* alloc dummy object pointers */
-		src = test_ring_calloc(RING_SIZE * 2, esize[i]);
-		if (src == NULL)
-			goto fail;
-		test_ring_mem_init(src, RING_SIZE * 2, esize[i]);
-		cur_src = src;
-
-		/* alloc some room for copied objects */
-		dst = test_ring_calloc(RING_SIZE * 2, esize[i]);
-		if (dst == NULL)
-			goto fail;
-		cur_dst = dst;
-
-		printf("Test enqueue without enough memory space\n");
-		for (j = 0; j < (RING_SIZE/MAX_BULK - 1); j++) {
-			ret = test_ring_enqueue(r, cur_src, esize[i], MAX_BULK,
-							api_type);
-			if (ret != MAX_BULK)
-				goto fail;
-			cur_src = test_ring_inc_ptr(cur_src, esize[i],
-								MAX_BULK);
-		}
+	/* Create the ring */
+	r = test_ring_create("test_ring_burst_bulk_tests", esize,
+				RING_SIZE, SOCKET_ID_ANY, create_flags);
 
-		printf("Enqueue 2 objects, free entries = MAX_BULK - 2\n");
-		ret = test_ring_enqueue(r, cur_src, esize[i], 2, api_type);
-		if (ret != 2)
-			goto fail;
-		cur_src = test_ring_inc_ptr(cur_src, esize[i], 2);
-
-		printf("Enqueue the remaining entries = MAX_BULK - 3\n");
-		/* Bulk APIs enqueue exact number of elements */
-		if ((api_type & TEST_RING_ELEM_BULK) == TEST_RING_ELEM_BULK)
-			num_elems = MAX_BULK - 3;
-		else
-			num_elems = MAX_BULK;
-		/* Always one free entry left */
-		ret = test_ring_enqueue(r, cur_src, esize[i], num_elems,
-						api_type);
-		if (ret != MAX_BULK - 3)
-			goto fail;
-		cur_src = test_ring_inc_ptr(cur_src, esize[i], MAX_BULK - 3);
+	/* alloc dummy object pointers */
+	src = test_ring_calloc(RING_SIZE * 2, esize);
+	if (src == NULL)
+		goto fail;
+	test_ring_mem_init(src, RING_SIZE * 2, esize);
+	cur_src = src;
 
-		printf("Test if ring is full\n");
-		if (rte_ring_full(r) != 1)
-			goto fail;
+	/* alloc some room for copied objects */
+	dst = test_ring_calloc(RING_SIZE * 2, esize);
+	if (dst == NULL)
+		goto fail;
+	cur_dst = dst;
 
-		printf("Test enqueue for a full entry\n");
-		ret = test_ring_enqueue(r, cur_src, esize[i], MAX_BULK,
-						api_type);
-		if (ret != 0)
+	printf("Test enqueue without enough memory space\n");
+	for (j = 0; j < (RING_SIZE/MAX_BULK - 1); j++) {
+		ret = test_ring_enqueue(r, cur_src, esize, MAX_BULK, api_type);
+		if (ret != MAX_BULK)
 			goto fail;
+		cur_src = test_ring_inc_ptr(cur_src, esize, MAX_BULK);
+	}
 
-		printf("Test dequeue without enough objects\n");
-		for (j = 0; j < RING_SIZE / MAX_BULK - 1; j++) {
-			ret = test_ring_dequeue(r, cur_dst, esize[i], MAX_BULK,
-							api_type);
-			if (ret != MAX_BULK)
-				goto fail;
-			cur_dst = test_ring_inc_ptr(cur_dst, esize[i],
-								MAX_BULK);
-		}
-
-		/* Available memory space for the exact MAX_BULK entries */
-		ret = test_ring_dequeue(r, cur_dst, esize[i], 2, api_type);
-		if (ret != 2)
-			goto fail;
-		cur_dst = test_ring_inc_ptr(cur_dst, esize[i], 2);
-
-		/* Bulk APIs enqueue exact number of elements */
-		if ((api_type & TEST_RING_ELEM_BULK) == TEST_RING_ELEM_BULK)
-			num_elems = MAX_BULK - 3;
-		else
-			num_elems = MAX_BULK;
-		ret = test_ring_dequeue(r, cur_dst, esize[i], num_elems,
-						api_type);
-		if (ret != MAX_BULK - 3)
-			goto fail;
-		cur_dst = test_ring_inc_ptr(cur_dst, esize[i], MAX_BULK - 3);
+	printf("Enqueue 2 objects, free entries = MAX_BULK - 2\n");
+	ret = test_ring_enqueue(r, cur_src, esize, 2, api_type);
+	if (ret != 2)
+		goto fail;
+	cur_src = test_ring_inc_ptr(cur_src, esize, 2);
 
-		printf("Test if ring is empty\n");
-		/* Check if ring is empty */
-		if (rte_ring_empty(r) != 1)
+	printf("Enqueue the remaining entries = MAX_BULK - 3\n");
+	/* Bulk APIs enqueue exact number of elements */
+	if ((api_type & TEST_RING_ELEM_BULK) == TEST_RING_ELEM_BULK)
+		num_elems = MAX_BULK - 3;
+	else
+		num_elems = MAX_BULK;
+	/* Always one free entry left */
+	ret = test_ring_enqueue(r, cur_src, esize, num_elems, api_type);
+	if (ret != MAX_BULK - 3)
+		goto fail;
+	cur_src = test_ring_inc_ptr(cur_src, esize, MAX_BULK - 3);
+
+	printf("Test if ring is full\n");
+	if (rte_ring_full(r) != 1)
+		goto fail;
+
+	printf("Test enqueue for a full entry\n");
+	ret = test_ring_enqueue(r, cur_src, esize, MAX_BULK,
+					api_type);
+	if (ret != 0)
+		goto fail;
+
+	printf("Test dequeue without enough objects\n");
+	for (j = 0; j < RING_SIZE / MAX_BULK - 1; j++) {
+		ret = test_ring_dequeue(r, cur_dst, esize, MAX_BULK, api_type);
+		if (ret != MAX_BULK)
 			goto fail;
+		cur_dst = test_ring_inc_ptr(cur_dst, esize, MAX_BULK);
+	}
 
-		/* check data */
-		if (memcmp(src, dst, cur_dst - dst)) {
-			rte_hexdump(stdout, "src", src, cur_src - src);
-			rte_hexdump(stdout, "dst", dst, cur_dst - dst);
-			printf("data after dequeue is not the same\n");
-			goto fail;
-		}
+	/* Available memory space for the exact MAX_BULK entries */
+	ret = test_ring_dequeue(r, cur_dst, esize, 2, api_type);
+	if (ret != 2)
+		goto fail;
+	cur_dst = test_ring_inc_ptr(cur_dst, esize, 2);
 
-		/* Free memory before test completed */
-		rte_ring_free(r);
-		rte_free(src);
-		rte_free(dst);
-		r = NULL;
-		src = NULL;
-		dst = NULL;
+	/* Bulk APIs enqueue exact number of elements */
+	if ((api_type & TEST_RING_ELEM_BULK) == TEST_RING_ELEM_BULK)
+		num_elems = MAX_BULK - 3;
+	else
+		num_elems = MAX_BULK;
+	ret = test_ring_dequeue(r, cur_dst, esize, num_elems,
+					api_type);
+	if (ret != MAX_BULK - 3)
+		goto fail;
+	cur_dst = test_ring_inc_ptr(cur_dst, esize, MAX_BULK - 3);
+
+	printf("Test if ring is empty\n");
+	/* Check if ring is empty */
+	if (rte_ring_empty(r) != 1)
+		goto fail;
+
+	/* check data */
+	if (memcmp(src, dst, cur_dst - dst)) {
+		rte_hexdump(stdout, "src", src, cur_src - src);
+		rte_hexdump(stdout, "dst", dst, cur_dst - dst);
+		printf("data after dequeue is not the same\n");
+		goto fail;
 	}
 
+	/* Free memory before test completed */
+	rte_ring_free(r);
+	rte_free(src);
+	rte_free(dst);
+	r = NULL;
+	src = NULL;
+	dst = NULL;
+
 	return 0;
 fail:
 	rte_ring_free(r);
@@ -853,55 +829,57 @@  test_ring(void)
 	for (j = TEST_RING_ELEM_BULK; j <= TEST_RING_ELEM_BURST; j <<= 1)
 		for (i = TEST_RING_THREAD_DEF;
 					i <= TEST_RING_THREAD_MPMC; i <<= 1)
-			if (test_ring_burst_bulk_tests1(i | j, 0, tname) < 0)
+			if (test_ring_burst_bulk_tests1(i | j,
+							-1, 0, tname) < 0)
 				goto test_fail;
 
 	for (j = TEST_RING_ELEM_BULK; j <= TEST_RING_ELEM_BURST; j <<= 1)
 		for (i = TEST_RING_THREAD_DEF;
 					i <= TEST_RING_THREAD_MPMC; i <<= 1)
-			if (test_ring_burst_bulk_tests2(i | j, 0, tname) < 0)
+			if (test_ring_burst_bulk_tests2(i | j, 4, 0, tname) < 0)
 				goto test_fail;
 
 	for (j = TEST_RING_ELEM_BULK; j <= TEST_RING_ELEM_BURST; j <<= 1)
 		for (i = TEST_RING_THREAD_DEF;
 					i <= TEST_RING_THREAD_MPMC; i <<= 1)
-			if (test_ring_burst_bulk_tests3(i | j, 0, tname) < 0)
+			if (test_ring_burst_bulk_tests3(i | j, 8, 0, tname) < 0)
 				goto test_fail;
 
-	for (j = TEST_RING_ELEM_BULK; j <= TEST_RING_ELEM_BURST; j <<= 1)
+	for (j = TEST_RING_ELEM_BULK; j < TEST_RING_ELEM_BURST; j <<= 1)
 		for (i = TEST_RING_THREAD_DEF;
 					i <= TEST_RING_THREAD_MPMC; i <<= 1)
-			if (test_ring_burst_bulk_tests4(i | j, 0, tname) < 0)
+			if (test_ring_burst_bulk_tests4(i | j,
+							16, 0, tname) < 0)
 				goto test_fail;
 
 	/* Burst and bulk operations with MT_RTS and MT_HTS sync modes */
 	for (i = 0; i != RTE_DIM(test_sync_modes); i++) {
-		for (j = TEST_RING_ELEM_BULK; j <= TEST_RING_ELEM_BURST;
+		for (j = TEST_RING_ELEM_BULK; j < TEST_RING_ELEM_BURST;
 				j <<= 1) {
 
 			rc = test_ring_burst_bulk_tests1(
-				TEST_RING_THREAD_DEF | j,
+				TEST_RING_THREAD_DEF | j, -1,
 				test_sync_modes[i].create_flags,
 				test_sync_modes[i].name);
 			if (rc < 0)
 				goto test_fail;
 
 			rc = test_ring_burst_bulk_tests2(
-				TEST_RING_THREAD_DEF | j,
+				TEST_RING_THREAD_DEF | j, 4,
 				test_sync_modes[i].create_flags,
 				test_sync_modes[i].name);
 			if (rc < 0)
 				goto test_fail;
 
 			rc = test_ring_burst_bulk_tests3(
-				TEST_RING_THREAD_DEF | j,
+				TEST_RING_THREAD_DEF | j, 8,
 				test_sync_modes[i].create_flags,
 				test_sync_modes[i].name);
 			if (rc < 0)
 				goto test_fail;
 
-			rc = test_ring_burst_bulk_tests3(
-				TEST_RING_THREAD_DEF | j,
+			rc = test_ring_burst_bulk_tests4(
+				TEST_RING_THREAD_DEF | j, 16,
 				test_sync_modes[i].create_flags,
 				test_sync_modes[i].name);
 			if (rc < 0)