All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson@intel.com>
To: Anatoly Burakov <anatoly.burakov@intel.com>
Cc: <dev@dpdk.org>, Vladimir Medvedkin <vladimir.medvedkin@intel.com>,
	Ting Xu <ting.xu@intel.com>, Beilei Xing <beilei.xing@intel.com>
Subject: Re: [PATCH v4 04/10] net/iavf: fix memory leaks around IRQ resources
Date: Thu, 22 Oct 2026 14:08:35 +0100	[thread overview]
Message-ID: <atoK01Nli2pPfElk@bricha3-mobl1.ger.corp.intel.com> (raw)
In-Reply-To: <595c771fac2dda2d602c01ba171d56f3419db917.1792592724.git.anatoly.burakov@intel.com>

On Wed, Oct 21, 2026 at 03:25:44PM +0100, Anatoly Burakov wrote:
> `iavf_config_rx_queues_irqs()` allocates a queue-vector map and may
> enable eventfds and allocate an interrupt vector list. If queue startup
> then fails, those resources remain allocated. The queue-vector map is
> also retained after a normal stop, leaking it across start/stop cycles.
> 
> Release the resources on failed startup and free the queue-vector map
> on stop. Clean up eventfds when interrupt setup fails as well.
> 
> Fixes: f593944fc988 ("net/iavf: enable IRQ mapping configuration for large VF")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> ---
>  drivers/net/intel/iavf/iavf_ethdev.c | 22 ++++++++++++++++++----
>  1 file changed, 18 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/intel/iavf/iavf_ethdev.c b/drivers/net/intel/iavf/iavf_ethdev.c
> index b5beaee8604..891880cf6e6 100644
> --- a/drivers/net/intel/iavf/iavf_ethdev.c
> +++ b/drivers/net/intel/iavf/iavf_ethdev.c
> @@ -863,7 +863,7 @@ static int iavf_config_rx_queues_irqs(struct rte_eth_dev *dev,
>  	if (rte_intr_cap_multiple(intr_handle) &&
>  	    dev->data->dev_conf.intr_conf.rxq) {
>  		if (rte_intr_efd_enable(intr_handle, dev->data->nb_rx_queues))
> -			return -1;
> +			goto efd_alloc_err;
>  	}

This change doesn't make sense to me. If the enable fails, we should not
need to call disable when handling that error.

Independently AI review flags this that you might want to consider:

Info
Pre-existing and not introduced by this commit: the new failure branch at iavf_ethdev.c:866 calls cleanup after rte_intr_efd_enable() fails, but that helper can create eventfds before returning an error and before recording the completed count at eal_interrupts.c:1580. The cleanup closes only the recorded eventfds at eal_interrupts.c:1623, so a partial allocation failure can still leak descriptors. Track and release partially created eventfds in the helper or cleanup path. Confidence: 9/10.

>  
>  	if (rte_intr_dp_is_en(intr_handle)) {
> @@ -871,7 +871,7 @@ static int iavf_config_rx_queues_irqs(struct rte_eth_dev *dev,
>  						    dev->data->nb_rx_queues)) {
>  			PMD_DRV_LOG(ERR, "Failed to allocate %d rx intr_vec",
>  				    dev->data->nb_rx_queues);
> -			return -1;
> +			goto qv_map_alloc_err;
>  		}
>  	}
>  
> @@ -981,6 +981,8 @@ static int iavf_config_rx_queues_irqs(struct rte_eth_dev *dev,
>  
>  qv_map_alloc_err:
>  	rte_intr_vec_list_free(intr_handle);
> +efd_alloc_err:
> +	rte_intr_efd_disable(intr_handle);
>  
>  	return -1;
>  }
> @@ -1034,12 +1036,15 @@ iavf_dev_start(struct rte_eth_dev *dev)
>  	struct rte_intr_handle *intr_handle = dev->intr_handle;
>  	uint16_t num_queue_pairs;
>  	uint16_t index = 0;
> +	bool wb_on_itr;
>  
>  	PMD_INIT_FUNC_TRACE();
>  
>  	if (adapter->closed)
>  		return -1;
>  
> +	wb_on_itr = (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_WB_ON_ITR) != 0;
> +
>  	vf->max_pkt_len = dev->data->mtu + IAVF_ETH_OVERHEAD;
>  	vf->num_queue_pairs = RTE_MAX(dev->data->nb_rx_queues,
>  				      dev->data->nb_tx_queues);
> @@ -1089,7 +1094,7 @@ iavf_dev_start(struct rte_eth_dev *dev)
>  	}
>  	/* re-enable intr again, because efd assign may change */
>  	if (dev->data->dev_conf.intr_conf.rxq != 0) {
> -		if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_WB_ON_ITR)
> +		if (wb_on_itr)
>  			rte_intr_disable(intr_handle);
>  		rte_intr_enable(intr_handle);
>  	}
> @@ -1107,7 +1112,7 @@ iavf_dev_start(struct rte_eth_dev *dev)
>  
>  	if (iavf_start_queues(dev) != 0) {
>  		PMD_DRV_LOG(ERR, "enable queues failed");
> -		goto error;
> +		goto irq_error;
>  	}
>  
>  	iavf_phc_sync_alarm_start(dev);
> @@ -1118,6 +1123,13 @@ iavf_dev_start(struct rte_eth_dev *dev)
>  
>  	return 0;
>  
> +irq_error:
> +	if (!wb_on_itr && dev->data->dev_conf.intr_conf.rxq != 0)
> +		rte_intr_disable(intr_handle);
> +	rte_intr_efd_disable(intr_handle);
> +	rte_intr_vec_list_free(intr_handle);
> +	rte_free(vf->qv_map);
> +	vf->qv_map = NULL;
>  error:
>  	return -1;
>  }
> @@ -1150,6 +1162,8 @@ iavf_dev_stop(struct rte_eth_dev *dev)
>  	rte_intr_vec_list_free(intr_handle);
>  
>  	iavf_stop_queues(dev);
> +	rte_free(vf->qv_map);
> +	vf->qv_map = NULL;
>  
>  	adapter->stopped = 1;
>  	dev->data->dev_started = 0;
> -- 
> 2.52.0
> 

  reply	other threads:[~2026-10-22 13:08 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-14 15:18 [PATCH v1 0/7] IAVF Fixes Anatoly Burakov
2026-10-14 15:18 ` [PATCH v1 1/7] net/iavf: fix memory leak in flow teardown Anatoly Burakov
2026-10-14 15:18 ` [PATCH v1 2/7] net/iavf: fix null engine for egress security flows Anatoly Burakov
2026-10-14 15:18 ` [PATCH v1 3/7] net/iavf: fix generic flow error-path leaks Anatoly Burakov
2026-10-14 15:18 ` [PATCH v1 4/7] net/iavf: fix flow subscription metadata leaks Anatoly Burakov
2026-10-14 15:18 ` [PATCH v1 5/7] net/iavf: fix hash flow " Anatoly Burakov
2026-10-16  3:12   ` Mandal, Anurag
2026-10-16 11:00     ` Burakov, Anatoly
2026-10-14 15:18 ` [PATCH v1 6/7] net/iavf: fix IPsec " Anatoly Burakov
2026-10-14 15:18 ` [PATCH v1 7/7] net/iavf: do not store ethdev pointer Anatoly Burakov
2026-10-19 15:06 ` [PATCH v2 0/9] IAVF Fixes Anatoly Burakov
2026-10-19 15:06   ` [PATCH v2 1/9] net/iavf: keep device stopped if start fails Anatoly Burakov
2026-10-19 15:06   ` [PATCH v2 2/9] net/iavf: do not store ethdev pointer Anatoly Burakov
2026-10-19 15:06   ` [PATCH v2 3/9] net/iavf: fix false success on flow validation Anatoly Burakov
2026-10-19 15:06   ` [PATCH v2 4/9] net/iavf: fix memory leak in raw pattern parsing Anatoly Burakov
2026-10-19 15:13     ` Burakov, Anatoly
2026-10-19 15:06   ` [PATCH v2 5/9] net/iavf: fix memory leaks around IRQ resources Anatoly Burakov
2026-10-19 15:06   ` [PATCH v2 6/9] net/iavf: fix generic flow error-path leaks Anatoly Burakov
2026-10-19 15:06   ` [PATCH v2 7/9] net/iavf: centralize memory management for flows Anatoly Burakov
2026-10-19 15:06   ` [PATCH v2 8/9] net/iavf: fix null engine for egress security flows Anatoly Burakov
2026-10-19 15:06   ` [PATCH v2 9/9] net/iavf: fix IPsec flow metadata leaks Anatoly Burakov
2026-10-20  9:11 ` [PATCH v3 00/10] IAVF Fixes Anatoly Burakov
2026-10-20  9:11   ` [PATCH v3 01/10] net/iavf: keep device stopped if start fails Anatoly Burakov
2026-10-20  9:11   ` [PATCH v3 02/10] net/iavf: do not store ethdev pointer Anatoly Burakov
2026-10-20  9:11   ` [PATCH v3 03/10] net/iavf: fix false success on flow validation Anatoly Burakov
2026-10-20  9:11   ` [PATCH v3 04/10] net/iavf: fix memory leaks around IRQ resources Anatoly Burakov
2026-10-20  9:11   ` [PATCH v3 05/10] net/iavf: fix generic flow error-path leaks Anatoly Burakov
2026-10-20  9:11   ` [PATCH v3 06/10] net/iavf: centralize memory management for flows Anatoly Burakov
2026-10-20  9:11   ` [PATCH v3 07/10] net/iavf: skip RSS teardown during PF-initiated reset Anatoly Burakov
2026-10-20  9:11   ` [PATCH v3 08/10] net/iavf: remove redundant reset checks from RSS engine Anatoly Burakov
2026-10-20  9:11   ` [PATCH v3 09/10] net/iavf: fix null engine for egress security flows Anatoly Burakov
2026-10-20  9:35     ` Radu Nicolau
2026-10-20  9:11   ` [PATCH v3 10/10] net/iavf: fix IPsec flow metadata leaks Anatoly Burakov
2026-10-20  9:36     ` Radu Nicolau
2026-10-21 14:25 ` [PATCH v4 00/10] IAVF Fixes Anatoly Burakov
2026-10-21 14:25   ` [PATCH v4 01/10] net/iavf: keep device stopped if start fails Anatoly Burakov
2026-10-22 12:57     ` Bruce Richardson
2026-10-21 14:25   ` [PATCH v4 02/10] net/iavf: do not store ethdev pointer Anatoly Burakov
2026-10-22 12:57     ` Bruce Richardson
2026-10-21 14:25   ` [PATCH v4 03/10] net/iavf: fix false success on flow validation Anatoly Burakov
2026-10-22 12:57     ` Bruce Richardson
2026-10-21 14:25   ` [PATCH v4 04/10] net/iavf: fix memory leaks around IRQ resources Anatoly Burakov
2026-10-22 13:08     ` Bruce Richardson [this message]
2026-10-21 14:25   ` [PATCH v4 05/10] net/iavf: fix generic flow error-path leaks Anatoly Burakov
2026-10-22 13:15     ` Bruce Richardson
2026-10-21 14:25   ` [PATCH v4 06/10] net/iavf: centralize memory management for flows Anatoly Burakov
2026-10-22 14:18     ` Bruce Richardson
2026-10-21 14:25   ` [PATCH v4 07/10] net/iavf: skip RSS teardown during PF-initiated reset Anatoly Burakov
2026-10-22 14:31     ` Bruce Richardson
2026-10-21 14:25   ` [PATCH v4 08/10] net/iavf: remove redundant reset checks from RSS engine Anatoly Burakov
2026-10-22 14:41     ` Bruce Richardson
2026-10-21 14:25   ` [PATCH v4 09/10] net/iavf: fix null engine for egress security flows Anatoly Burakov
2026-10-21 14:25   ` [PATCH v4 10/10] net/iavf: fix IPsec flow metadata leaks Anatoly Burakov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=atoK01Nli2pPfElk@bricha3-mobl1.ger.corp.intel.com \
    --to=bruce.richardson@intel.com \
    --cc=anatoly.burakov@intel.com \
    --cc=beilei.xing@intel.com \
    --cc=dev@dpdk.org \
    --cc=ting.xu@intel.com \
    --cc=vladimir.medvedkin@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.