[v2,2/2] test/mempool: add zero-copy API's

Message ID 20230210065407.209567-3-kamalakshitha.aligeri@arm.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series Integrated mempool cache zero-copy API's |

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/loongarch-compilation fail ninja build failure
ci/Intel-compilation fail Compilation issues
ci/github-robot: build fail github build: failed

Commit Message

Kamalakshitha Aligeri Feb. 10, 2023, 6:54 a.m. UTC
  Added mempool test cases with zero-copy get and put API's

Signed-off-by: Kamalakshitha Aligeri <kamalakshitha.aligeri@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Feifei Wang <feifei.wang2@arm.com>
---
Link: https://patchwork.dpdk.org/project/dpdk/patch/20230209145833.129986-1-mb@smartsharesystems.com/

 app/test/test_mempool.c | 81 ++++++++++++++++++++++++++++++-----------
 1 file changed, 60 insertions(+), 21 deletions(-)

--
2.25.1
  

Comments

Morten Brørup Feb. 10, 2023, 7:33 a.m. UTC | #1
> From: Kamalakshitha Aligeri [mailto:kamalakshitha.aligeri@arm.com]
> Sent: Friday, 10 February 2023 07.54
> 
> Added mempool test cases with zero-copy get and put API's
> 
> Signed-off-by: Kamalakshitha Aligeri <kamalakshitha.aligeri@arm.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> Reviewed-by: Feifei Wang <feifei.wang2@arm.com>

I already acked v1 of this patch, but here it is again for Patchwork:

Acked-by: Morten Brørup <mb@smartsharesystems.com>

> ---
> Link:
> https://patchwork.dpdk.org/project/dpdk/patch/20230209145833.129986-1-
> mb@smartsharesystems.com/

@David, here's the zero-copy mempool cache API test cases you were asking for.
  
Thomas Monjalon Feb. 20, 2023, 1:52 p.m. UTC | #2
10/02/2023 08:33, Morten Brørup:
> > From: Kamalakshitha Aligeri [mailto:kamalakshitha.aligeri@arm.com]
> > Sent: Friday, 10 February 2023 07.54
> > 
> > Added mempool test cases with zero-copy get and put API's
> > 
> > Signed-off-by: Kamalakshitha Aligeri <kamalakshitha.aligeri@arm.com>
> > Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> > Reviewed-by: Feifei Wang <feifei.wang2@arm.com>
> 
> I already acked v1 of this patch, but here it is again for Patchwork:
> 
> Acked-by: Morten Brørup <mb@smartsharesystems.com>
> 
> > ---
> > Link:
> > https://patchwork.dpdk.org/project/dpdk/patch/20230209145833.129986-1-
> > mb@smartsharesystems.com/
> 
> @David, here's the zero-copy mempool cache API test cases you were asking for.

The unit tests should be squashed in the mempool lib patch.

Also I would to see a review from the mempool maintainers.
  
Kamalakshitha Aligeri Feb. 21, 2023, 8:18 p.m. UTC | #3
Hi Thomas,

Do you want me to squash the unit tests in the mempool lib patch or do I have to wait for the reviews from mempool maintainers


Thanks,
Kamalakshitha

> -----Original Message-----
> From: Thomas Monjalon <thomas@monjalon.net>
> Sent: Monday, February 20, 2023 5:53 AM
> To: olivier.matz@6wind.com; andrew.rybchenko@oktetlabs.ru; Morten
> Brørup <mb@smartsharesystems.com>
> Cc: Kamalakshitha Aligeri <Kamalakshitha.Aligeri@arm.com>;
> Yuying.Zhang@intel.com; beilei.xing@intel.com;
> bruce.richardson@intel.com; konstantin.ananyev@huawei.com; Honnappa
> Nagarahalli <Honnappa.Nagarahalli@arm.com>; Ruifeng Wang
> <Ruifeng.Wang@arm.com>; Feifei Wang <Feifei.Wang2@arm.com>;
> david.marchand@redhat.com; dev@dpdk.org; nd <nd@arm.com>
> Subject: Re: [PATCH v2 2/2] test/mempool: add zero-copy API's
> 
> 10/02/2023 08:33, Morten Brørup:
> > > From: Kamalakshitha Aligeri [mailto:kamalakshitha.aligeri@arm.com]
> > > Sent: Friday, 10 February 2023 07.54
> > >
> > > Added mempool test cases with zero-copy get and put API's
> > >
> > > Signed-off-by: Kamalakshitha Aligeri <kamalakshitha.aligeri@arm.com>
> > > Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> > > Reviewed-by: Feifei Wang <feifei.wang2@arm.com>
> >
> > I already acked v1 of this patch, but here it is again for Patchwork:
> >
> > Acked-by: Morten Brørup <mb@smartsharesystems.com>
> >
> > > ---
> > > Link:
> > >
> https://patchwork.dpdk.org/project/dpdk/patch/20230209145833.129986-1-
> > > mb@smartsharesystems.com/
> >
> > @David, here's the zero-copy mempool cache API test cases you were
> asking for.
> 
> The unit tests should be squashed in the mempool lib patch.
> 
> Also I would to see a review from the mempool maintainers.
>
  
Thomas Monjalon Feb. 22, 2023, 8:01 a.m. UTC | #4
21/02/2023 21:18, Kamalakshitha Aligeri:
> Hi Thomas,
> 
> Do you want me to squash the unit tests in the mempool lib patch or do I have to wait for the reviews from mempool maintainers

Yes I think you can do the squash if Morten agrees.


> From: Thomas Monjalon <thomas@monjalon.net>
> > 10/02/2023 08:33, Morten Brørup:
> > > > From: Kamalakshitha Aligeri [mailto:kamalakshitha.aligeri@arm.com]
> > > > Sent: Friday, 10 February 2023 07.54
> > > >
> > > > Added mempool test cases with zero-copy get and put API's
> > > >
> > > > Signed-off-by: Kamalakshitha Aligeri <kamalakshitha.aligeri@arm.com>
> > > > Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> > > > Reviewed-by: Feifei Wang <feifei.wang2@arm.com>
> > >
> > > I already acked v1 of this patch, but here it is again for Patchwork:
> > >
> > > Acked-by: Morten Brørup <mb@smartsharesystems.com>
> > >
> > > > ---
> > > > Link:
> > > >
> > https://patchwork.dpdk.org/project/dpdk/patch/20230209145833.129986-1-
> > > > mb@smartsharesystems.com/
> > >
> > > @David, here's the zero-copy mempool cache API test cases you were
> > asking for.
> > 
> > The unit tests should be squashed in the mempool lib patch.
> > 
> > Also I would to see a review from the mempool maintainers.
> > 
> 
>
  
Morten Brørup Feb. 22, 2023, 8:24 a.m. UTC | #5
> From: Thomas Monjalon [mailto:thomas@monjalon.net]
> Sent: Wednesday, 22 February 2023 09.01
> 
> 21/02/2023 21:18, Kamalakshitha Aligeri:
> > Hi Thomas,
> >
> > Do you want me to squash the unit tests in the mempool lib patch or do I
> have to wait for the reviews from mempool maintainers
> 
> Yes I think you can do the squash if Morten agrees.

Yes, I agree. And if there are any more changes required before the code is accepted by the maintainers, I will let Kamalakshitha make those changes.


How should the different acks/review tags be handled when squashing two patches into one?

The library patch has:

Signed-off-by: Morten Brørup <mb@smartsharesystems.com>
Acked-by: Konstantin Ananyev <konstantin.v.ananyev@yandex.ru>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Kamalakshitha Aligeri <Kamalakshitha.aligeri@arm.com>

And the test patch has:

Signed-off-by: Kamalakshitha Aligeri <kamalakshitha.aligeri@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Feifei Wang <feifei.wang2@arm.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>

> 
> 
> > From: Thomas Monjalon <thomas@monjalon.net>
> > > 10/02/2023 08:33, Morten Brørup:
> > > > > From: Kamalakshitha Aligeri [mailto:kamalakshitha.aligeri@arm.com]
> > > > > Sent: Friday, 10 February 2023 07.54
> > > > >
> > > > > Added mempool test cases with zero-copy get and put API's
> > > > >
> > > > > Signed-off-by: Kamalakshitha Aligeri <kamalakshitha.aligeri@arm.com>
> > > > > Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> > > > > Reviewed-by: Feifei Wang <feifei.wang2@arm.com>
> > > >
> > > > I already acked v1 of this patch, but here it is again for Patchwork:
> > > >
> > > > Acked-by: Morten Brørup <mb@smartsharesystems.com>
> > > >
> > > > > ---
> > > > > Link:
> > > > >
> > > https://patchwork.dpdk.org/project/dpdk/patch/20230209145833.129986-1-
> > > > > mb@smartsharesystems.com/
> > > >
> > > > @David, here's the zero-copy mempool cache API test cases you were
> > > asking for.
> > >
> > > The unit tests should be squashed in the mempool lib patch.
> > >
> > > Also I would to see a review from the mempool maintainers.
  
Thomas Monjalon Feb. 22, 2023, 12:40 p.m. UTC | #6
22/02/2023 09:24, Morten Brørup:
> > From: Thomas Monjalon [mailto:thomas@monjalon.net]
> > Sent: Wednesday, 22 February 2023 09.01
> > 
> > 21/02/2023 21:18, Kamalakshitha Aligeri:
> > > Hi Thomas,
> > >
> > > Do you want me to squash the unit tests in the mempool lib patch or do I
> > have to wait for the reviews from mempool maintainers
> > 
> > Yes I think you can do the squash if Morten agrees.
> 
> Yes, I agree. And if there are any more changes required before the code is accepted by the maintainers, I will let Kamalakshitha make those changes.
> 
> 
> How should the different acks/review tags be handled when squashing two patches into one?
> 
> The library patch has:
> 
> Signed-off-by: Morten Brørup <mb@smartsharesystems.com>
> Acked-by: Konstantin Ananyev <konstantin.v.ananyev@yandex.ru>
> Acked-by: Chengwen Feng <fengchengwen@huawei.com>
> Acked-by: Kamalakshitha Aligeri <Kamalakshitha.aligeri@arm.com>
> 
> And the test patch has:
> 
> Signed-off-by: Kamalakshitha Aligeri <kamalakshitha.aligeri@arm.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> Reviewed-by: Feifei Wang <feifei.wang2@arm.com>
> Acked-by: Morten Brørup <mb@smartsharesystems.com>

The cleanest is to remove Reviewed and Acked-by and let reviewer check again.
About the sign-off, you keep both.
About the authorship, you must choose one.
  
Morten Brørup Feb. 22, 2023, 4:32 p.m. UTC | #7
> From: Thomas Monjalon [mailto:thomas@monjalon.net]
> Sent: Wednesday, 22 February 2023 13.41
> 
> 22/02/2023 09:24, Morten Brørup:
> > > From: Thomas Monjalon [mailto:thomas@monjalon.net]
> > > Sent: Wednesday, 22 February 2023 09.01
> > >
> > > 21/02/2023 21:18, Kamalakshitha Aligeri:
> > > > Hi Thomas,
> > > >
> > > > Do you want me to squash the unit tests in the mempool lib patch
> or do I
> > > have to wait for the reviews from mempool maintainers
> > >
> > > Yes I think you can do the squash if Morten agrees.
> >
> > Yes, I agree. And if there are any more changes required before the
> code is accepted by the maintainers, I will let Kamalakshitha make those
> changes.
> >
> >
> > How should the different acks/review tags be handled when squashing
> two patches into one?
> >
> > The library patch has:
> >
> > Signed-off-by: Morten Brørup <mb@smartsharesystems.com>
> > Acked-by: Konstantin Ananyev <konstantin.v.ananyev@yandex.ru>
> > Acked-by: Chengwen Feng <fengchengwen@huawei.com>
> > Acked-by: Kamalakshitha Aligeri <Kamalakshitha.aligeri@arm.com>
> >
> > And the test patch has:
> >
> > Signed-off-by: Kamalakshitha Aligeri <kamalakshitha.aligeri@arm.com>
> > Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> > Reviewed-by: Feifei Wang <feifei.wang2@arm.com>
> > Acked-by: Morten Brørup <mb@smartsharesystems.com>
> 
> The cleanest is to remove Reviewed and Acked-by and let reviewer check
> again.
> About the sign-off, you keep both.
> About the authorship, you must choose one.

Kamalakshitha, since I designed and fought for the mempool zero-copy API, which I consider the core part of the patch, I would prefer being designated as the author of the squashed patch.

I'm no expert at git, but I think the "From" tag indicates the author. So the tags in the squashed patch should be:

From: Morten Brørup <mb@smartsharesystems.com>
Signed-off-by: Morten Brørup <mb@smartsharesystems.com>
Signed-off-by: Kamalakshitha Aligeri <kamalakshitha.aligeri@arm.com>
  

Patch

diff --git a/app/test/test_mempool.c b/app/test/test_mempool.c
index 8e493eda47..6d29f5bc7b 100644
--- a/app/test/test_mempool.c
+++ b/app/test/test_mempool.c
@@ -74,7 +74,7 @@  my_obj_init(struct rte_mempool *mp, __rte_unused void *arg,

 /* basic tests (done on one core) */
 static int
-test_mempool_basic(struct rte_mempool *mp, int use_external_cache)
+test_mempool_basic(struct rte_mempool *mp, int use_external_cache, int use_zc_api)
 {
 	uint32_t *objnum;
 	void **objtable;
@@ -84,6 +84,7 @@  test_mempool_basic(struct rte_mempool *mp, int use_external_cache)
 	unsigned i, j;
 	int offset;
 	struct rte_mempool_cache *cache;
+	void **cache_objs;

 	if (use_external_cache) {
 		/* Create a user-owned mempool cache. */
@@ -100,8 +101,13 @@  test_mempool_basic(struct rte_mempool *mp, int use_external_cache)
 	rte_mempool_dump(stdout, mp);

 	printf("get an object\n");
-	if (rte_mempool_generic_get(mp, &obj, 1, cache) < 0)
-		GOTO_ERR(ret, out);
+	if (use_zc_api) {
+		cache_objs = rte_mempool_cache_zc_get_bulk(cache, mp, 1);
+		obj = *cache_objs;
+	} else {
+		if (rte_mempool_generic_get(mp, &obj, 1, cache) < 0)
+			GOTO_ERR(ret, out);
+	}
 	rte_mempool_dump(stdout, mp);

 	/* tests that improve coverage */
@@ -123,21 +129,41 @@  test_mempool_basic(struct rte_mempool *mp, int use_external_cache)
 #endif

 	printf("put the object back\n");
-	rte_mempool_generic_put(mp, &obj, 1, cache);
+	if (use_zc_api) {
+		cache_objs = rte_mempool_cache_zc_put_bulk(cache, mp, 1);
+		rte_memcpy(cache_objs, &obj, sizeof(void *));
+	} else {
+		rte_mempool_generic_put(mp, &obj, 1, cache);
+	}
 	rte_mempool_dump(stdout, mp);

 	printf("get 2 objects\n");
-	if (rte_mempool_generic_get(mp, &obj, 1, cache) < 0)
-		GOTO_ERR(ret, out);
-	if (rte_mempool_generic_get(mp, &obj2, 1, cache) < 0) {
-		rte_mempool_generic_put(mp, &obj, 1, cache);
-		GOTO_ERR(ret, out);
+	if (use_zc_api) {
+		cache_objs = rte_mempool_cache_zc_get_bulk(cache, mp, 1);
+		obj = *cache_objs;
+		cache_objs = rte_mempool_cache_zc_get_bulk(cache, mp, 1);
+		obj2 = *cache_objs;
+	} else {
+		if (rte_mempool_generic_get(mp, &obj, 1, cache) < 0)
+			GOTO_ERR(ret, out);
+		if (rte_mempool_generic_get(mp, &obj2, 1, cache) < 0) {
+			rte_mempool_generic_put(mp, &obj, 1, cache);
+			GOTO_ERR(ret, out);
+		}
 	}
 	rte_mempool_dump(stdout, mp);

 	printf("put the objects back\n");
-	rte_mempool_generic_put(mp, &obj, 1, cache);
-	rte_mempool_generic_put(mp, &obj2, 1, cache);
+	if (use_zc_api) {
+		cache_objs = rte_mempool_cache_zc_put_bulk(cache, mp, 1);
+		rte_memcpy(cache_objs, &obj, sizeof(void *));
+		cache_objs = rte_mempool_cache_zc_put_bulk(cache, mp, 1);
+		rte_memcpy(cache_objs, &obj2, sizeof(void *));
+
+	} else {
+		rte_mempool_generic_put(mp, &obj, 1, cache);
+		rte_mempool_generic_put(mp, &obj2, 1, cache);
+	}
 	rte_mempool_dump(stdout, mp);

 	/*
@@ -149,8 +175,13 @@  test_mempool_basic(struct rte_mempool *mp, int use_external_cache)
 		GOTO_ERR(ret, out);

 	for (i = 0; i < MEMPOOL_SIZE; i++) {
-		if (rte_mempool_generic_get(mp, &objtable[i], 1, cache) < 0)
-			break;
+		if (use_zc_api) {
+			cache_objs = rte_mempool_cache_zc_get_bulk(cache, mp, 1);
+			objtable[i] = *cache_objs;
+		} else {
+			if (rte_mempool_generic_get(mp, &objtable[i], 1, cache) < 0)
+				break;
+		}
 	}

 	/*
@@ -170,8 +201,12 @@  test_mempool_basic(struct rte_mempool *mp, int use_external_cache)
 			if (obj_data[j] != 0)
 				ret = -1;
 		}
-
-		rte_mempool_generic_put(mp, &objtable[i], 1, cache);
+		if (use_zc_api) {
+			cache_objs = rte_mempool_cache_zc_put_bulk(cache, mp, 1);
+			rte_memcpy(cache_objs, &objtable[i], sizeof(void *));
+		} else {
+			rte_mempool_generic_put(mp, &objtable[i], 1, cache);
+		}
 	}

 	free(objtable);
@@ -979,15 +1014,19 @@  test_mempool(void)
 	rte_mempool_list_dump(stdout);

 	/* basic tests without cache */
-	if (test_mempool_basic(mp_nocache, 0) < 0)
+	if (test_mempool_basic(mp_nocache, 0, 0) < 0)
+		GOTO_ERR(ret, err);
+
+	/* basic tests with zero-copy API's */
+	if (test_mempool_basic(mp_cache, 0, 1) < 0)
 		GOTO_ERR(ret, err);

-	/* basic tests with cache */
-	if (test_mempool_basic(mp_cache, 0) < 0)
+	/* basic tests with user-owned cache and zero-copy API's */
+	if (test_mempool_basic(mp_nocache, 1, 1) < 0)
 		GOTO_ERR(ret, err);

 	/* basic tests with user-owned cache */
-	if (test_mempool_basic(mp_nocache, 1) < 0)
+	if (test_mempool_basic(mp_nocache, 1, 0) < 0)
 		GOTO_ERR(ret, err);

 	/* more basic tests without cache */
@@ -1008,10 +1047,10 @@  test_mempool(void)
 		GOTO_ERR(ret, err);

 	/* test the stack handler */
-	if (test_mempool_basic(mp_stack, 1) < 0)
+	if (test_mempool_basic(mp_stack, 1, 0) < 0)
 		GOTO_ERR(ret, err);

-	if (test_mempool_basic(default_pool, 1) < 0)
+	if (test_mempool_basic(default_pool, 1, 0) < 0)
 		GOTO_ERR(ret, err);

 	/* test mempool event callbacks */