DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] mk: using initial-exec model for thread local variable
@ 2018-07-05 14:13 Marvin Liu
  2018-07-05  9:25 ` Thomas Monjalon
  2018-07-05 14:46 ` Sachin Saxena
  0 siblings, 2 replies; 8+ messages in thread
From: Marvin Liu @ 2018-07-05 14:13 UTC (permalink / raw)
  To: zhiyong.yang, thomas, dev; +Cc: Marvin Liu

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 <yong.liu@intel.com>

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
+
 WERROR_FLAGS := -W -Wall -Wstrict-prototypes -Wmissing-prototypes
 WERROR_FLAGS += -Wmissing-declarations -Wold-style-definition -Wpointer-arith
 WERROR_FLAGS += -Wcast-align -Wnested-externs -Wcast-qual
-- 
2.17.0

^ permalink raw reply	[flat|nested] 8+ messages in thread
* [dpdk-dev] [PATCH] mk: using initial-exec model for thread local variable
@ 2018-04-28  9:54 Marvin Liu
  2018-04-28  4:39 ` Yang, Zhiyong
  0 siblings, 1 reply; 8+ messages in thread
From: Marvin Liu @ 2018-04-28  9:54 UTC (permalink / raw)
  To: dev; +Cc: Marvin Liu

When building share library, thread-local storage model will be changed
to global-dynamic. It will cost additional protect for read thread local
variable. By now only lcore id is this kind of varaible and not need to
dynamic share with other threads. So make TLS model back to initial-exec
like static library for better performance.

Signed-off-by: Marvin Liu <yong.liu@intel.com>

diff --git a/mk/toolchain/gcc/rte.vars.mk b/mk/toolchain/gcc/rte.vars.mk
index 7e4531b..7b5e71c 100644
--- a/mk/toolchain/gcc/rte.vars.mk
+++ b/mk/toolchain/gcc/rte.vars.mk
@@ -43,6 +43,10 @@ ifeq (,$(findstring -O0,$(EXTRA_CFLAGS)))
 endif
 endif
 
+ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)
+TOOLCHAIN_CFLAGS += -ftls-model=initial-exec
+endif
+
 WERROR_FLAGS := -W -Wall -Wstrict-prototypes -Wmissing-prototypes
 WERROR_FLAGS += -Wmissing-declarations -Wold-style-definition -Wpointer-arith
 WERROR_FLAGS += -Wcast-align -Wnested-externs -Wcast-qual
-- 
1.9.3

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-07-06 10:02 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-05 14:13 [dpdk-dev] [PATCH] mk: using initial-exec model for thread local variable Marvin Liu
2018-07-05  9:25 ` Thomas Monjalon
2018-07-05 14:46 ` Sachin Saxena
2018-07-06  2:22   ` Liu, Yong
2018-07-06 10:02     ` Bruce Richardson
  -- strict thread matches above, loose matches on Subject: below --
2018-04-28  9:54 Marvin Liu
2018-04-28  4:39 ` Yang, Zhiyong
2018-05-18  9:46   ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).