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


> -----Original Message-----
> From: Ananyev, Konstantin
> Sent: Thursday, December 14, 2017 2:47 PM
> To: Gujjar, Abhinandan S <abhinandan.gujjar@intel.com>;
> thomas@monjalon.net
> Cc: dev@dpdk.org; Gujjar, Abhinandan S <abhinandan.gujjar@intel.com>
> Subject: RE: [dpdk-dev] [PATCH] ethdev: fix memory leaks in remove rxtx
> callbacks
> 
> 
> 
> > -----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
Thanks for pointing to the patch. I could not find it in the search!
Abhinandan

> 
> >  			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:33 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
2017-12-14  9:33   ` Gujjar, Abhinandan S [this message]

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=5612CB344B05EE4F95FC5B729939F780705F2DCC@PGSMSX102.gar.corp.intel.com \
    --to=abhinandan.gujjar@intel.com \
    --cc=dev@dpdk.org \
    --cc=konstantin.ananyev@intel.com \
    --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).