> -----Original Message-----
> From: Ke Zhang <ke1x.zh...@intel.com>
> Sent: Thursday, April 14, 2022 5:29 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 v2] net/iavf: fix iavf crashed on dev_stop when running in
> multi-process mode
It's not a good practice to take the failure test case as the title, please
describe what actually the patch fixed.
e.g.:
fix mbuf release function point corrupt in multi-process
>
> 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.
>
> Signed-off-by: Ke Zhang <ke1x.zh...@intel.com>
> ---
> drivers/net/iavf/iavf_rxtx.c | 31 ++++++++++++++++---------------
> 1 file changed, 16 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/net/iavf/iavf_rxtx.c b/drivers/net/iavf/iavf_rxtx.c index
> 16e8d021f9..1cef985fcc 100644
> --- a/drivers/net/iavf/iavf_rxtx.c
> +++ b/drivers/net/iavf/iavf_rxtx.c
> @@ -2822,12 +2822,12 @@ iavf_set_rx_function(struct rte_eth_dev *dev)
> if (vf->vf_res->vf_cap_flags &
> VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC)
> use_flex = true;
> -
> - for (i = 0; i < dev->data->nb_rx_queues; i++) {
> - rxq = dev->data->rx_queues[i];
> - (void)iavf_rxq_vec_setup(rxq);
> + if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
> + for (i = 0; i < dev->data->nb_rx_queues; i++) {
> + rxq = dev->data->rx_queues[i];
> + (void)iavf_rxq_vec_setup(rxq);
> + }
> }
Now, you force rxq->ops only can be owned by primary process, which is not
necessary.
Its better we still allow a secondary process to stop a queue (which will call
rxq->ops)