crypto/scheduler: fix incorrect variable usage

Message ID tencent_24CE9C7896D3134694B645817C0B3A8A5205@qq.com (mailing list archive)
State New
Delegated to: akhil goyal
Headers
Series crypto/scheduler: fix incorrect variable usage |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/github-robot: build success github build: passed
ci/intel-Functional success Functional PASS
ci/iol-marvell-Functional success Functional Testing PASS
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-compile-arm64-testing success Testing PASS
ci/iol-sample-apps-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS

Commit Message

Yong Liang Sept. 18, 2024, 2:15 p.m. UTC
The variable `pending_deq_ops` was incorrectly used
instead of `pending_enq_ops`.
This causes the program to crash
when the worker PMD accesses the session

Bugzilla ID: 1537
Fixes: 6812b9bf470e ("crypto/scheduler: use unified session")
Cc: roy.fan.zhang@intel.com

Signed-off-by: Yong Liang <1269690261@qq.com>
---
 drivers/crypto/scheduler/scheduler_multicore.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Comments

Ji, Kai Oct. 7, 2024, 10:35 a.m. UTC | #1
I'm not see any issue with original code, can you give more details about crash so I can try to reproduce at my end.
 cc kirill.rybalchenko@intel.com for review
  
Akhil Goyal Oct. 9, 2024, 8:59 a.m. UTC | #2
> I'm not see any issue with original code, can you give more details about crash so
> I can try to reproduce at my end.
>  cc kirill.rybalchenko@intel.com for review

The details are there in Bugzilla
https://bugs.dpdk.org/show_bug.cgi?id=1537

> 
> ________________________________
> 
> From: Yong Liang <1269690261@qq.com>
> Sent: 18 September 2024 15:15
> To: dev@dpdk.org <dev@dpdk.org>
> Cc: roy.fan.zhang@intel.com <roy.fan.zhang@intel.com>
> Subject: [PATCH] crypto/scheduler: fix incorrect variable usage
> 
> The variable `pending_deq_ops` was incorrectly used
> instead of `pending_enq_ops`.
> This causes the program to crash
> when the worker PMD accesses the session
> 
> Bugzilla ID: 1537
> Fixes: 6812b9bf470e ("crypto/scheduler: use unified session")
> Cc: roy.fan.zhang@intel.com
> 
> Signed-off-by: Yong Liang <1269690261@qq.com>
> ---
>  drivers/crypto/scheduler/scheduler_multicore.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/crypto/scheduler/scheduler_multicore.c
> b/drivers/crypto/scheduler/scheduler_multicore.c
> index a21b522f9f..70f8a25b70 100644
> --- a/drivers/crypto/scheduler/scheduler_multicore.c
> +++ b/drivers/crypto/scheduler/scheduler_multicore.c
> @@ -191,11 +191,11 @@ mc_scheduler_worker(struct rte_cryptodev *dev)
>                                          worker->qp_id,
>                                          &enq_ops[pending_enq_ops_idx],
>                                          pending_enq_ops);
> -                       if (processed_ops < pending_deq_ops)
> +                       if (processed_ops < pending_enq_ops)
>                                  scheduler_retrieve_sessions(
>                                          &enq_ops[pending_enq_ops_idx +
>                                                  processed_ops],
> -                                       pending_deq_ops - processed_ops);
> +                                       pending_enq_ops - processed_ops);
>                          pending_enq_ops -= processed_ops;
>                          pending_enq_ops_idx += processed_ops;
>                          inflight_ops += processed_ops;
> --
> 2.43.0
>
  

Patch

diff --git a/drivers/crypto/scheduler/scheduler_multicore.c b/drivers/crypto/scheduler/scheduler_multicore.c
index a21b522f9f..70f8a25b70 100644
--- a/drivers/crypto/scheduler/scheduler_multicore.c
+++ b/drivers/crypto/scheduler/scheduler_multicore.c
@@ -191,11 +191,11 @@  mc_scheduler_worker(struct rte_cryptodev *dev)
 					worker->qp_id,
 					&enq_ops[pending_enq_ops_idx],
 					pending_enq_ops);
-			if (processed_ops < pending_deq_ops)
+			if (processed_ops < pending_enq_ops)
 				scheduler_retrieve_sessions(
 					&enq_ops[pending_enq_ops_idx +
 						processed_ops],
-					pending_deq_ops - processed_ops);
+					pending_enq_ops - processed_ops);
 			pending_enq_ops -= processed_ops;
 			pending_enq_ops_idx += processed_ops;
 			inflight_ops += processed_ops;