From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com [74.125.82.66]) by dpdk.org (Postfix) with ESMTP id 43C6B4C76 for ; Thu, 22 Mar 2018 16:56:59 +0100 (CET) Received: by mail-wm0-f66.google.com with SMTP id v21so5712555wmc.1 for ; Thu, 22 Mar 2018 08:56:59 -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=HTAF7KxZ31gSxN0RDmR8HfXnQmm8OLGnMRyZSoD4JQQ=; b=Mau1F7qbkejtuJxBFqm3PfnPy3sAz+xxJrSy7UX2NvBO+1q4oVOvqvNIVM2X/9fAUx /mqpJ3IO9jzPqsGJZSpw+wF04VXyrwdq/mNdWQ3Tx5WZqVsn+GExfe+zvfIQ3Fk3TZ1s 2XFVr2QSghkKumpsqUYnNOeMUif/5uSwR/zLg4BqpQHEc6qOe49/3kA5bLDPT7PRMiMK ZU6HeQUNU/KuFHfVn8aZLO+yQyeLU1cf0lZ63D/GbBzkZF5rQMqnfnkZitmsENPgnzkX 0wOzhvwcjSZ7haEiiu/zqKfBmxF1vR6eRnkfCuCG0x4J4EGclKDlKH+IF7CzbRPnTT5Y O0oA== 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=HTAF7KxZ31gSxN0RDmR8HfXnQmm8OLGnMRyZSoD4JQQ=; b=Mip9/v5SzRlV6Y/no3l8D3yHrb3s4juQVbL84s5Foc6yAG/njtlxdHweNWs889A/Sp 2Dj8dr5nhQ8I0YqofvIFnPFkJ/puBgMnYeGC8sRFtClML5pPjjmsOeLZ79QoWbiChtsV bimv683Ncy91xpNaRY6N6HJrFx5dPuy3KndZ+a390UQdP6aljIA7t4xm1TAHzpLE5vlt QT4ezkcUF7HfkRXrmFvqK0r2SnW2VMkyrgkKPoGCtJ1OMyVl01A07Io8VYjooRGY7MH+ P0bZJXc/8q6GPb7iMP/Wg9Lv2erpTHTFeU6sbSWJ7P7XmSU05iDjz380/03B9EVM8FLx P1wA== X-Gm-Message-State: AElRT7E35yKhWTUwPKwHlbBKp+xiQOhSgCU4YgMHe8AkzTzdmoFJ9Yhe ocOjfp9PmTxZoX9FQoKbBwWaqrph X-Google-Smtp-Source: AG47ELsFmA2XK0PyYxR11HM3MIsvAPVkUVphaRbuxUy4gFu9Nl3TMckrbDrCTZPkowMCY0gqcIlnJA== X-Received: by 10.28.109.88 with SMTP id i85mr5804774wmc.150.1521734218638; Thu, 22 Mar 2018 08:56:58 -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 p68sm7235236wmg.7.2018.03.22.08.56.57 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 22 Mar 2018 08:56:57 -0700 (PDT) Date: Thu, 22 Mar 2018 16:56:43 +0100 From: =?iso-8859-1?Q?Ga=EBtan?= Rivet To: Neil Horman Cc: dev@dpdk.org Message-ID: <20180322155643.nrfkxosktvt67gik@bidouze.vm.6wind.com> References: <20180322135114.GB6272@hmswarspite.think-freely.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180322135114.GB6272@hmswarspite.think-freely.org> User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [dpdk-dev] [PATCH v2 01/18] 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: Thu, 22 Mar 2018 15:56:59 -0000 On Thu, Mar 22, 2018 at 09:51:14AM -0400, Neil Horman wrote: > On Wed, Mar 21, 2018 at 06:15:22PM +0100, Gaetan Rivet wrote: > > Signed-off-by: Gaetan Rivet > > --- > > lib/librte_eal/common/include/rte_common.h | 23 +++++++++++++++++++++++ > > 1 file changed, 23 insertions(+) > > > > diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h > > index c7803e41c..500fc3adb 100644 > > --- a/lib/librte_eal/common/include/rte_common.h > > +++ b/lib/librte_eal/common/include/rte_common.h > > @@ -105,6 +105,29 @@ static void __attribute__((constructor, used)) func(void) > > static void __attribute__((constructor(prio), used)) func(void) > > > > /** > > + * Run after main() with high priority. > > + * > > + * The destructor will be run *before* prioritized destructors. > > + * > > + * @param func > > + * Destructor function name. > > + */ > > +#define RTE_FINI(func) \ > > +static void __attribute__((destructor, used)) func(void) > > + > > +/** > > + * 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(prio), used)) func(void) > > + > > +/** > Additionally, it might be nice to further abstract the destructor priority to > fixed levels so that people aren't always trying to guess what the right magic > number should be. I.e. create several destructor macros of the form: > RTE_FINI_ > > Where name is a meaningfull term like FINAL, PMD, EARLY, or some such set that > implies a priority value encoded within the macro definition. That would also > eliminate the need to create a BUILD BUG macro if the priority was specified to > be too low > > Neil > Good idea, and I agree that we need helpers on this. Not sure about _FINAL and _EARLY however. I will propose a patch as a response to this mail, let me know if that's what you had in mind. -- Gaëtan Rivet 6WIND