> -----Original Message-----
> From: Ke Zhang <ke1x.zh...@intel.com>
> Sent: Saturday, April 2, 2022 5:51 PM
> To: Li, Xiaoyun <xiaoyun...@intel.com>; Wu, Jingjing <jingjing...@intel.com>;
> Xing, Beilei <beilei.x...@intel.com>; dev@dpdk.org
> Cc: Zhang, Ke1X <ke1x.zh...@intel.com>
> Subject: [PATCH] net/iavf: fix iavf crashed on dev_stop when running in
> multi-process mode
>
> In the multi process environment, the sub process operates on the shared
> memory and changes the function pointer of the main process, resulting in
> the failure to find the address of the function when main process releasing,
> resulting in crash.
>
> similar with commit<20b631efe785819eb77aabbf500b3352e5731bdb>
>
> Signed-off-by: Ke Zhang <ke1x.zh...@intel.com>
> ---
> drivers/net/iavf/iavf_rxtx.c | 27 ++++++++++++++-----------
> drivers/net/iavf/iavf_rxtx.h | 6 +++---
> drivers/net/iavf/iavf_rxtx_vec_avx512.c | 4 ++--
> drivers/net/iavf/iavf_rxtx_vec_sse.c | 8 ++++----
> 4 files changed, 24 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/net/iavf/iavf_rxtx.c b/drivers/net/iavf/iavf_rxtx.c index
> 16e8d021f9..197c03cd31 100644
> --- a/drivers/net/iavf/iavf_rxtx.c
> +++ b/drivers/net/iavf/iavf_rxtx.c
> @@ -362,6 +362,9 @@ release_txq_mbufs(struct iavf_tx_queue *txq)
> }
> }
>
> +const struct iavf_rxq_ops *iavf_rxq_release_mbufs_ops; const struct
> +iavf_txq_ops *iavf_txq_release_mbufs_ops;
> +
> static const struct iavf_rxq_ops def_rxq_ops = {
> .release_mbufs = release_rxq_mbufs,
> };
> @@ -674,7 +677,7 @@ iavf_dev_rx_queue_setup(struct rte_eth_dev *dev,
> uint16_t queue_idx,
> rxq->q_set = true;
> dev->data->rx_queues[queue_idx] = rxq;
> rxq->qrx_tail = hw->hw_addr + IAVF_QRX_TAIL1(rxq->queue_id);
> - rxq->ops = &def_rxq_ops;
> + iavf_rxq_release_mbufs_ops = &def_rxq_ops;
This is not correct.
Now we replace per-queue ops with a global ops which is not expected.
Please reference method of below patch
commit 0ed16e01313e1f8930dc6a52b22159b20269d4e0
Author: Steve Yang <stevex.y...@intel.com>
Date: Mon Feb 28 09:48:59 2022 +0000
net/iavf: fix function pointer in multi-process
...
>
> diff --git a/drivers/net/iavf/iavf_rxtx_vec_sse.c
> b/drivers/net/iavf/iavf_rxtx_vec_sse.c
> index 717a227b2c..a782bed2e0 100644
> --- a/drivers/net/iavf/iavf_rxtx_vec_sse.c
> +++ b/drivers/net/iavf/iavf_rxtx_vec_sse.c
> @@ -1219,16 +1219,16 @@ static const struct iavf_txq_ops sse_vec_txq_ops
> = { };
>
> int __rte_cold
> -iavf_txq_vec_setup(struct iavf_tx_queue *txq)
> +iavf_txq_vec_setup(const struct iavf_txq_ops **txq_ops)
> {
> - txq->ops = &sse_vec_txq_ops;
> + *txq_ops = &sse_vec_txq_ops;
> return 0;
> }
>
> int __rte_cold
> -iavf_rxq_vec_setup(struct iavf_rx_queue *rxq)
> +iavf_rxq_vec_setup(struct iavf_rx_queue *rxq, const struct iavf_rxq_ops
> +**rxq_ops)
> {
> - rxq->ops = &sse_vec_rxq_ops;
> + *rxq_ops = &sse_vec_rxq_ops;
> return iavf_rxq_vec_setup_default(rxq); }
seems lots of redundant in iavf_rxtx_vec.sse.c
Can we move iavf_r(t)xq_vec_setup | sse_vec_r(t)xq_ops into iavf_rxtx.c and
delete iavf_r(t)x_queue_release_mbufs_sse)?
Btw, We can keep this patch unchanged, a separated patch to refact the code is
expected.
>
> --
> 2.25.1