DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] test/ring: fix long compilation time
@ 2020-04-30  1:56 Honnappa Nagarahalli
  2020-04-30 10:23 ` Thomas Monjalon
  2020-04-30 12:55 ` Aaron Conole
  0 siblings, 2 replies; 11+ messages in thread
From: Honnappa Nagarahalli @ 2020-04-30  1:56 UTC (permalink / raw)
  To: dev, konstantin.ananyev, thomas, aconole, honnappa.nagarahalli
  Cc: ruifeng.wang, nd

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(-)

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)
-- 
2.17.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [dpdk-dev] [PATCH] test/ring: fix long compilation time
  2020-04-30  1:56 [dpdk-dev] [PATCH] test/ring: fix long compilation time Honnappa Nagarahalli
@ 2020-04-30 10:23 ` Thomas Monjalon
  2020-06-16 12:47   ` Thomas Monjalon
  2020-04-30 12:55 ` Aaron Conole
  1 sibling, 1 reply; 11+ messages in thread
From: Thomas Monjalon @ 2020-04-30 10:23 UTC (permalink / raw)
  To: Honnappa Nagarahalli; +Cc: dev, konstantin.ananyev, aconole, ruifeng.wang, nd

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




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [dpdk-dev] [PATCH] test/ring: fix long compilation time
  2020-04-30  1:56 [dpdk-dev] [PATCH] test/ring: fix long compilation time Honnappa Nagarahalli
  2020-04-30 10:23 ` Thomas Monjalon
@ 2020-04-30 12:55 ` Aaron Conole
  2020-04-30 16:03   ` Honnappa Nagarahalli
  2020-05-01 12:56   ` Aaron Conole
  1 sibling, 2 replies; 11+ messages in thread
From: Aaron Conole @ 2020-04-30 12:55 UTC (permalink / raw)
  To: Honnappa Nagarahalli; +Cc: dev, konstantin.ananyev, thomas, ruifeng.wang, nd

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.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [dpdk-dev] [PATCH] test/ring: fix long compilation time
  2020-04-30 12:55 ` Aaron Conole
@ 2020-04-30 16:03   ` Honnappa Nagarahalli
  2020-04-30 17:01     ` Aaron Conole
  2020-05-01 12:56   ` Aaron Conole
  1 sibling, 1 reply; 11+ messages in thread
From: Honnappa Nagarahalli @ 2020-04-30 16:03 UTC (permalink / raw)
  To: Aaron Conole
  Cc: dev, konstantin.ananyev, thomas, Ruifeng Wang, nd,
	Honnappa Nagarahalli, nd

<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.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [dpdk-dev] [PATCH] test/ring: fix long compilation time
  2020-04-30 16:03   ` Honnappa Nagarahalli
@ 2020-04-30 17:01     ` Aaron Conole
  2020-04-30 19:51       ` Honnappa Nagarahalli
  0 siblings, 1 reply; 11+ messages in thread
From: Aaron Conole @ 2020-04-30 17:01 UTC (permalink / raw)
  To: Honnappa Nagarahalli; +Cc: dev, konstantin.ananyev, thomas, Ruifeng Wang, nd

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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [dpdk-dev] [PATCH] test/ring: fix long compilation time
  2020-04-30 17:01     ` Aaron Conole
@ 2020-04-30 19:51       ` Honnappa Nagarahalli
  0 siblings, 0 replies; 11+ messages in thread
From: Honnappa Nagarahalli @ 2020-04-30 19:51 UTC (permalink / raw)
  To: Aaron Conole
  Cc: dev, konstantin.ananyev, thomas, Ruifeng Wang, nd,
	Honnappa Nagarahalli, nd

> > <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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [dpdk-dev] [PATCH] test/ring: fix long compilation time
  2020-04-30 12:55 ` Aaron Conole
  2020-04-30 16:03   ` Honnappa Nagarahalli
@ 2020-05-01 12:56   ` Aaron Conole
  1 sibling, 0 replies; 11+ messages in thread
From: Aaron Conole @ 2020-05-01 12:56 UTC (permalink / raw)
  To: Honnappa Nagarahalli; +Cc: dev, konstantin.ananyev, thomas, ruifeng.wang, nd

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.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [dpdk-dev] [PATCH] test/ring: fix long compilation time
  2020-04-30 10:23 ` Thomas Monjalon
@ 2020-06-16 12:47   ` Thomas Monjalon
  2020-06-25  8:19     ` David Marchand
  0 siblings, 1 reply; 11+ messages in thread
From: Thomas Monjalon @ 2020-06-16 12:47 UTC (permalink / raw)
  To: Honnappa Nagarahalli, konstantin.ananyev; +Cc: dev, aconole, ruifeng.wang, nd

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?




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [dpdk-dev] [PATCH] test/ring: fix long compilation time
  2020-06-16 12:47   ` Thomas Monjalon
@ 2020-06-25  8:19     ` David Marchand
  2020-06-25 11:05       ` Ananyev, Konstantin
  0 siblings, 1 reply; 11+ messages in thread
From: David Marchand @ 2020-06-25  8:19 UTC (permalink / raw)
  To: Honnappa Nagarahalli, Ananyev, Konstantin
  Cc: dev, Aaron Conole, Ruifeng Wang (Arm Technology China),
	nd, Thomas Monjalon

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.


-- 
David Marchand


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [dpdk-dev] [PATCH] test/ring: fix long compilation time
  2020-06-25  8:19     ` David Marchand
@ 2020-06-25 11:05       ` Ananyev, Konstantin
  2020-07-02 20:42         ` Honnappa Nagarahalli
  0 siblings, 1 reply; 11+ messages in thread
From: Ananyev, Konstantin @ 2020-06-25 11:05 UTC (permalink / raw)
  To: David Marchand, Honnappa Nagarahalli
  Cc: dev, Aaron Conole, Ruifeng Wang (Arm Technology China),
	nd, Thomas Monjalon

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



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [dpdk-dev] [PATCH] test/ring: fix long compilation time
  2020-06-25 11:05       ` Ananyev, Konstantin
@ 2020-07-02 20:42         ` Honnappa Nagarahalli
  0 siblings, 0 replies; 11+ messages in thread
From: Honnappa Nagarahalli @ 2020-07-02 20:42 UTC (permalink / raw)
  To: Ananyev, Konstantin, David Marchand
  Cc: dev, Aaron Conole, Ruifeng Wang, nd, thomas, Honnappa Nagarahalli, nd

<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.

> 


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2020-07-02 20:42 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-30  1:56 [dpdk-dev] [PATCH] test/ring: fix long compilation time Honnappa Nagarahalli
2020-04-30 10:23 ` Thomas Monjalon
2020-06-16 12:47   ` Thomas Monjalon
2020-06-25  8:19     ` David Marchand
2020-06-25 11:05       ` Ananyev, Konstantin
2020-07-02 20:42         ` Honnappa Nagarahalli
2020-04-30 12:55 ` Aaron Conole
2020-04-30 16:03   ` Honnappa Nagarahalli
2020-04-30 17:01     ` Aaron Conole
2020-04-30 19:51       ` Honnappa Nagarahalli
2020-05-01 12:56   ` Aaron Conole

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).