[v2,3/3] test/bbdev: explicit check for allocation failure

Message ID 20221206191441.12428-4-nicolas.chautru@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Maxime Coquelin
Headers
Series test/bbdev: fix build issues with optional build flag |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/github-robot: build success github build: passed
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS

Commit Message

Chautru, Nicolas Dec. 6, 2022, 7:14 p.m. UTC
  Adding check for error on return of the
rte_bbdev_*_op_alloc_bulk calls in bbdev-test.

Signed-off-by: Nicolas Chautru <nicolas.chautru@intel.com>
---
 app/test-bbdev/test_bbdev_perf.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
  

Comments

Maxime Coquelin Dec. 7, 2022, 8:40 a.m. UTC | #1
On 12/6/22 20:14, Nicolas Chautru wrote:
> Adding check for error on return of the
> rte_bbdev_*_op_alloc_bulk calls in bbdev-test.
> 
> Signed-off-by: Nicolas Chautru <nicolas.chautru@intel.com>
> ---
>   app/test-bbdev/test_bbdev_perf.c | 9 ++++++---
>   1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/app/test-bbdev/test_bbdev_perf.c b/app/test-bbdev/test_bbdev_perf.c
> index b2e536b5e3..a922d69ada 100644
> --- a/app/test-bbdev/test_bbdev_perf.c
> +++ b/app/test-bbdev/test_bbdev_perf.c
> @@ -4958,7 +4958,8 @@ offload_latency_test_fft(struct rte_mempool *mempool, struct test_buffers *bufs,
>   		if (unlikely(num_to_process - dequeued < burst_sz))
>   			burst_sz = num_to_process - dequeued;
>   
> -		rte_bbdev_fft_op_alloc_bulk(mempool, ops_enq, burst_sz);
> +		ret = rte_bbdev_fft_op_alloc_bulk(mempool, ops_enq, burst_sz);
> +		TEST_ASSERT_SUCCESS(ret, "Allocation failed for %d ops", ops_enq);
>   		if (test_vector.op_type != RTE_BBDEV_OP_NONE)
>   			copy_reference_fft_op(ops_enq, burst_sz, dequeued,
>   					bufs->inputs,
> @@ -5040,7 +5041,8 @@ offload_latency_test_dec(struct rte_mempool *mempool, struct test_buffers *bufs,
>   		if (unlikely(num_to_process - dequeued < burst_sz))
>   			burst_sz = num_to_process - dequeued;
>   
> -		rte_bbdev_dec_op_alloc_bulk(mempool, ops_enq, burst_sz);
> +		ret = rte_bbdev_dec_op_alloc_bulk(mempool, ops_enq, burst_sz);
> +		TEST_ASSERT_SUCCESS(ret, "Allocation failed for %d ops", ops_enq);
>   		if (test_vector.op_type != RTE_BBDEV_OP_NONE)
>   			copy_reference_dec_op(ops_enq, burst_sz, dequeued,
>   					bufs->inputs,
> @@ -5125,7 +5127,8 @@ offload_latency_test_ldpc_dec(struct rte_mempool *mempool,
>   		if (unlikely(num_to_process - dequeued < burst_sz))
>   			burst_sz = num_to_process - dequeued;
>   
> -		rte_bbdev_dec_op_alloc_bulk(mempool, ops_enq, burst_sz);
> +		ret = rte_bbdev_dec_op_alloc_bulk(mempool, ops_enq, burst_sz);
> +		TEST_ASSERT_SUCCESS(ret, "Allocation failed for %d ops", ops_enq);
>   		if (test_vector.op_type != RTE_BBDEV_OP_NONE)
>   			copy_reference_ldpc_dec_op(ops_enq, burst_sz, dequeued,
>   					bufs->inputs,

You need to add Fixes tag and cc stable.

Maxime
  
Chautru, Nicolas Dec. 7, 2022, 3:33 p.m. UTC | #2
Hi Maxime, 

I don’t believe this constitutes a fix, just adding more error check to be more comprehensive. Not required for stable branch really. Let me know if you disagree.

Can this be applied?

Thanks
Nic

> -----Original Message-----
> From: Maxime Coquelin <maxime.coquelin@redhat.com>
> Sent: Wednesday, December 7, 2022 12:40 AM
> To: Chautru, Nicolas <nicolas.chautru@intel.com>; dev@dpdk.org
> Cc: Vargas, Hernan <hernan.vargas@intel.com>; Vipin.Varghese@amd.com
> Subject: Re: [PATCH v2 3/3] test/bbdev: explicit check for allocation failure
> 
> 
> 
> On 12/6/22 20:14, Nicolas Chautru wrote:
> > Adding check for error on return of the rte_bbdev_*_op_alloc_bulk
> > calls in bbdev-test.
> >
> > Signed-off-by: Nicolas Chautru <nicolas.chautru@intel.com>
> > ---
> >   app/test-bbdev/test_bbdev_perf.c | 9 ++++++---
> >   1 file changed, 6 insertions(+), 3 deletions(-)
> >
> > diff --git a/app/test-bbdev/test_bbdev_perf.c
> > b/app/test-bbdev/test_bbdev_perf.c
> > index b2e536b5e3..a922d69ada 100644
> > --- a/app/test-bbdev/test_bbdev_perf.c
> > +++ b/app/test-bbdev/test_bbdev_perf.c
> > @@ -4958,7 +4958,8 @@ offload_latency_test_fft(struct rte_mempool
> *mempool, struct test_buffers *bufs,
> >   		if (unlikely(num_to_process - dequeued < burst_sz))
> >   			burst_sz = num_to_process - dequeued;
> >
> > -		rte_bbdev_fft_op_alloc_bulk(mempool, ops_enq, burst_sz);
> > +		ret = rte_bbdev_fft_op_alloc_bulk(mempool, ops_enq,
> burst_sz);
> > +		TEST_ASSERT_SUCCESS(ret, "Allocation failed for %d ops",
> ops_enq);
> >   		if (test_vector.op_type != RTE_BBDEV_OP_NONE)
> >   			copy_reference_fft_op(ops_enq, burst_sz,
> dequeued,
> >   					bufs->inputs,
> > @@ -5040,7 +5041,8 @@ offload_latency_test_dec(struct rte_mempool
> *mempool, struct test_buffers *bufs,
> >   		if (unlikely(num_to_process - dequeued < burst_sz))
> >   			burst_sz = num_to_process - dequeued;
> >
> > -		rte_bbdev_dec_op_alloc_bulk(mempool, ops_enq,
> burst_sz);
> > +		ret = rte_bbdev_dec_op_alloc_bulk(mempool, ops_enq,
> burst_sz);
> > +		TEST_ASSERT_SUCCESS(ret, "Allocation failed for %d ops",
> ops_enq);
> >   		if (test_vector.op_type != RTE_BBDEV_OP_NONE)
> >   			copy_reference_dec_op(ops_enq, burst_sz,
> dequeued,
> >   					bufs->inputs,
> > @@ -5125,7 +5127,8 @@ offload_latency_test_ldpc_dec(struct
> rte_mempool *mempool,
> >   		if (unlikely(num_to_process - dequeued < burst_sz))
> >   			burst_sz = num_to_process - dequeued;
> >
> > -		rte_bbdev_dec_op_alloc_bulk(mempool, ops_enq,
> burst_sz);
> > +		ret = rte_bbdev_dec_op_alloc_bulk(mempool, ops_enq,
> burst_sz);
> > +		TEST_ASSERT_SUCCESS(ret, "Allocation failed for %d ops",
> ops_enq);
> >   		if (test_vector.op_type != RTE_BBDEV_OP_NONE)
> >   			copy_reference_ldpc_dec_op(ops_enq, burst_sz,
> dequeued,
> >   					bufs->inputs,
> 
> You need to add Fixes tag and cc stable.
> 
> Maxime
  
Maxime Coquelin Dec. 9, 2022, 10:35 a.m. UTC | #3
Hi Nicolas,

On 12/7/22 16:33, Chautru, Nicolas wrote:
> Hi Maxime,
> 
> I don’t believe this constitutes a fix, just adding more error check to be more comprehensive. Not required for stable branch really. Let me know if you disagree.

I think we should backport it since it constitutes a fix.
Without it, user could face a segfault, so it fixes a potential
segfault.


> Can this be applied?

Yes, with fixes tags.
I can add them while applying if you agree.

Regards,
Maxime

> Thanks
> Nic
> 
>> -----Original Message-----
>> From: Maxime Coquelin <maxime.coquelin@redhat.com>
>> Sent: Wednesday, December 7, 2022 12:40 AM
>> To: Chautru, Nicolas <nicolas.chautru@intel.com>; dev@dpdk.org
>> Cc: Vargas, Hernan <hernan.vargas@intel.com>; Vipin.Varghese@amd.com
>> Subject: Re: [PATCH v2 3/3] test/bbdev: explicit check for allocation failure
>>
>>
>>
>> On 12/6/22 20:14, Nicolas Chautru wrote:
>>> Adding check for error on return of the rte_bbdev_*_op_alloc_bulk
>>> calls in bbdev-test.
>>>
>>> Signed-off-by: Nicolas Chautru <nicolas.chautru@intel.com>
>>> ---
>>>    app/test-bbdev/test_bbdev_perf.c | 9 ++++++---
>>>    1 file changed, 6 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/app/test-bbdev/test_bbdev_perf.c
>>> b/app/test-bbdev/test_bbdev_perf.c
>>> index b2e536b5e3..a922d69ada 100644
>>> --- a/app/test-bbdev/test_bbdev_perf.c
>>> +++ b/app/test-bbdev/test_bbdev_perf.c
>>> @@ -4958,7 +4958,8 @@ offload_latency_test_fft(struct rte_mempool
>> *mempool, struct test_buffers *bufs,
>>>    		if (unlikely(num_to_process - dequeued < burst_sz))
>>>    			burst_sz = num_to_process - dequeued;
>>>
>>> -		rte_bbdev_fft_op_alloc_bulk(mempool, ops_enq, burst_sz);
>>> +		ret = rte_bbdev_fft_op_alloc_bulk(mempool, ops_enq,
>> burst_sz);
>>> +		TEST_ASSERT_SUCCESS(ret, "Allocation failed for %d ops",
>> ops_enq);
>>>    		if (test_vector.op_type != RTE_BBDEV_OP_NONE)
>>>    			copy_reference_fft_op(ops_enq, burst_sz,
>> dequeued,
>>>    					bufs->inputs,
>>> @@ -5040,7 +5041,8 @@ offload_latency_test_dec(struct rte_mempool
>> *mempool, struct test_buffers *bufs,
>>>    		if (unlikely(num_to_process - dequeued < burst_sz))
>>>    			burst_sz = num_to_process - dequeued;
>>>
>>> -		rte_bbdev_dec_op_alloc_bulk(mempool, ops_enq,
>> burst_sz);
>>> +		ret = rte_bbdev_dec_op_alloc_bulk(mempool, ops_enq,
>> burst_sz);
>>> +		TEST_ASSERT_SUCCESS(ret, "Allocation failed for %d ops",
>> ops_enq);
>>>    		if (test_vector.op_type != RTE_BBDEV_OP_NONE)
>>>    			copy_reference_dec_op(ops_enq, burst_sz,
>> dequeued,
>>>    					bufs->inputs,
>>> @@ -5125,7 +5127,8 @@ offload_latency_test_ldpc_dec(struct
>> rte_mempool *mempool,
>>>    		if (unlikely(num_to_process - dequeued < burst_sz))
>>>    			burst_sz = num_to_process - dequeued;
>>>
>>> -		rte_bbdev_dec_op_alloc_bulk(mempool, ops_enq,
>> burst_sz);
>>> +		ret = rte_bbdev_dec_op_alloc_bulk(mempool, ops_enq,
>> burst_sz);
>>> +		TEST_ASSERT_SUCCESS(ret, "Allocation failed for %d ops",
>> ops_enq);
>>>    		if (test_vector.op_type != RTE_BBDEV_OP_NONE)
>>>    			copy_reference_ldpc_dec_op(ops_enq, burst_sz,
>> dequeued,
>>>    					bufs->inputs,
>>
>> You need to add Fixes tag and cc stable.
>>
>> Maxime
>
  

Patch

diff --git a/app/test-bbdev/test_bbdev_perf.c b/app/test-bbdev/test_bbdev_perf.c
index b2e536b5e3..a922d69ada 100644
--- a/app/test-bbdev/test_bbdev_perf.c
+++ b/app/test-bbdev/test_bbdev_perf.c
@@ -4958,7 +4958,8 @@  offload_latency_test_fft(struct rte_mempool *mempool, struct test_buffers *bufs,
 		if (unlikely(num_to_process - dequeued < burst_sz))
 			burst_sz = num_to_process - dequeued;
 
-		rte_bbdev_fft_op_alloc_bulk(mempool, ops_enq, burst_sz);
+		ret = rte_bbdev_fft_op_alloc_bulk(mempool, ops_enq, burst_sz);
+		TEST_ASSERT_SUCCESS(ret, "Allocation failed for %d ops", ops_enq);
 		if (test_vector.op_type != RTE_BBDEV_OP_NONE)
 			copy_reference_fft_op(ops_enq, burst_sz, dequeued,
 					bufs->inputs,
@@ -5040,7 +5041,8 @@  offload_latency_test_dec(struct rte_mempool *mempool, struct test_buffers *bufs,
 		if (unlikely(num_to_process - dequeued < burst_sz))
 			burst_sz = num_to_process - dequeued;
 
-		rte_bbdev_dec_op_alloc_bulk(mempool, ops_enq, burst_sz);
+		ret = rte_bbdev_dec_op_alloc_bulk(mempool, ops_enq, burst_sz);
+		TEST_ASSERT_SUCCESS(ret, "Allocation failed for %d ops", ops_enq);
 		if (test_vector.op_type != RTE_BBDEV_OP_NONE)
 			copy_reference_dec_op(ops_enq, burst_sz, dequeued,
 					bufs->inputs,
@@ -5125,7 +5127,8 @@  offload_latency_test_ldpc_dec(struct rte_mempool *mempool,
 		if (unlikely(num_to_process - dequeued < burst_sz))
 			burst_sz = num_to_process - dequeued;
 
-		rte_bbdev_dec_op_alloc_bulk(mempool, ops_enq, burst_sz);
+		ret = rte_bbdev_dec_op_alloc_bulk(mempool, ops_enq, burst_sz);
+		TEST_ASSERT_SUCCESS(ret, "Allocation failed for %d ops", ops_enq);
 		if (test_vector.op_type != RTE_BBDEV_OP_NONE)
 			copy_reference_ldpc_dec_op(ops_enq, burst_sz, dequeued,
 					bufs->inputs,