DPDK patches and discussions
 help / color / mirror / Atom feed
From: Matan Azrad <matan@nvidia.com>
To: NBU-Contact-Thomas Monjalon <thomas@monjalon.net>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
	Ferruh Yigit <ferruh.yigit@intel.com>,
	Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Subject: Re: [dpdk-dev] [PATCH] ethdev: avoid unregistering a non-allocated callback
Date: Wed, 14 Jul 2021 14:16:28 +0000	[thread overview]
Message-ID: <DM4PR12MB5389161553B1C86B6561D6D5DF139@DM4PR12MB5389.namprd12.prod.outlook.com> (raw)
In-Reply-To: <2065780.Orf5z9Lfyc@thomas>



From: Thomas Monjalon
> 13/07/2021 15:42, Matan Azrad:
> > Hi Thomas
> >
> > From: Thomas Monjalon
> > > When registering a new event callback, if allocation fails, there is
> > > no need for unregistering the callback, because it is not registered.
> > >
> > > Fixes: 9ec0b3869d8d ("ethdev: allow event registration for all
> > > ports")
> > > Cc: stable@dpdk.org
> > >
> > > Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> > > ---
> > >  lib/ethdev/rte_ethdev.c | 2 --
> > >  1 file changed, 2 deletions(-)
> > >
> > > diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c index
> > > 9d95cd11e1..1731854628 100644
> > > --- a/lib/ethdev/rte_ethdev.c
> > > +++ b/lib/ethdev/rte_ethdev.c
> > > @@ -4649,8 +4649,6 @@ rte_eth_dev_callback_register(uint16_t
> port_id,
> > >                                                   user_cb, next);
> > >                         } else {
> > >                                 rte_spinlock_unlock(&eth_dev_cb_lock);
> > > -                               rte_eth_dev_callback_unregister(port_id, event,
> > > -                                                               cb_fn, cb_arg);
> >
> > Please pay attention to the case of port_id=RTE_ETH_ALL where the user
> wants to register the event for all the ports.
> >
> > In this case, when a failure happens for one of the ports, this unregister call
> cleans the callback from all the ports.
> 
> Yes I missed it. Now I better understand the intent, thanks.
> 
> Next question: do we really want to rollback already registered ports?
> Anyway, if we are out of memory, I think it is better not doing more
> operations.
> There can be various opinions on this topic, please give yours.

Sure,
I understand that memory error is serious,
Do you think it is a fatal error? If so, maybe we should use rte_exit?

That way or others, I think the behavior should be a convention for all the file functions(at least).

I tend to do cleanup on any error.

Matan


  reply	other threads:[~2021-07-14 14:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-13 13:17 Thomas Monjalon
2021-07-13 13:21 ` Andrew Rybchenko
2021-07-13 13:42 ` Matan Azrad
2021-07-14 11:42   ` Thomas Monjalon
2021-07-14 14:16     ` Matan Azrad [this message]
2021-07-14 14:42       ` Thomas Monjalon
2021-07-15  9:06         ` Ferruh Yigit
2022-09-26 14:36           ` Thomas Monjalon

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=DM4PR12MB5389161553B1C86B6561D6D5DF139@DM4PR12MB5389.namprd12.prod.outlook.com \
    --to=matan@nvidia.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@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).