From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id EB9E71BDD5 for ; Fri, 6 Jul 2018 12:02:13 +0200 (CEST) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Jul 2018 03:02:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,315,1526367600"; d="scan'208";a="213883870" Received: from bricha3-mobl.ger.corp.intel.com ([10.237.221.107]) by orsmga004.jf.intel.com with SMTP; 06 Jul 2018 03:02:10 -0700 Received: by (sSMTP sendmail emulation); Fri, 06 Jul 2018 11:02:09 +0100 Date: Fri, 6 Jul 2018 11:02:09 +0100 From: Bruce Richardson To: "Liu, Yong" Cc: Sachin Saxena , "Yang, Zhiyong" , "thomas@monjalon.net" , "dev@dpdk.org" Message-ID: <20180706100208.GA23248@bricha3-MOBL.ger.corp.intel.com> References: <20180705141321.129989-1-yong.liu@intel.com> <86228AFD5BCD8E4EBFD2B90117B5E81E630EF9EF@SHSMSX103.ccr.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <86228AFD5BCD8E4EBFD2B90117B5E81E630EF9EF@SHSMSX103.ccr.corp.intel.com> Organization: Intel Research and Development Ireland Ltd. User-Agent: Mutt/1.10.0 (2018-05-17) Subject: Re: [dpdk-dev] [PATCH] mk: using initial-exec model for thread local variable 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: Fri, 06 Jul 2018 10:02:14 -0000 On Fri, Jul 06, 2018 at 02:22:14AM +0000, Liu, Yong wrote: > > > > -----Original Message----- > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Sachin Saxena > > Sent: Thursday, July 05, 2018 10:46 PM > > To: Liu, Yong ; Yang, Zhiyong ; > > thomas@monjalon.net; dev@dpdk.org > > Subject: Re: [dpdk-dev] [PATCH] mk: using initial-exec model for thread > > local variable > > > > > > > > > > > > When building share library, thread-local storage model will be changed > > to > > > global-dynamic. It will add additional cost for reading thread local > > variable. > > > On the other hand, dynamically load share library with static TLS will > > request > > > additional DTV slot which is limited by loader. By now only > > librte_pmd_eal.so > > > contain thread local variable. So that can make TLS model back to > > initial-exec > > > like static library for better performance. > > > > > > Signed-off-by: Marvin Liu > > > > > > diff --git a/mk/toolchain/gcc/rte.vars.mk b/mk/toolchain/gcc/rte.vars.mk > > > index 7e4531bab..19d5e11ef 100644 > > > --- a/mk/toolchain/gcc/rte.vars.mk > > > +++ b/mk/toolchain/gcc/rte.vars.mk > > > @@ -43,6 +43,13 @@ ifeq (,$(findstring -O0,$(EXTRA_CFLAGS))) endif > > endif > > > > > > +# Initial execution TLS model has better performane compared to dynamic > > > +# global. But this model require for addtional slot on DTV when dlopen > > > +# object with thread local variable. > > > +ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y) > > > +TOOLCHAIN_CFLAGS += -ftls-model=initial-exec endif > > > + > > > > [Sachin Saxena] Using initial-exec model for shared object is not > > recommended. If you link a shared object containing IE-model, the object > > will have the DF_STATIC_TLS flag set. By the spec, this means that dlopen() > > might refuse to load it if TLS usage is greater than static TLS space. > > This is what happening, when I tried to validate this change on ARM64 > > based NXP platform with VPP-dpdk solution. VPP initialization fails with > > following error: > > "load_one_plugin:145: /usr/lib/vpp_plugins/dpdk_plugin.so: cannot > > allocate memory in static TLS block" > > > > Note that dpdk dpaa2 driver and VPP both uses TLS variables quite > > significantly. When forced to Initial-exec model in dpdk shared object, > > VPP static TLS space is getting exhausted and dlopen() returns error while > > trying to load the DPDK object. > > For same reason, when we use "-fPIC" the default TLS model changed to > > "global-dynamics" from "Initial-exec". > > > > In my opinion, this change should not be merged as it is breaking basic > > functionality. > > Thanks for your opinion, Sachin. > IE model may cause problem when using dlopen open share object. On the other hand, it can benefit performance. > It will be better to keep current workable setting and users may change it by themselves. > What is the performance delta, and where is it most seen? I suggest for future patches like this, that the commit message itself should give a rough/approx indication of the perf impacts. /Bruce