From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id A2D381BE4E for ; Fri, 6 Jul 2018 04:22:18 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Jul 2018 19:22:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,314,1526367600"; d="scan'208";a="64592556" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by fmsmga002.fm.intel.com with ESMTP; 05 Jul 2018 19:22:17 -0700 Received: from fmsmsx111.amr.corp.intel.com (10.18.116.5) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 5 Jul 2018 19:22:17 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by fmsmsx111.amr.corp.intel.com (10.18.116.5) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 5 Jul 2018 19:22:16 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.100]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.17]) with mapi id 14.03.0319.002; Fri, 6 Jul 2018 10:22:14 +0800 From: "Liu, Yong" To: Sachin Saxena , "Yang, Zhiyong" , "thomas@monjalon.net" , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] mk: using initial-exec model for thread local variable Thread-Index: AQHUFG78DCjJmEYTf0qGqzRLsvrFxqSBdU5g Date: Fri, 6 Jul 2018 02:22:14 +0000 Message-ID: <86228AFD5BCD8E4EBFD2B90117B5E81E630EF9EF@SHSMSX103.ccr.corp.intel.com> References: <20180705141321.129989-1-yong.liu@intel.com> In-Reply-To: Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNmM5M2Q1MjItNjMwZi00M2RlLTg0NTAtM2Q4YTg4MjNlNjE2IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiakU3TEd1TytMUUN2bUpubDBnRXVhTjJ3bkl2OEdTemlHQnRvdE00c25VMjluMzRBWlFHUWptd2EwVTB2SHluViJ9 x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.200.100 dlp-reaction: no-action x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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 02:22:19 -0000 > -----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 >=20 >=20 >=20 > > > > 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.m= k > > 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 dynami= c > > +# 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 +=3D -ftls-model=3Dinitial-exec endif > > + >=20 > [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" >=20 > 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 whil= e > trying to load the DPDK object. > For same reason, when we use "-fPIC" the default TLS model changed to > "global-dynamics" from "Initial-exec". >=20 > In my opinion, this change should not be merged as it is breaking basic > functionality. Thanks for your opinion, Sachin.=20 IE model may cause problem when using dlopen open share object. On the othe= r hand, it can benefit performance. It will be better to keep current workable setting and users may change it = by themselves. Regards, Marvin >=20 > > WERROR_FLAGS :=3D -W -Wall -Wstrict-prototypes -Wmissing-prototypes > > WERROR_FLAGS +=3D -Wmissing-declarations -Wold-style-definition -Wpoint= er- > > arith WERROR_FLAGS +=3D -Wcast-align -Wnested-externs -Wcast-qual > > -- > > 2.17.0