[v1,1/1] ml/cnxk: fix fast-path synchronization

Message ID 20231113053115.15142-1-syalavarthi@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: Jerin Jacob
Headers
Series [v1,1/1] ml/cnxk: fix fast-path synchronization |

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/github-robot: build success github build: passed
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-compile-arm64-testing success Testing PASS
ci/iol-sample-apps-testing success Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS

Commit Message

Srikanth Yalavarthi Nov. 13, 2023, 5:31 a.m. UTC
  Segfaults are reported with TVM/LLVM models as NULL value
is read by dequeue thread for the op handle. This is due
synchronization issue between enqueue and dequeue threads.

This fix ensures the op handle written to internal request
structure is committed before the dequeue threads read the
handle value.

Fixes: 88001b4d88de ("ml/cnxk: update fast path functions")

Signed-off-by: Srikanth Yalavarthi <syalavarthi@marvell.com>
---
 drivers/ml/cnxk/cnxk_ml_ops.c | 1 +
 1 file changed, 1 insertion(+)
  

Comments

Jerin Jacob Nov. 13, 2023, 3:56 p.m. UTC | #1
On Mon, Nov 13, 2023 at 11:01 AM Srikanth Yalavarthi
<syalavarthi@marvell.com> wrote:
>
> Segfaults are reported with TVM/LLVM models as NULL value
> is read by dequeue thread for the op handle. This is due
> synchronization issue between enqueue and dequeue threads.
>
> This fix ensures the op handle written to internal request
> structure is committed before the dequeue threads read the
> handle value.
>
> Fixes: 88001b4d88de ("ml/cnxk: update fast path functions")
>
> Signed-off-by: Srikanth Yalavarthi <syalavarthi@marvell.com>


Applied to dpdk-next-net-mrvl/for-next-net. Thanks


> ---
>  drivers/ml/cnxk/cnxk_ml_ops.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/ml/cnxk/cnxk_ml_ops.c b/drivers/ml/cnxk/cnxk_ml_ops.c
> index 81866ceaa6..971362b242 100644
> --- a/drivers/ml/cnxk/cnxk_ml_ops.c
> +++ b/drivers/ml/cnxk/cnxk_ml_ops.c
> @@ -1596,6 +1596,7 @@ cnxk_ml_enqueue_burst(struct rte_ml_dev *dev, uint16_t qp_id, struct rte_ml_op *
>  jcmdq_full:
>         queue->head = head;
>         qp->stats.enqueued_count += count;
> +       rte_wmb();
>
>         return count;
>  }
> --
> 2.42.0
>
  

Patch

diff --git a/drivers/ml/cnxk/cnxk_ml_ops.c b/drivers/ml/cnxk/cnxk_ml_ops.c
index 81866ceaa6..971362b242 100644
--- a/drivers/ml/cnxk/cnxk_ml_ops.c
+++ b/drivers/ml/cnxk/cnxk_ml_ops.c
@@ -1596,6 +1596,7 @@  cnxk_ml_enqueue_burst(struct rte_ml_dev *dev, uint16_t qp_id, struct rte_ml_op *
 jcmdq_full:
 	queue->head = head;
 	qp->stats.enqueued_count += count;
+	rte_wmb();
 
 	return count;
 }