From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by dpdk.org (Postfix) with ESMTP id 8C2A14F9B for ; Tue, 10 Jul 2018 14:56:43 +0200 (CEST) Received: by mail-wr1-f67.google.com with SMTP id t6-v6so14508908wrn.7 for ; Tue, 10 Jul 2018 05:56:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=R7WQKVszYte/Q5OYHOx7WWcehgA2TECIdI3WXNErHRw=; b=UC7bM3movwHEVyFY9PbEWW4aLDU9ACOSwquD10lcx+3/DW8+iHpKhKKD8Sj+zmYMsj JGemR9zHzUqTmgyL7bx39zFA7XwAY43T1c9JbMYM4lRX1dFoHjuG4ZpQFGYcreXM56PX dlyZDGEjyYtifkUoHGaBGu2s5Lk6MioKG6p/fU7+5iUZYocjLWUXFN1fpZQiLFxuRQYx D0Utug56QdH6+OJpwuGj7pxLVObY74ZPqijUoHxRIqC/4wInw8C9ebknggB0zlWNg5yq ab5I8KJjB6Re4R+on+JFl4b7R3VO9R4Y3ZTr8xZVO6IfnanCR8bTMUhIE5BkjKYzP9qx 9MEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=R7WQKVszYte/Q5OYHOx7WWcehgA2TECIdI3WXNErHRw=; b=kjPTbwkPvL8uKxbTayH9y0AyWeCGirJzubynhK/OLmz+AwvJi/BqE6VQKOf5LkHf84 1LUmWV1QfY43FT7HZi/aAZc8xFF3jb4wvpYmQ6ySjSkivrOMe8XsYVZLvB6pxmVwUbGw ClzKUBJ2GzKTBFcdO4U5D0yNiUPIokF+K4rCOmtZmun5R8XrqPEV1O8aVy9CRVqpJNBV PNZsSJNXzPG7EB1J9p+r1+KY4f+L6ePfn2gJ4/nqAb8dMWHnLtOFEwSvGwwAb487hW8j 1y+yrWbW5vov9P734PtfQ0jFf3E4SlJfZLjnHJtPBMKJOJ3f1S3qPoAHhbmKi5z6nz3W GKGA== X-Gm-Message-State: APt69E03Mh7cY0wsjPBIO44vwz66+bR/6HKEWPAXaxOI6TAL+UmHGDGp dAAeStkORHk1z8A7AVA2tUc/IVqz X-Google-Smtp-Source: AAOMgpdbroZ9abW3fzoTY7HZVF5ETzsARHBV62w+slEbsTDwtVLnx5gA5Q9qOn00PaL92sd+YsNdrw== X-Received: by 2002:adf:fdcd:: with SMTP id i13-v6mr16951363wrs.276.1531227403064; Tue, 10 Jul 2018 05:56:43 -0700 (PDT) Received: from bidouze.vm.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id s2-v6sm15088467wrn.75.2018.07.10.05.56.41 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Jul 2018 05:56:42 -0700 (PDT) Date: Tue, 10 Jul 2018 14:56:25 +0200 From: =?iso-8859-1?Q?Ga=EBtan?= Rivet To: Thomas Monjalon Cc: dev@dpdk.org, shreyansh.jain@nxp.com Message-ID: <20180710125625.4izywtqnex2rwdgf@bidouze.vm.6wind.com> References: <42037d90036505fc764572b8a4c8b25a529c4ec7.1530791217.git.gaetan.rivet@6wind.com> <2903699.tLnOVabUjO@xps> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <2903699.tLnOVabUjO@xps> User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [dpdk-dev] [PATCH v10 05/27] eal: introduce dtor macros X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jul 2018 12:56:43 -0000 Hi Thomas, On Tue, Jul 10, 2018 at 01:40:01PM +0200, Thomas Monjalon wrote: > 05/07/2018 13:48, Gaetan Rivet: > > Signed-off-by: Gaetan Rivet > > Please justify why you need destructors, by providing a commit log. > > > --- a/lib/librte_eal/common/include/rte_common.h > > +++ b/lib/librte_eal/common/include/rte_common.h > > @@ -111,6 +111,29 @@ static void __attribute__((constructor(RTE_PRIO(prio)), used)) func(void) > > #define RTE_INIT(func) \ > > RTE_INIT_PRIO(func, LAST) > > > > +/** > > + * Run after main() with low priority. > > + * > > + * @param func > > + * Destructor function name. > > + * @param prio > > + * Priority number must be above 100. > > + * Lowest number is the last to run. > > + */ > > +#define RTE_FINI_PRIO(func, prio) \ > > +static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void) > > I don't like the name of this macro. > What about RTE_CLEAN_PRIO? > > FINI is symmetrical to INIT in referencing the related ELF section. RTE_CLEAN presumes that the intended purpose of the function will be to cleanup resources. As far as we are concerned, this code could send a signal, dump config info or format / (which would be a pretty advanced cleanup, granted). Sometimes, it could be used to release resources, presumably. I'm not a fan of FINI either, but I appreciate the symmetry. It's pretty neutral about what it does, as its meaning is literally "The following function will be part of the .fini section". Alternatives: FINALIZE UNINIT But they have the same issue as RTE_CLEAN, IMO. -- Gaëtan Rivet 6WIND