From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60089.outbound.protection.outlook.com [40.107.6.89]) by dpdk.org (Postfix) with ESMTP id 00B421BEFB for ; Thu, 5 Jul 2018 16:46:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=oHZ34kixWuxu1pLfoODQ5EYSFJ+Zzp+z8YCo+BlqBJg=; b=hUBEVIdeDeoWRAMidcW0rIf0QTq0ss9NCpfBNfBjzhSBsAm0cFzZp/OB7kB3LifbjEDvqgFc23EmiCxehEKnq74GjUGHF/2Pwd656IVPF/J8sNN7GrUzex+xzPu2ET5jDvCrzXgMu0CLqFf3+k1+WNElLp5Z5IBBojkeMLn3iu8= Received: from HE1PR0401MB1772.eurprd04.prod.outlook.com (10.169.118.150) by HE1PR0401MB2620.eurprd04.prod.outlook.com (10.168.148.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.906.24; Thu, 5 Jul 2018 14:46:25 +0000 Received: from HE1PR0401MB1772.eurprd04.prod.outlook.com ([fe80::913b:4746:cdad:820f]) by HE1PR0401MB1772.eurprd04.prod.outlook.com ([fe80::913b:4746:cdad:820f%7]) with mapi id 15.20.0930.016; Thu, 5 Jul 2018 14:46:24 +0000 From: Sachin Saxena To: Marvin Liu , "zhiyong.yang@intel.com" , "thomas@monjalon.net" , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] mk: using initial-exec model for thread local variable Thread-Index: AQHUFClUyD2s6lU+80q/Lq4Ijm2MzaSAr/jA Date: Thu, 5 Jul 2018 14:46:24 +0000 Message-ID: References: <20180705141321.129989-1-yong.liu@intel.com> In-Reply-To: <20180705141321.129989-1-yong.liu@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=sachin.saxena@nxp.com; x-originating-ip: [182.77.121.94] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; HE1PR0401MB2620; 7:8x1KWnfd9mX41RTU/yuJ28K6lPmh+LWffno7IjtA1Tbw/Nfi5d65z4Fueov/5r/rlSzc7yNMYmZt3zUquHa7rYcQgOH9TgX/CkxofknqWs47mbg3W5veASC/rlcjrajYijif+R+3mzac7Z1FjpO/PiNzDBehu2B3drcNbeih6WfSAnim/0OPixxY2HnY2x/TgwFhdO0M3vJqCcrs/KkmQuPld4crT6rUfdSZb25aVuB39Yr4qhdGpB7kj+0sL6y+ x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-correlation-id: 1eb518c0-5348-4c3f-1a85-08d5e2861511 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600053)(711020)(48565401081)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020); SRVR:HE1PR0401MB2620; x-ms-traffictypediagnostic: HE1PR0401MB2620: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(228905959029699); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231254)(944501410)(52105095)(3002001)(93006095)(93001095)(10201501046)(6055026)(149027)(150027)(6041310)(20161123562045)(20161123560045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(6072148)(201708071742011)(7699016); SRVR:HE1PR0401MB2620; BCL:0; PCL:0; RULEID:; SRVR:HE1PR0401MB2620; x-forefront-prvs: 0724FCD4CD x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39860400002)(346002)(376002)(366004)(396003)(136003)(199004)(189003)(53936002)(106356001)(25786009)(33656002)(6246003)(6506007)(256004)(76176011)(2201001)(66066001)(7696005)(102836004)(5660300001)(7736002)(105586002)(2906002)(486006)(11346002)(3846002)(305945005)(26005)(97736004)(14454004)(9686003)(2900100001)(2501003)(44832011)(81166006)(81156014)(478600001)(476003)(446003)(316002)(6116002)(110136005)(55016002)(229853002)(99286004)(86362001)(74316002)(14444005)(8936002)(5250100002)(186003)(6436002)(68736007); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR0401MB2620; H:HE1PR0401MB1772.eurprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: udu5K6Jtf2aqGKM0tJ1RYbaXjKXzR8NlUDgOsOd1BfnD6HlhGk6HH9i1rLXr6DgzyxCyPlh/22x+CBnjBhRnVGekVeyT/hF4HXDbKVRd2IAeAstSmaXETdLP8p9qNAHbhXdVE+NfYWxWGtuK7xOFb9+EjcvttCGKcws/Kr38YAven/lCZIpqKRghAEg77teC7E9SYviLqpukAhKZXNYXtFheBF9kVlGmgEwEaIkc9OKkxA3Dr5sYpkPf/ga75wLv95PFKN9Vf1Cxcbr5gWXosxOoV4borh01Raog5BJ+OmQN5zEELVsc8OMtaJWHc+E5MczfCrvdtQSqM8tE1riCfqR0ttXiDXzKpJW0xnWn/H0= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1eb518c0-5348-4c3f-1a85-08d5e2861511 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Jul 2018 14:46:24.8389 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0401MB2620 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: Thu, 05 Jul 2018 14:46:27 -0000 >=20 > When building share library, thread-local storage model will be changed t= o > global-dynamic. It will add additional cost for reading thread local vari= able. > On the other hand, dynamically load share library with static TLS will re= quest > additional DTV slot which is limited by loader. By now only librte_pmd_ea= l.so > contain thread local variable. So that can make TLS model back to initial= -exec > like static library for better performance. >=20 > Signed-off-by: Marvin Liu >=20 > 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 endi= f >=20 > +# 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 +=3D -ftls-model=3Dinitial-exec endif > + [Sachin Saxena] Using initial-exec model for shared object is not recomme= nded. 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 re= fuse 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 followi= ng error: "load_one_plugin:145: /usr/lib/vpp_plugins/dpdk_plugin.so: cannot allocat= e memory in static TLS block" Note that dpdk dpaa2 driver and VPP both uses TLS variables quite significa= ntly. When forced to Initial-exec model in dpdk shared object, VPP static T= LS space is getting exhausted and dlopen() returns error while trying to lo= ad the DPDK object. For same reason, when we use "-fPIC" the default TLS model changed to "glob= al-dynamics" from "Initial-exec". In my opinion, this change should not be merged as it is breaking basic fun= ctionality. > WERROR_FLAGS :=3D -W -Wall -Wstrict-prototypes -Wmissing-prototypes > WERROR_FLAGS +=3D -Wmissing-declarations -Wold-style-definition -Wpointer= - > arith WERROR_FLAGS +=3D -Wcast-align -Wnested-externs -Wcast-qual > -- > 2.17.0