DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Ananyev, Konstantin" <konstantin.ananyev@intel.com>
To: "Gujjar, Abhinandan S" <abhinandan.gujjar@intel.com>,
	"thomas@monjalon.net" <thomas@monjalon.net>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
	"Gujjar, Abhinandan S" <abhinandan.gujjar@intel.com>
Subject: Re: [dpdk-dev] [PATCH] ethdev: fix memory leaks in remove rxtx callbacks
Date: Thu, 14 Dec 2017 09:16:35 +0000	[thread overview]
Message-ID: <2601191342CEEE43887BDE71AB9772585FAC9700@irsmsx105.ger.corp.intel.com> (raw)
In-Reply-To: <1513222343-79143-1-git-send-email-abhinandan.gujjar@intel.com>



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Abhinandan Gujjar
> Sent: Thursday, December 14, 2017 3:32 AM
> To: thomas@monjalon.net
> Cc: dev@dpdk.org; Gujjar, Abhinandan S <abhinandan.gujjar@intel.com>
> Subject: [dpdk-dev] [PATCH] ethdev: fix memory leaks in remove rxtx callbacks
> 
> The patch frees memory allocated by add rxtx callbacks
> 
> Signed-off-by: Abhinandan Gujjar <abhinandan.gujjar@intel.com>
> ---
>  lib/librte_ether/rte_ethdev.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
> index 318af28..2ab6e05 100644
> --- a/lib/librte_ether/rte_ethdev.c
> +++ b/lib/librte_ether/rte_ethdev.c
> @@ -3229,6 +3229,7 @@ int rte_eth_set_queue_rate_limit(uint16_t port_id, uint16_t queue_idx,
>  		if (cb == user_cb) {
>  			/* Remove the user cb from the callback list. */
>  			*prev_cb = cb->next;
> +			rte_free(cb);

It is not that straightforward unfortunately -
that function can be called while RX/TX is active for the same queue.
That's why it is a responsibility of the caller to determine when it is safe
to free associated resources. 
I submitted and RFC to fix that issue in a safe way:
http://dpdk.org/dev/patchwork/patch/31867/
Konstantin

>  			ret = 0;
>  			break;
>  		}
> @@ -3263,6 +3264,7 @@ int rte_eth_set_queue_rate_limit(uint16_t port_id, uint16_t queue_idx,
>  		if (cb == user_cb) {
>  			/* Remove the user cb from the callback list. */
>  			*prev_cb = cb->next;
> +			rte_free(cb);
>  			ret = 0;
>  			break;
>  		}
> --
> 1.9.1

  reply	other threads:[~2017-12-14  9:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-14  3:32 Abhinandan Gujjar
2017-12-14  9:16 ` Ananyev, Konstantin [this message]
2017-12-14  9:33   ` Gujjar, Abhinandan S

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=2601191342CEEE43887BDE71AB9772585FAC9700@irsmsx105.ger.corp.intel.com \
    --to=konstantin.ananyev@intel.com \
    --cc=abhinandan.gujjar@intel.com \
    --cc=dev@dpdk.org \
    --cc=thomas@monjalon.net \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).