[dpdk-dev] [PATCH v6 4/4] add pthread_shim example to performance thread
From: Ian Betts This commit adds an example that illustrates how to implement a pthread shim with the lthread subsystem included in the performance thread example application. Signed-off-by: Ian Betts --- examples/performance-thread/Makefile | 2 + examples/performance-thread/pthread_shim/Makefile | 60 ++ examples/performance-thread/pthread_shim/main.c| 284 .../performance-thread/pthread_shim/pthread_shim.c | 714 + .../performance-thread/pthread_shim/pthread_shim.h | 113 5 files changed, 1173 insertions(+) create mode 100644 examples/performance-thread/pthread_shim/Makefile create mode 100644 examples/performance-thread/pthread_shim/main.c create mode 100644 examples/performance-thread/pthread_shim/pthread_shim.c create mode 100644 examples/performance-thread/pthread_shim/pthread_shim.h diff --git a/examples/performance-thread/Makefile b/examples/performance-thread/Makefile index 55c4632..92a16ec 100644 --- a/examples/performance-thread/Makefile +++ b/examples/performance-thread/Makefile @@ -39,6 +39,8 @@ RTE_TARGET ?= x86_64-native-linuxapp-gcc include $(RTE_SDK)/mk/rte.vars.mk DIRS-$(CONFIG_RTE_PERFORMANCE_THREAD) += l3fwd-thread +DIRS-$(CONFIG_RTE_PERFORMANCE_THREAD) += pthread_shim + include $(RTE_SDK)/mk/rte.extsubdir.mk diff --git a/examples/performance-thread/pthread_shim/Makefile b/examples/performance-thread/pthread_shim/Makefile new file mode 100644 index 000..9cf32e3 --- /dev/null +++ b/examples/performance-thread/pthread_shim/Makefile @@ -0,0 +1,60 @@ +# BSD LICENSE +# +# Copyright(c) 2015 Intel Corporation. All rights reserved. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +ifeq ($(RTE_SDK),) +$(error "Please define RTE_SDK environment variable") +endif + +# Default target, can be overridden by command line or environment +RTE_TARGET ?= x86_64-native-linuxapp-gcc + +include $(RTE_SDK)/mk/rte.vars.mk + +# binary name +APP = lthread_pthread_shim + +# all source are stored in SRCS-y +SRCS-y := main.c pthread_shim.c +INCLUDES := -I$(RTE_SDK)/$(RTE_TARGET)/include -I$(SRCDIR) +include $(RTE_SDK)/examples/performance-thread/common/common.mk + +CFLAGS=-g -O3 $(USER_FLAGS) $(INCLUDES) +CFLAGS += $(WERROR_FLAGS) + +LDFLAGS += -lpthread + +# workaround for a gcc bug with noreturn attribute +# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603 +ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y) +CFLAGS_main.o += -Wno-return-type +endif + +include $(RTE_SDK)/mk/rte.extapp.mk diff --git a/examples/performance-thread/pthread_shim/main.c b/examples/performance-thread/pthread_shim/main.c new file mode 100644 index 000..2f67c1b --- /dev/null +++ b/examples/performance-thread/pthread_shim/main.c @@ -0,0 +1,284 @@ + +/*- + * BSD LICENSE + * + * Copyright(c) 2015 Intel Corporation. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of In
[dpdk-dev] [PATCH v6 3/4] add l3fwd-thread example in performance-thread
From: Ian Betts This commit adds an L3 forwarding application to the performace-thread example. Signed-off-by: Ian Betts --- config/common_linuxapp|1 + config/defconfig_i686-native-linuxapp-gcc |1 + config/defconfig_i686-native-linuxapp-icc |1 + config/defconfig_x86_64-native-linuxapp-gcc |3 + config/defconfig_x86_64-native-linuxapp-icc |3 + examples/Makefile |2 + examples/performance-thread/Makefile | 44 + examples/performance-thread/l3fwd-thread/Makefile | 57 + examples/performance-thread/l3fwd-thread/main.c | 3641 + 9 files changed, 3753 insertions(+) create mode 100644 examples/performance-thread/Makefile create mode 100644 examples/performance-thread/l3fwd-thread/Makefile create mode 100644 examples/performance-thread/l3fwd-thread/main.c diff --git a/config/common_linuxapp b/config/common_linuxapp index 2866986..95da485 100644 --- a/config/common_linuxapp +++ b/config/common_linuxapp @@ -526,3 +526,3 @@ CONFIG_RTE_APP_TEST=y CONFIG_RTE_TEST_PMD=y CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES=n CONFIG_RTE_TEST_PMD_RECORD_BURST_STATS=n diff --git a/config/defconfig_i686-native-linuxapp-gcc b/config/defconfig_i686-native-linuxapp-gcc index a90de9b..c101942 100644 --- a/config/defconfig_i686-native-linuxapp-gcc +++ b/config/defconfig_i686-native-linuxapp-gcc @@ -49,3 +49,3 @@ CONFIG_RTE_LIBRTE_KNI=n # Vectorized PMD is not supported on 32-bit # CONFIG_RTE_IXGBE_INC_VECTOR=n diff --git a/config/defconfig_i686-native-linuxapp-icc b/config/defconfig_i686-native-linuxapp-icc index c021321..915bfa0 100644 --- a/config/defconfig_i686-native-linuxapp-icc +++ b/config/defconfig_i686-native-linuxapp-icc @@ -49,3 +49,3 @@ CONFIG_RTE_LIBRTE_KNI=n # Vectorized PMD is not supported on 32-bit # CONFIG_RTE_IXGBE_INC_VECTOR=n diff --git a/config/defconfig_x86_64-native-linuxapp-gcc b/config/defconfig_x86_64-native-linuxapp-gcc index 60baf5b..76d6b10 100644 --- a/config/defconfig_x86_64-native-linuxapp-gcc +++ b/config/defconfig_x86_64-native-linuxapp-gcc @@ -40,3 +40,5 @@ CONFIG_RTE_ARCH_64=y CONFIG_RTE_TOOLCHAIN="gcc" CONFIG_RTE_TOOLCHAIN_GCC=y + +CONFIG_RTE_PERFORMANCE_THREAD=y diff --git a/config/defconfig_x86_64-native-linuxapp-icc b/config/defconfig_x86_64-native-linuxapp-icc index 71d1e28..58a1e09 100644 --- a/config/defconfig_x86_64-native-linuxapp-icc +++ b/config/defconfig_x86_64-native-linuxapp-icc @@ -40,3 +40,5 @@ CONFIG_RTE_ARCH_64=y CONFIG_RTE_TOOLCHAIN="icc" CONFIG_RTE_TOOLCHAIN_ICC=y + +CONFIG_RTE_PERFORMANCE_THREAD=y diff --git a/examples/Makefile b/examples/Makefile index 5dd2c53..aeb10f3 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -77,5 +77,7 @@ DIRS-y += vmdq DIRS-y += vmdq_dcb DIRS-$(CONFIG_RTE_LIBRTE_POWER) += vm_power_manager DIRS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += l2fwd-crypto +DIRS-$(CONFIG_RTE_PERFORMANCE_THREAD) += performance-thread + include $(RTE_SDK)/mk/rte.extsubdir.mk diff --git a/examples/performance-thread/Makefile b/examples/performance-thread/Makefile new file mode 100644 index 000..55c4632 --- /dev/null +++ b/examples/performance-thread/Makefile @@ -0,0 +1,44 @@ +# BSD LICENSE +# +# Copyright(c) 2015 Intel Corporation. All rights reserved. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +ifeq ($(RTE_SDK),) +$(error "Please define RTE_SDK environment variable"
[dpdk-dev] [PATCH v6 2/4] add lthread subsystem for performance-thread
From: Ian Betts This commit adds the lightweight thread subsystem used by the performance-thread sample applications. Signed-off-by: Ian Betts --- .../performance-thread/common/arch/x86/atomic.h| 59 ++ examples/performance-thread/common/arch/x86/ctx.c | 93 +++ examples/performance-thread/common/arch/x86/ctx.h | 57 ++ examples/performance-thread/common/common.mk | 40 + examples/performance-thread/common/lthread.c | 530 + examples/performance-thread/common/lthread.h | 99 +++ examples/performance-thread/common/lthread_api.h | 829 + examples/performance-thread/common/lthread_cond.c | 241 ++ examples/performance-thread/common/lthread_cond.h | 77 ++ examples/performance-thread/common/lthread_diag.c | 321 examples/performance-thread/common/lthread_diag.h | 129 .../performance-thread/common/lthread_diag_api.h | 319 examples/performance-thread/common/lthread_int.h | 212 ++ examples/performance-thread/common/lthread_mutex.c | 256 +++ examples/performance-thread/common/lthread_mutex.h | 52 ++ .../performance-thread/common/lthread_objcache.h | 160 examples/performance-thread/common/lthread_pool.h | 333 + examples/performance-thread/common/lthread_queue.h | 303 examples/performance-thread/common/lthread_sched.c | 600 +++ examples/performance-thread/common/lthread_sched.h | 152 examples/performance-thread/common/lthread_timer.h | 47 ++ examples/performance-thread/common/lthread_tls.c | 254 +++ examples/performance-thread/common/lthread_tls.h | 57 ++ 23 files changed, 5220 insertions(+) create mode 100644 examples/performance-thread/common/arch/x86/atomic.h create mode 100644 examples/performance-thread/common/arch/x86/ctx.c create mode 100644 examples/performance-thread/common/arch/x86/ctx.h create mode 100644 examples/performance-thread/common/common.mk create mode 100644 examples/performance-thread/common/lthread.c create mode 100644 examples/performance-thread/common/lthread.h create mode 100644 examples/performance-thread/common/lthread_api.h create mode 100644 examples/performance-thread/common/lthread_cond.c create mode 100644 examples/performance-thread/common/lthread_cond.h create mode 100644 examples/performance-thread/common/lthread_diag.c create mode 100644 examples/performance-thread/common/lthread_diag.h create mode 100644 examples/performance-thread/common/lthread_diag_api.h create mode 100644 examples/performance-thread/common/lthread_int.h create mode 100644 examples/performance-thread/common/lthread_mutex.c create mode 100644 examples/performance-thread/common/lthread_mutex.h create mode 100644 examples/performance-thread/common/lthread_objcache.h create mode 100644 examples/performance-thread/common/lthread_pool.h create mode 100644 examples/performance-thread/common/lthread_queue.h create mode 100644 examples/performance-thread/common/lthread_sched.c create mode 100644 examples/performance-thread/common/lthread_sched.h create mode 100644 examples/performance-thread/common/lthread_timer.h create mode 100644 examples/performance-thread/common/lthread_tls.c create mode 100644 examples/performance-thread/common/lthread_tls.h diff --git a/examples/performance-thread/common/arch/x86/atomic.h b/examples/performance-thread/common/arch/x86/atomic.h new file mode 100644 index 000..968dbe2 --- /dev/null +++ b/examples/performance-thread/common/arch/x86/atomic.h @@ -0,0 +1,59 @@ +/* + *- + * BSD LICENSE + * + * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR
[dpdk-dev] [PATCH v6 1/4] doc: add sample application guide for performance-thread
From: Ian Betts This commit adds the sample application user guide for the performance thread sample application. Signed-off-by: Ian Betts --- .../sample_app_ug/img/performance_thread_1.svg | 799 + .../sample_app_ug/img/performance_thread_2.svg | 865 ++ doc/guides/sample_app_ug/index.rst |1 + doc/guides/sample_app_ug/performance_thread.rst| 1263 4 files changed, 2928 insertions(+) create mode 100644 doc/guides/sample_app_ug/img/performance_thread_1.svg create mode 100644 doc/guides/sample_app_ug/img/performance_thread_2.svg create mode 100644 doc/guides/sample_app_ug/performance_thread.rst diff --git a/doc/guides/sample_app_ug/img/performance_thread_1.svg b/doc/guides/sample_app_ug/img/performance_thread_1.svg new file mode 100644 index 000..db01d7c --- /dev/null +++ b/doc/guides/sample_app_ug/img/performance_thread_1.svg @@ -0,0 +1,799 @@ + + + +http://purl.org/dc/elements/1.1/"; + xmlns:cc="http://creativecommons.org/ns#"; + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"; + xmlns:svg="http://www.w3.org/2000/svg"; + xmlns="http://www.w3.org/2000/svg"; + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"; + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"; + width="449.57141" + height="187.34319" + viewBox="0 0 449.57143 187.34319" + id="svg2" + version="1.1" + inkscape:version="0.48.3.1 r9886" + sodipodi:docname="performance_thread_1.svg" + inkscape:export-filename="C:\Users\tkulasex\Documents\L-threads\model-v2.png" + inkscape:export-xdpi="90" + inkscape:export-ydpi="90"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +image/svg+xml +http://purl.org/dc/dcmitype/StillImage"; /> + + + + + + + + + + Port 1 + + +Port 2 + + + rx-thread + +rings + + + + + + rx-thread + + + + Port 1 + + +Port 2 + + + tx-thread + + + + + + tx-thread + + + + + + + tx-thread + + + + + + + + diff --git a/doc/guides/sample_app_ug/img/performance_thread_2.svg b/doc/guides/sample_app_ug/img/performance_thread_2.svg new file mode 100644 index 000..48cf833 --- /dev/null +++ b/doc/guides/sample_app_ug/img/performance_thread_2.svg @@ -0,0 +1,865 @@ + + + +http://purl.org/dc/elements/1.1/"; + xmlns:cc="http://creativecommons.org/ns#"; + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"; + xmlns:svg="http://www.w3.org/2000/svg"; + xmlns="http://www.w3.org/2000/svg"; + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"; + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"; + width="449.57141" + height="187.34319" + viewBox="0 0 449.57143 187.34319" + id="svg2" + version="1.1" + inkscape:version="0.48.3.1 r9886" + sodipodi:docname="performance_thread_2.svg" + inkscape:export-filename="C:\Users\tkulasex\Documents\L-threads\model-v2.png" + inkscape:export-xdpi="90" + inkscape:export-ydpi="90"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +image/svg+xml +http://purl.org/dc/dcmitype/StillImage"; /> + + + + + + + + + + Port 1 + + +Port 2 + + + rx-thread + +rings + + + + + + rx-thread + + + + Port 1 + + +
[dpdk-dev] [PATCH v6 0/4] examples: add performance-thread
From: Ian Betts This patchset comprises a layer 3 forwarding derivative intended to facilitate characterization of performance with different threading models, specifically:- 1. EAL threads running on different physical cores 2. EAL threads running on the same physical core 3. Lightweight threads running in an EAL thread Purpose and justification Since dpdk 2.0 it has been possible to assign multiple EAL threads to a physical core ( case 2 above ). Currently no example application has focused on demonstrating the performance constraints of differing threading models. Whilst purpose built applications that fully comprehend the DPDK single threaded programming model will always yield superior performance, the desire to preserve ROI in legacy code written for multithreaded operating environments makes lightweight threads (case 3 above) worthy of consideration. As well as aiding with legacy code reuse, it is anticipated that lightweight threads will make it possible to scale a multithreaded application with fine granularity allowing an application to more easily take advantage of headroom on EAL cores, or conversely occupy more cores, as dictated by system load. To explore performance with lightweight threads a simple cooperative scheduler subsystem is being included in this example application. If the expected benefits and use cases prove to be of value, it is anticipated that this lightweight thread subsystem would become a library in some future DPDK release. Changes in this version * add doc image files missing from V5 Ian Betts (4): doc: add sample application guide for performance-thread add lthread subsystem for performance-thread add l3fwd-thread example in performance-thread add pthread_shim example to performance thread config/common_linuxapp |1 + config/defconfig_i686-native-linuxapp-gcc |1 + config/defconfig_i686-native-linuxapp-icc |1 + config/defconfig_x86_64-native-linuxapp-gcc|3 + config/defconfig_x86_64-native-linuxapp-icc|3 + .../sample_app_ug/img/performance_thread_1.svg | 799 + .../sample_app_ug/img/performance_thread_2.svg | 865 + doc/guides/sample_app_ug/index.rst |1 + doc/guides/sample_app_ug/performance_thread.rst| 1263 +++ examples/Makefile |2 + examples/performance-thread/Makefile | 46 + .../performance-thread/common/arch/x86/atomic.h| 59 + examples/performance-thread/common/arch/x86/ctx.c | 93 + examples/performance-thread/common/arch/x86/ctx.h | 57 + examples/performance-thread/common/common.mk | 40 + examples/performance-thread/common/lthread.c | 530 +++ examples/performance-thread/common/lthread.h | 99 + examples/performance-thread/common/lthread_api.h | 829 + examples/performance-thread/common/lthread_cond.c | 241 ++ examples/performance-thread/common/lthread_cond.h | 77 + examples/performance-thread/common/lthread_diag.c | 321 ++ examples/performance-thread/common/lthread_diag.h | 129 + .../performance-thread/common/lthread_diag_api.h | 319 ++ examples/performance-thread/common/lthread_int.h | 212 ++ examples/performance-thread/common/lthread_mutex.c | 256 ++ examples/performance-thread/common/lthread_mutex.h | 52 + .../performance-thread/common/lthread_objcache.h | 160 + examples/performance-thread/common/lthread_pool.h | 333 ++ examples/performance-thread/common/lthread_queue.h | 303 ++ examples/performance-thread/common/lthread_sched.c | 600 examples/performance-thread/common/lthread_sched.h | 152 + examples/performance-thread/common/lthread_timer.h | 47 + examples/performance-thread/common/lthread_tls.c | 254 ++ examples/performance-thread/common/lthread_tls.h | 57 + examples/performance-thread/l3fwd-thread/Makefile | 57 + examples/performance-thread/l3fwd-thread/main.c| 3641 examples/performance-thread/pthread_shim/Makefile | 60 + examples/performance-thread/pthread_shim/main.c| 284 ++ .../performance-thread/pthread_shim/pthread_shim.c | 714 .../performance-thread/pthread_shim/pthread_shim.h | 113 + 40 files changed, 13074 insertions(+) create mode 100644 doc/guides/sample_app_ug/img/performance_thread_1.svg create mode 100644 doc/guides/sample_app_ug/img/performance_thread_2.svg create mode 100644 doc/guides/sample_app_ug/performance_thread.rst create mode 100644 examples/performance-thread/Makefile create mode 100644 examples/performance-thread/common/arch/x86/atomic.h create mode 100644 examples/performance-thread/common/arch/x86/ctx.c create mode 100644 examples/performance-thread/common/arch/x86/ctx.h create mode 100644 examples/performance-thread/common/common.mk create mode 100644 examples/performance-thread/common/lthread.c create mode 100644 examples/performance-thread/common/l
[dpdk-dev] [PATCH v5 4/4] examples: add pthread_shim example to performance thread
From: Ian Betts This commit adds an example that illustrates how to implement a pthread shim with the lthread subsystem included in the performance thread example application. Signed-off-by: Ian Betts --- examples/performance-thread/Makefile | 2 +- examples/performance-thread/pthread_shim/Makefile | 60 ++ examples/performance-thread/pthread_shim/main.c| 284 .../performance-thread/pthread_shim/pthread_shim.c | 714 + .../performance-thread/pthread_shim/pthread_shim.h | 113 5 files changed, 1172 insertions(+), 1 deletion(-) create mode 100644 examples/performance-thread/pthread_shim/Makefile create mode 100644 examples/performance-thread/pthread_shim/main.c create mode 100644 examples/performance-thread/pthread_shim/pthread_shim.c create mode 100644 examples/performance-thread/pthread_shim/pthread_shim.h diff --git a/examples/performance-thread/Makefile b/examples/performance-thread/Makefile index 08eb107..92a16ec 100644 --- a/examples/performance-thread/Makefile +++ b/examples/performance-thread/Makefile @@ -39,7 +39,7 @@ RTE_TARGET ?= x86_64-native-linuxapp-gcc include $(RTE_SDK)/mk/rte.vars.mk DIRS-$(CONFIG_RTE_PERFORMANCE_THREAD) += l3fwd-thread - +DIRS-$(CONFIG_RTE_PERFORMANCE_THREAD) += pthread_shim diff --git a/examples/performance-thread/pthread_shim/Makefile b/examples/performance-thread/pthread_shim/Makefile new file mode 100644 index 000..9cf32e3 --- /dev/null +++ b/examples/performance-thread/pthread_shim/Makefile @@ -0,0 +1,60 @@ +# BSD LICENSE +# +# Copyright(c) 2015 Intel Corporation. All rights reserved. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +ifeq ($(RTE_SDK),) +$(error "Please define RTE_SDK environment variable") +endif + +# Default target, can be overridden by command line or environment +RTE_TARGET ?= x86_64-native-linuxapp-gcc + +include $(RTE_SDK)/mk/rte.vars.mk + +# binary name +APP = lthread_pthread_shim + +# all source are stored in SRCS-y +SRCS-y := main.c pthread_shim.c +INCLUDES := -I$(RTE_SDK)/$(RTE_TARGET)/include -I$(SRCDIR) +include $(RTE_SDK)/examples/performance-thread/common/common.mk + +CFLAGS=-g -O3 $(USER_FLAGS) $(INCLUDES) +CFLAGS += $(WERROR_FLAGS) + +LDFLAGS += -lpthread + +# workaround for a gcc bug with noreturn attribute +# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603 +ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y) +CFLAGS_main.o += -Wno-return-type +endif + +include $(RTE_SDK)/mk/rte.extapp.mk diff --git a/examples/performance-thread/pthread_shim/main.c b/examples/performance-thread/pthread_shim/main.c new file mode 100644 index 000..2f67c1b --- /dev/null +++ b/examples/performance-thread/pthread_shim/main.c @@ -0,0 +1,284 @@ + +/*- + * BSD LICENSE + * + * Copyright(c) 2015 Intel Corporation. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the
[dpdk-dev] [PATCH v5 3/4] examples: add l3fwd-thread example in performance-thread
From: Ian Betts This commit adds an L3 forwarding application to the performace-thread example. Signed-off-by: Ian Betts --- config/common_linuxapp|1 + config/defconfig_i686-native-linuxapp-gcc |1 + config/defconfig_i686-native-linuxapp-icc |1 + config/defconfig_x86_64-native-linuxapp-gcc |3 + config/defconfig_x86_64-native-linuxapp-icc |3 + examples/Makefile |2 + examples/performance-thread/Makefile | 46 + examples/performance-thread/l3fwd-thread/Makefile | 57 + examples/performance-thread/l3fwd-thread/main.c | 3641 + 9 files changed, 3755 insertions(+) create mode 100644 examples/performance-thread/Makefile create mode 100644 examples/performance-thread/l3fwd-thread/Makefile create mode 100644 examples/performance-thread/l3fwd-thread/main.c diff --git a/config/common_linuxapp b/config/common_linuxapp index 2866986..95da485 100644 --- a/config/common_linuxapp +++ b/config/common_linuxapp @@ -526,3 +526,3 @@ CONFIG_RTE_APP_TEST=y CONFIG_RTE_TEST_PMD=y CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES=n CONFIG_RTE_TEST_PMD_RECORD_BURST_STATS=n diff --git a/config/defconfig_i686-native-linuxapp-gcc b/config/defconfig_i686-native-linuxapp-gcc index a90de9b..c101942 100644 --- a/config/defconfig_i686-native-linuxapp-gcc +++ b/config/defconfig_i686-native-linuxapp-gcc @@ -49,3 +49,3 @@ CONFIG_RTE_LIBRTE_KNI=n # Vectorized PMD is not supported on 32-bit # CONFIG_RTE_IXGBE_INC_VECTOR=n diff --git a/config/defconfig_i686-native-linuxapp-icc b/config/defconfig_i686-native-linuxapp-icc index c021321..915bfa0 100644 --- a/config/defconfig_i686-native-linuxapp-icc +++ b/config/defconfig_i686-native-linuxapp-icc @@ -49,3 +49,3 @@ CONFIG_RTE_LIBRTE_KNI=n # Vectorized PMD is not supported on 32-bit # CONFIG_RTE_IXGBE_INC_VECTOR=n diff --git a/config/defconfig_x86_64-native-linuxapp-gcc b/config/defconfig_x86_64-native-linuxapp-gcc index 60baf5b..76d6b10 100644 --- a/config/defconfig_x86_64-native-linuxapp-gcc +++ b/config/defconfig_x86_64-native-linuxapp-gcc @@ -40,3 +40,5 @@ CONFIG_RTE_ARCH_64=y CONFIG_RTE_TOOLCHAIN="gcc" CONFIG_RTE_TOOLCHAIN_GCC=y + +CONFIG_RTE_PERFORMANCE_THREAD=y diff --git a/config/defconfig_x86_64-native-linuxapp-icc b/config/defconfig_x86_64-native-linuxapp-icc index 71d1e28..58a1e09 100644 --- a/config/defconfig_x86_64-native-linuxapp-icc +++ b/config/defconfig_x86_64-native-linuxapp-icc @@ -40,3 +40,5 @@ CONFIG_RTE_ARCH_64=y CONFIG_RTE_TOOLCHAIN="icc" CONFIG_RTE_TOOLCHAIN_ICC=y + +CONFIG_RTE_PERFORMANCE_THREAD=y diff --git a/examples/Makefile b/examples/Makefile index 5dd2c53..aeb10f3 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -77,5 +77,7 @@ DIRS-y += vmdq DIRS-y += vmdq_dcb DIRS-$(CONFIG_RTE_LIBRTE_POWER) += vm_power_manager DIRS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += l2fwd-crypto +DIRS-$(CONFIG_RTE_PERFORMANCE_THREAD) += performance-thread + include $(RTE_SDK)/mk/rte.extsubdir.mk diff --git a/examples/performance-thread/Makefile b/examples/performance-thread/Makefile new file mode 100644 index 000..08eb107 --- /dev/null +++ b/examples/performance-thread/Makefile @@ -0,0 +1,46 @@ +# BSD LICENSE +# +# Copyright(c) 2015 Intel Corporation. All rights reserved. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +ifeq ($(RTE_SDK),) +$(error "Please define RTE_SDK environment variable"
[dpdk-dev] [PATCH v5 2/4] examples: add lthread subsystem for performance-thread
From: Ian Betts This commit adds the lightweight thread subsystem used by the performance-thread sample applications. Signed-off-by: Ian Betts --- .../performance-thread/common/arch/x86/atomic.h| 59 ++ examples/performance-thread/common/arch/x86/ctx.c | 93 +++ examples/performance-thread/common/arch/x86/ctx.h | 57 ++ examples/performance-thread/common/common.mk | 40 + examples/performance-thread/common/lthread.c | 530 + examples/performance-thread/common/lthread.h | 99 +++ examples/performance-thread/common/lthread_api.h | 829 + examples/performance-thread/common/lthread_cond.c | 241 ++ examples/performance-thread/common/lthread_cond.h | 77 ++ examples/performance-thread/common/lthread_diag.c | 321 examples/performance-thread/common/lthread_diag.h | 129 .../performance-thread/common/lthread_diag_api.h | 319 examples/performance-thread/common/lthread_int.h | 212 ++ examples/performance-thread/common/lthread_mutex.c | 256 +++ examples/performance-thread/common/lthread_mutex.h | 52 ++ .../performance-thread/common/lthread_objcache.h | 160 examples/performance-thread/common/lthread_pool.h | 333 + examples/performance-thread/common/lthread_queue.h | 303 examples/performance-thread/common/lthread_sched.c | 600 +++ examples/performance-thread/common/lthread_sched.h | 152 examples/performance-thread/common/lthread_timer.h | 47 ++ examples/performance-thread/common/lthread_tls.c | 254 +++ examples/performance-thread/common/lthread_tls.h | 57 ++ 23 files changed, 5220 insertions(+) create mode 100644 examples/performance-thread/common/arch/x86/atomic.h create mode 100644 examples/performance-thread/common/arch/x86/ctx.c create mode 100644 examples/performance-thread/common/arch/x86/ctx.h create mode 100644 examples/performance-thread/common/common.mk create mode 100644 examples/performance-thread/common/lthread.c create mode 100644 examples/performance-thread/common/lthread.h create mode 100644 examples/performance-thread/common/lthread_api.h create mode 100644 examples/performance-thread/common/lthread_cond.c create mode 100644 examples/performance-thread/common/lthread_cond.h create mode 100644 examples/performance-thread/common/lthread_diag.c create mode 100644 examples/performance-thread/common/lthread_diag.h create mode 100644 examples/performance-thread/common/lthread_diag_api.h create mode 100644 examples/performance-thread/common/lthread_int.h create mode 100644 examples/performance-thread/common/lthread_mutex.c create mode 100644 examples/performance-thread/common/lthread_mutex.h create mode 100644 examples/performance-thread/common/lthread_objcache.h create mode 100644 examples/performance-thread/common/lthread_pool.h create mode 100644 examples/performance-thread/common/lthread_queue.h create mode 100644 examples/performance-thread/common/lthread_sched.c create mode 100644 examples/performance-thread/common/lthread_sched.h create mode 100644 examples/performance-thread/common/lthread_timer.h create mode 100644 examples/performance-thread/common/lthread_tls.c create mode 100644 examples/performance-thread/common/lthread_tls.h diff --git a/examples/performance-thread/common/arch/x86/atomic.h b/examples/performance-thread/common/arch/x86/atomic.h new file mode 100644 index 000..968dbe2 --- /dev/null +++ b/examples/performance-thread/common/arch/x86/atomic.h @@ -0,0 +1,59 @@ +/* + *- + * BSD LICENSE + * + * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR
[dpdk-dev] [PATCH v5 1/4] doc: add sample application guide for performance-thread
From: Ian Betts This commit adds the sample application user guide for the performance thread sample application. Signed-off-by: Ian Betts --- doc/guides/sample_app_ug/performance_thread.rst | 1263 +++ 1 file changed, 1263 insertions(+) create mode 100644 doc/guides/sample_app_ug/performance_thread.rst diff --git a/doc/guides/sample_app_ug/performance_thread.rst b/doc/guides/sample_app_ug/performance_thread.rst new file mode 100644 index 000..d71bb84 --- /dev/null +++ b/doc/guides/sample_app_ug/performance_thread.rst @@ -0,0 +1,1263 @@ +.. BSD LICENSE +Copyright(c) 2015 Intel Corporation. All rights reserved. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +* Re-distributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in +the documentation and/or other materials provided with the +distribution. +* Neither the name of Intel Corporation nor the names of its +contributors may be used to endorse or promote products derived +from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +Performance Thread Sample Application += + +The performance thread sample application is a derivative of the standard L3 +forwarding application that demonstrates different threading models. + +Overview + +For a general description of the L3 forwarding applications capabilities +please refer to the documentation of the standard application in +:doc:`l3_forward`. + +The performance thread sample application differs from the standard L3 +forwarding example in that it divides the TX and RX processing between +different threads, and makes it possible to assign individual threads to +different cores. + +Three threading models are considered: + +#. When there is one EAL thread per physical core. +#. When there are multiple EAL threads per physical core. +#. When there are multiple lightweight threads per EAL thread. + +Since DPDK release 2.0 it is possible to launch applications using the +``--lcores`` EAL parameter, specifying cpu-sets for a physical core. With the +performance thread sample application its is now also possible to assign +individual RX and TX functions to different cores. + +As an alternative to dividing the L3 forwarding work between different EAL +threads the performance thread sample introduces the possibility to run the +application threads as lightweight threads (L-threads) within one or +more EAL threads. + +In order to facilitate this threading model the example includes a primitive +cooperative scheduler (L-thread) subsystem. More details of the L-thread +subsystem can be found in :ref:`lthread_subsystem`. + +**Note:** Whilst theoretically possible it is not anticipated that multiple +L-thread schedulers would be run on the same physical core, this mode of +operation should not be expected to yield useful performance and is considered +invalid. + +Compiling the Application +- +The application is located in the sample application folder in the +``performance-thread`` folder. + +#. Go to the example applications folder + +.. code-block:: console + + export RTE_SDK=/path/to/rte_sdk + cd ${RTE_SDK}/examples/performance-thread/l3fwd-thread + +#. Set the target (a default target is used if not specified). For example: + +.. code-block:: console + + export RTE_TARGET=x86_64-native-linuxapp-gcc + +See the *DPDK Linux Getting Started Guide* for possible RTE_TARGET values. + +#. Build the application: + +make + + +Running the Application +--- + +The application has a number of command line options:: + +./build/l3fwd-thread [EAL options] -- +-p PORTMASK [-P] +--rx(port,queue,lcore,thread)[,(port,queue,lcore,thread)] +--tx(lcore,thread)[,(lcore,thread)] +
[dpdk-dev] [PATCH v5 0/4] examples: add performance-thread
From: Ian Betts This patchset comprises a layer 3 forwarding derivative intended to facilitate characterization of performance with different threading models, specifically:- 1. EAL threads running on different physical cores 2. EAL threads running on the same physical core 3. Lightweight threads running in an EAL thread Purpose and justification Since dpdk 2.0 it has been possible to assign multiple EAL threads to a physical core ( case 2 above ). Currently no example application has focused on demonstrating the performance constraints of differing threading models. Whilst purpose built applications that fully comprehend the DPDK single threaded programming model will always yield superior performance, the desire to preserve ROI in legacy code written for multithreaded operating environments makes lightweight threads (case 3 above) worthy of consideration. As well as aiding with legacy code reuse, it is anticipated that lightweight threads will make it possible to scale a multithreaded application with fine granularity allowing an application to more easily take advantage of headroom on EAL cores, or conversely occupy more cores, as dictated by system load. To explore performance with lightweight threads a simple cooperative scheduler subsystem is being included in this example application. If the expected benefits and use cases prove to be of value, it is anticipated that this lightweight thread subsystem would become a library in some future DPDK release. Changes in this version * None Idenitical with the V4 patchset, which comprised 2 patches. V5 is divided into more 5 patches. Ian Betts (4): doc: add sample application guide for performance-thread examples: add lthread subsystem for performance-thread examples: add l3fwd-thread example in performance-thread examples: add pthread_shim example to performance thread config/common_linuxapp |1 + config/defconfig_i686-native-linuxapp-gcc |1 + config/defconfig_i686-native-linuxapp-icc |1 + config/defconfig_x86_64-native-linuxapp-gcc|3 + config/defconfig_x86_64-native-linuxapp-icc|3 + doc/guides/sample_app_ug/performance_thread.rst| 1263 +++ examples/Makefile |2 + examples/performance-thread/Makefile | 46 + .../performance-thread/common/arch/x86/atomic.h| 59 + examples/performance-thread/common/arch/x86/ctx.c | 93 + examples/performance-thread/common/arch/x86/ctx.h | 57 + examples/performance-thread/common/common.mk | 40 + examples/performance-thread/common/lthread.c | 530 +++ examples/performance-thread/common/lthread.h | 99 + examples/performance-thread/common/lthread_api.h | 829 + examples/performance-thread/common/lthread_cond.c | 241 ++ examples/performance-thread/common/lthread_cond.h | 77 + examples/performance-thread/common/lthread_diag.c | 321 ++ examples/performance-thread/common/lthread_diag.h | 129 + .../performance-thread/common/lthread_diag_api.h | 319 ++ examples/performance-thread/common/lthread_int.h | 212 ++ examples/performance-thread/common/lthread_mutex.c | 256 ++ examples/performance-thread/common/lthread_mutex.h | 52 + .../performance-thread/common/lthread_objcache.h | 160 + examples/performance-thread/common/lthread_pool.h | 333 ++ examples/performance-thread/common/lthread_queue.h | 303 ++ examples/performance-thread/common/lthread_sched.c | 600 examples/performance-thread/common/lthread_sched.h | 152 + examples/performance-thread/common/lthread_timer.h | 47 + examples/performance-thread/common/lthread_tls.c | 254 ++ examples/performance-thread/common/lthread_tls.h | 57 + examples/performance-thread/l3fwd-thread/Makefile | 57 + examples/performance-thread/l3fwd-thread/main.c| 3641 examples/performance-thread/pthread_shim/Makefile | 60 + examples/performance-thread/pthread_shim/main.c| 284 ++ .../performance-thread/pthread_shim/pthread_shim.c | 714 .../performance-thread/pthread_shim/pthread_shim.h | 113 + 37 files changed, 11409 insertions(+) create mode 100644 doc/guides/sample_app_ug/performance_thread.rst create mode 100644 examples/performance-thread/Makefile create mode 100644 examples/performance-thread/common/arch/x86/atomic.h create mode 100644 examples/performance-thread/common/arch/x86/ctx.c create mode 100644 examples/performance-thread/common/arch/x86/ctx.h create mode 100644 examples/performance-thread/common/common.mk create mode 100644 examples/performance-thread/common/lthread.c create mode 100644 examples/performance-thread/common/lthread.h create mode 100644 examples/performance-thread/common/lthread_api.h create mode 100644 examples/performance-thread/common/lthread_cond.c create mode 100644 examples/performance-thread/common/lthread_cond.h create mode 100644 examples/perfor
[dpdk-dev] [PATCH v4 2/2] examples: add pthread-shim in performance-thread sample app
From: Ian Betts This commit adds a simple pthread_shim example for the cooperative scheduler included with this patchset. The shim demonstrates a way in which legacy code writtem for pthreads could be adapted to lighweight threads. Signed-off-by: Ian Betts --- doc/guides/sample_app_ug/performance_thread.rst| 114 examples/performance-thread/Makefile | 2 + examples/performance-thread/pthread_shim/Makefile | 60 ++ examples/performance-thread/pthread_shim/main.c| 284 .../performance-thread/pthread_shim/pthread_shim.c | 714 + .../performance-thread/pthread_shim/pthread_shim.h | 113 6 files changed, 1287 insertions(+) create mode 100644 examples/performance-thread/pthread_shim/Makefile create mode 100644 examples/performance-thread/pthread_shim/main.c create mode 100644 examples/performance-thread/pthread_shim/pthread_shim.c create mode 100644 examples/performance-thread/pthread_shim/pthread_shim.h diff --git a/doc/guides/sample_app_ug/performance_thread.rst b/doc/guides/sample_app_ug/performance_thread.rst index 6ea83cc..d71bb84 100644 --- a/doc/guides/sample_app_ug/performance_thread.rst +++ b/doc/guides/sample_app_ug/performance_thread.rst @@ -1102,6 +1102,120 @@ it the local data it needs, and pick up the new logical core specific values from pthread local storage at its new home. +.. _pthread_shim: + +Pthread shim + + +A convenient way to get something working with legacy code can be to use a +shim that adapts pthread API calls to the corresponding L-thread ones. +This approach will not mitigate any of the porting considerations mentioned +in the previous sections, but it will reduce the amount of code churn that +would otherwise been involved. It is a reasonable approach to evaluate +L-threads, before investing effort in porting to the native L-thread APIs. + + +Overview + +The L-thread subsystem includes an example pthread shim. This is a partial +implementation but does contain the API stubs needed to get basic applications +running. There is a simple "hello world" application that demonstrates the +use of the pthread shim. + +A subtlety of working with a shim is that the application will still need +to make use of the genuine pthread library functions, at the very least in +order to create the EAL threads in which the L-thread schedulers will run. +This is the case with DPDK initialization, and exit. + +To deal with the initialization and shutdown scenarios, the shim is capable of +switching on or off its adaptor functionality, an application can control this +behavior by the calling the function ``pt_override_set()``. The default state +is disabled. + +The pthread shim uses the dynamic linker loader and saves the loaded addresses +of the genuine pthread API functions in an internal table, when the shim +functionality is enabled it performs the adaptor function, when disabled it +invokes the genuine pthread function. + +The function ``pthread_exit()`` has additional special handling. The standard +system header file pthread.h declares ``pthread_exit()`` with +``__attribute__((noreturn))`` this is an optimization that is possible because +the pthread is terminating and this enables the compiler to omit the normal +handling of stack and protection of registers since the function is not +expected to return, and in fact the thread is being destroyed. These +optimizations are applied in both the callee and the caller of the +``pthread_exit()`` function. + +In our cooperative scheduling environment this behavior is inadmissible. The +pthread is the L-thread scheduler thread, and, although an L-thread is +terminating, there must be a return to the scheduler in order that the system +can continue to run. Further, returning from a function with attribute +``noreturn`` is invalid and may result in undefined behavior. + +The solution is to redefine the ``pthread_exit`` function with a macro, +causing it to be mapped to a stub function in the shim that does not have the +``noreturn`` attribute. This macro is defined in the file +``pthread_shim.h``. The stub function is otherwise no different than any of +the other stub functions in the shim, and will switch between the real +``pthread_exit()`` function or the ``lthread_exit()`` function as +required. The only difference is that the mapping to the stub by macro +substitution. + +A consequence of this is that the file ``pthread_shim.h`` must be included in +legacy code wishing to make use of the shim. It also means that dynamic +linkage of a pre-compiled binary that did not include pthread_shim.h is not be +supported. + +Given the requirements for porting legacy code outlined in +:ref:`porting_legacy_code_to_run_on_lthreads` most applications will require at +least some minimal adjustment and recompilation to run on L-threads so +pre-compiled binaries are unlikely to be met in practice. + +In summary the shim approach adds some overhead but can be a useful tool
[dpdk-dev] [PATCH v4 1/2] examples: add performance thread sample application
From: Ian Betts This example comprises a layer 3 forwarding derivative intended to facilitate characterization of performance with different threading models, specifically:- 1. EAL threads running on different physical cores 2. EAL threads running on the same physical core 3. Lightweight threads running in an EAL thread Purpose and justification Since dpdk 2.0 it has been possible to assign multiple EAL threads to a physical core ( case 2 above ). Currently no example application has focused on demonstrating the performance constraints of differing threading models. Whilst purpose built applications that fully comprehend the DPDK single threaded programming model will always yield superior performance, the desire to preserve ROI in legacy code written for multithreaded operating environments makes lightweight threads (case 3 above) worthy of consideration. As well as aiding with legacy code reuse, it is anticipated that lightweight threads will make it possible to scale a multithreaded application with fine granularity allowing an application to more easily take advantage of headroom on EAL cores, or conversely occupy more cores, as dictated by system load. To explore performance with lightweight threads a simple cooperative scheduler subsystem is being included in this example application. If the expected benefits and use cases prove to be of value, it is anticipated that this lightweight thread subsystem would become a library in some future DPDK release. Changes in this version:- * Copyright updated for 2015 * fix TLS destructor handling Signed-off-by: Ian Betts --- config/common_linuxapp |1 + config/defconfig_i686-native-linuxapp-gcc |1 + config/defconfig_i686-native-linuxapp-icc |1 + config/defconfig_x86_64-native-linuxapp-gcc|3 + config/defconfig_x86_64-native-linuxapp-icc|3 + doc/guides/sample_app_ug/performance_thread.rst| 1149 ++ examples/Makefile |2 + examples/performance-thread/Makefile | 45 + .../performance-thread/common/arch/x86/atomic.h| 59 + examples/performance-thread/common/arch/x86/ctx.c | 93 + examples/performance-thread/common/arch/x86/ctx.h | 57 + examples/performance-thread/common/common.mk | 40 + examples/performance-thread/common/lthread.c | 530 +++ examples/performance-thread/common/lthread.h | 99 + examples/performance-thread/common/lthread_api.h | 829 + examples/performance-thread/common/lthread_cond.c | 241 ++ examples/performance-thread/common/lthread_cond.h | 77 + examples/performance-thread/common/lthread_diag.c | 321 ++ examples/performance-thread/common/lthread_diag.h | 129 + .../performance-thread/common/lthread_diag_api.h | 319 ++ examples/performance-thread/common/lthread_int.h | 212 ++ examples/performance-thread/common/lthread_mutex.c | 256 ++ examples/performance-thread/common/lthread_mutex.h | 52 + .../performance-thread/common/lthread_objcache.h | 160 + examples/performance-thread/common/lthread_pool.h | 333 ++ examples/performance-thread/common/lthread_queue.h | 303 ++ examples/performance-thread/common/lthread_sched.c | 600 examples/performance-thread/common/lthread_sched.h | 152 + examples/performance-thread/common/lthread_timer.h | 47 + examples/performance-thread/common/lthread_tls.c | 254 ++ examples/performance-thread/common/lthread_tls.h | 57 + examples/performance-thread/l3fwd-thread/Makefile | 57 + examples/performance-thread/l3fwd-thread/main.c| 3641 33 files changed, 10123 insertions(+) create mode 100644 doc/guides/sample_app_ug/performance_thread.rst create mode 100644 examples/performance-thread/Makefile create mode 100644 examples/performance-thread/common/arch/x86/atomic.h create mode 100644 examples/performance-thread/common/arch/x86/ctx.c create mode 100644 examples/performance-thread/common/arch/x86/ctx.h create mode 100644 examples/performance-thread/common/common.mk create mode 100644 examples/performance-thread/common/lthread.c create mode 100644 examples/performance-thread/common/lthread.h create mode 100644 examples/performance-thread/common/lthread_api.h create mode 100644 examples/performance-thread/common/lthread_cond.c create mode 100644 examples/performance-thread/common/lthread_cond.h create mode 100644 examples/performance-thread/common/lthread_diag.c create mode 100644 examples/performance-thread/common/lthread_diag.h create mode 100644 examples/performance-thread/common/lthread_diag_api.h create mode 100644 examples/performance-thread/common/lthread_int.h create mode 100644 examples/performance-thread/common/lthread_mutex.c create mode 100644 examples/performance-thread/common/lthread_mutex.h create mode 100644 examples/performance-thread/common/lthread_objcache.h create mode 100644 examples/performance-thread/comm
[dpdk-dev] [PATCH v4 2/2] examples: add pthread-shim in performance-thread sample app
From: Ian Betts This commit adds a simple pthread_shim example for the cooperative scheduler included with this patchset. The shim demonstrates a way in which legacy code writtem for pthreads could be adapted to lighweight threads. Signed-off-by: Ian Betts --- doc/guides/sample_app_ug/performance_thread.rst| 114 examples/performance-thread/Makefile | 2 + examples/performance-thread/pthread_shim/Makefile | 60 ++ examples/performance-thread/pthread_shim/main.c| 284 .../performance-thread/pthread_shim/pthread_shim.c | 714 + .../performance-thread/pthread_shim/pthread_shim.h | 113 6 files changed, 1287 insertions(+) create mode 100644 examples/performance-thread/pthread_shim/Makefile create mode 100644 examples/performance-thread/pthread_shim/main.c create mode 100644 examples/performance-thread/pthread_shim/pthread_shim.c create mode 100644 examples/performance-thread/pthread_shim/pthread_shim.h diff --git a/doc/guides/sample_app_ug/performance_thread.rst b/doc/guides/sample_app_ug/performance_thread.rst index 6ea83cc..d71bb84 100644 --- a/doc/guides/sample_app_ug/performance_thread.rst +++ b/doc/guides/sample_app_ug/performance_thread.rst @@ -1102,6 +1102,120 @@ it the local data it needs, and pick up the new logical core specific values from pthread local storage at its new home. +.. _pthread_shim: + +Pthread shim + + +A convenient way to get something working with legacy code can be to use a +shim that adapts pthread API calls to the corresponding L-thread ones. +This approach will not mitigate any of the porting considerations mentioned +in the previous sections, but it will reduce the amount of code churn that +would otherwise been involved. It is a reasonable approach to evaluate +L-threads, before investing effort in porting to the native L-thread APIs. + + +Overview + +The L-thread subsystem includes an example pthread shim. This is a partial +implementation but does contain the API stubs needed to get basic applications +running. There is a simple "hello world" application that demonstrates the +use of the pthread shim. + +A subtlety of working with a shim is that the application will still need +to make use of the genuine pthread library functions, at the very least in +order to create the EAL threads in which the L-thread schedulers will run. +This is the case with DPDK initialization, and exit. + +To deal with the initialization and shutdown scenarios, the shim is capable of +switching on or off its adaptor functionality, an application can control this +behavior by the calling the function ``pt_override_set()``. The default state +is disabled. + +The pthread shim uses the dynamic linker loader and saves the loaded addresses +of the genuine pthread API functions in an internal table, when the shim +functionality is enabled it performs the adaptor function, when disabled it +invokes the genuine pthread function. + +The function ``pthread_exit()`` has additional special handling. The standard +system header file pthread.h declares ``pthread_exit()`` with +``__attribute__((noreturn))`` this is an optimization that is possible because +the pthread is terminating and this enables the compiler to omit the normal +handling of stack and protection of registers since the function is not +expected to return, and in fact the thread is being destroyed. These +optimizations are applied in both the callee and the caller of the +``pthread_exit()`` function. + +In our cooperative scheduling environment this behavior is inadmissible. The +pthread is the L-thread scheduler thread, and, although an L-thread is +terminating, there must be a return to the scheduler in order that the system +can continue to run. Further, returning from a function with attribute +``noreturn`` is invalid and may result in undefined behavior. + +The solution is to redefine the ``pthread_exit`` function with a macro, +causing it to be mapped to a stub function in the shim that does not have the +``noreturn`` attribute. This macro is defined in the file +``pthread_shim.h``. The stub function is otherwise no different than any of +the other stub functions in the shim, and will switch between the real +``pthread_exit()`` function or the ``lthread_exit()`` function as +required. The only difference is that the mapping to the stub by macro +substitution. + +A consequence of this is that the file ``pthread_shim.h`` must be included in +legacy code wishing to make use of the shim. It also means that dynamic +linkage of a pre-compiled binary that did not include pthread_shim.h is not be +supported. + +Given the requirements for porting legacy code outlined in +:ref:`porting_legacy_code_to_run_on_lthreads` most applications will require at +least some minimal adjustment and recompilation to run on L-threads so +pre-compiled binaries are unlikely to be met in practice. + +In summary the shim approach adds some overhead but can be a useful tool
[dpdk-dev] [PATCH v3 2/2] examples: add pthread-shim in performance-thread sample app
From: Ian Betts This commit adds a simple pthread_shim example for the cooperative scheduler included with this patchset. The shim demonstrates a way in which legacy code writtem for pthreads could be adapted to lighweight threads. Signed-off-by: Ian Betts --- doc/guides/sample_app_ug/performance_thread.rst| 113 examples/performance-thread/Makefile | 1 + examples/performance-thread/pthread_shim/Makefile | 60 ++ examples/performance-thread/pthread_shim/main.c| 284 .../performance-thread/pthread_shim/pthread_shim.c | 714 + .../performance-thread/pthread_shim/pthread_shim.h | 113 6 files changed, 1285 insertions(+) create mode 100644 examples/performance-thread/pthread_shim/Makefile create mode 100644 examples/performance-thread/pthread_shim/main.c create mode 100644 examples/performance-thread/pthread_shim/pthread_shim.c create mode 100644 examples/performance-thread/pthread_shim/pthread_shim.h diff --git a/doc/guides/sample_app_ug/performance_thread.rst b/doc/guides/sample_app_ug/performance_thread.rst index cc46fb9..d71bb84 100644 --- a/doc/guides/sample_app_ug/performance_thread.rst +++ b/doc/guides/sample_app_ug/performance_thread.rst @@ -1102,6 +1102,119 @@ it the local data it needs, and pick up the new logical core specific values from pthread local storage at its new home. +.. _pthread_shim: + +Pthread shim + + +A convenient way to get something working with legacy code can be to use a +shim that adapts pthread API calls to the corresponding L-thread ones. +This approach will not mitigate any of the porting considerations mentioned +in the previous sections, but it will reduce the amount of code churn that +would otherwise been involved. It is a reasonable approach to evaluate +L-threads, before investing effort in porting to the native L-thread APIs. + + +Overview + +The L-thread subsystem includes an example pthread shim. This is a partial +implementation but does contain the API stubs needed to get basic applications +running. There is a simple "hello world" application that demonstrates the +use of the pthread shim. + +A subtlety of working with a shim is that the application will still need +to make use of the genuine pthread library functions, at the very least in +order to create the EAL threads in which the L-thread schedulers will run. +This is the case with DPDK initialization, and exit. + +To deal with the initialization and shutdown scenarios, the shim is capable of +switching on or off its adaptor functionality, an application can control this +behavior by the calling the function ``pt_override_set()``. The default state +is disabled. + +The pthread shim uses the dynamic linker loader and saves the loaded addresses +of the genuine pthread API functions in an internal table, when the shim +functionality is enabled it performs the adaptor function, when disabled it +invokes the genuine pthread function. + +The function ``pthread_exit()`` has additional special handling. The standard +system header file pthread.h declares ``pthread_exit()`` with +``__attribute__((noreturn))`` this is an optimization that is possible because +the pthread is terminating and this enables the compiler to omit the normal +handling of stack and protection of registers since the function is not +expected to return, and in fact the thread is being destroyed. These +optimizations are applied in both the callee and the caller of the +``pthread_exit()`` function. + +In our cooperative scheduling environment this behavior is inadmissible. The +pthread is the L-thread scheduler thread, and, although an L-thread is +terminating, there must be a return to the scheduler in order that the system +can continue to run. Further, returning from a function with attribute +``noreturn`` is invalid and may result in undefined behavior. + +The solution is to redefine the ``pthread_exit`` function with a macro, +causing it to be mapped to a stub function in the shim that does not have the +``noreturn`` attribute. This macro is defined in the file +``pthread_shim.h``. The stub function is otherwise no different than any of +the other stub functions in the shim, and will switch between the real +``pthread_exit()`` function or the ``lthread_exit()`` function as +required. The only difference is that the mapping to the stub by macro +substitution. + +A consequence of this is that the file ``pthread_shim.h`` must be included in +legacy code wishing to make use of the shim. It also means that dynamic +linkage of a pre-compiled binary that did not include pthread_shim.h is not be +supported. + +Given the requirements for porting legacy code outlined in +:ref:`porting_legacy_code_to_run_on_lthreads` most applications will require at +least some minimal adjustment and recompilation to run on L-threads so +pre-compiled binaries are unlikely to be met in practice. + +In summary the shim approach adds some overhead but can be a useful tool
[dpdk-dev] [PATCH v3 1/2] examples: add performance thread sample application
From: Ian Betts This example comprises a layer 3 forwarding derivative intended to facilitate characterization of performance with different threading models, specifically:- 1. EAL threads running on different physical cores 2. EAL threads running on the same physical core 3. Lightweight threads running in an EAL thread Purpose and justification Since dpdk 2.0 it has been possible to assign multiple EAL threads to a physical core ( case 2 above ). Currently no example application has focused on demonstrating the performance constraints of differing threading models. Whilst purpose built applications that fully comprehend the DPDK single threaded programming model will always yield superior performance, the desire to preserve ROI in legacy code written for multithreaded operating environments makes lightweight threads (case 3 above) worthy of consideration. As well as aiding with legacy code reuse, it is anticipated that lightweight threads will make it possible to scale a multithreaded application with fine granularity allowing an application to more easily take advantage of headroom on EAL cores, or conversely occupy more cores, as dictated by system load. To explore performance with lightweight threads a simple cooperative scheduler subsystem is being included in this example application. If the expected benefits and use cases prove to be of value, it is anticipated that this lightweight thread subsystem would become a library in some future DPDK release. Signed-off-by: Ian Betts --- config/common_linuxapp |5 + config/defconfig_i686-native-linuxapp-gcc |5 + config/defconfig_i686-native-linuxapp-icc |5 + config/defconfig_x86_x32-native-linuxapp-gcc |5 + doc/guides/rel_notes/release_2_2.rst | 11 + .../sample_app_ug/img/performance_thread_1.svg | 799 + .../sample_app_ug/img/performance_thread_2.svg | 803 + doc/guides/sample_app_ug/index.rst |1 + doc/guides/sample_app_ug/performance_thread.rst| 1150 +++ examples/Makefile |1 + examples/performance-thread/Makefile | 44 + .../performance-thread/common/arch/x86/atomic.h| 59 + examples/performance-thread/common/arch/x86/ctx.c | 93 + examples/performance-thread/common/arch/x86/ctx.h | 57 + examples/performance-thread/common/common.mk | 40 + examples/performance-thread/common/lthread.c | 546 +++ examples/performance-thread/common/lthread.h | 99 + examples/performance-thread/common/lthread_api.h | 822 + examples/performance-thread/common/lthread_cond.c | 240 ++ examples/performance-thread/common/lthread_cond.h | 77 + examples/performance-thread/common/lthread_diag.c | 321 ++ examples/performance-thread/common/lthread_diag.h | 129 + .../performance-thread/common/lthread_diag_api.h | 319 ++ examples/performance-thread/common/lthread_int.h | 212 ++ examples/performance-thread/common/lthread_mutex.c | 255 ++ examples/performance-thread/common/lthread_mutex.h | 52 + .../performance-thread/common/lthread_objcache.h | 160 + examples/performance-thread/common/lthread_pool.h | 333 ++ examples/performance-thread/common/lthread_queue.h | 303 ++ examples/performance-thread/common/lthread_sched.c | 598 examples/performance-thread/common/lthread_sched.h | 152 + examples/performance-thread/common/lthread_timer.h | 47 + examples/performance-thread/common/lthread_tls.c | 242 ++ examples/performance-thread/common/lthread_tls.h | 64 + examples/performance-thread/l3fwd-thread/Makefile | 57 + examples/performance-thread/l3fwd-thread/main.c| 3628 36 files changed, 11734 insertions(+) create mode 100644 doc/guides/sample_app_ug/img/performance_thread_1.svg create mode 100644 doc/guides/sample_app_ug/img/performance_thread_2.svg create mode 100644 doc/guides/sample_app_ug/performance_thread.rst create mode 100644 examples/performance-thread/Makefile create mode 100644 examples/performance-thread/common/arch/x86/atomic.h create mode 100644 examples/performance-thread/common/arch/x86/ctx.c create mode 100644 examples/performance-thread/common/arch/x86/ctx.h create mode 100644 examples/performance-thread/common/common.mk create mode 100644 examples/performance-thread/common/lthread.c create mode 100644 examples/performance-thread/common/lthread.h create mode 100644 examples/performance-thread/common/lthread_api.h create mode 100644 examples/performance-thread/common/lthread_cond.c create mode 100644 examples/performance-thread/common/lthread_cond.h create mode 100644 examples/performance-thread/common/lthread_diag.c create mode 100644 examples/performance-thread/common/lthread_diag.h create mode 100644 examples/performance-thread/common/lthread_diag_api.h create mode 100644 examples/performance-thread/common/lthread_int.h create mode 10064
[dpdk-dev] [PATCH v2 5/5] config: add build files for performance-thread
From: Ian Betts This commit adds the build controls for the performance-thread sample Signed-off-by: Ian Betts --- config/common_linuxapp |5 +++ config/defconfig_i686-native-linuxapp-gcc|5 +++ config/defconfig_i686-native-linuxapp-icc|5 +++ config/defconfig_x86_x32-native-linuxapp-gcc |5 +++ examples/Makefile|1 + examples/performance-thread/Makefile | 45 ++ 6 files changed, 66 insertions(+) create mode 100644 examples/performance-thread/Makefile diff --git a/config/common_linuxapp b/config/common_linuxapp index 0de43d5..02a9f0b 100644 --- a/config/common_linuxapp +++ b/config/common_linuxapp @@ -466,3 +466,8 @@ CONFIG_RTE_APP_TEST=y CONFIG_RTE_TEST_PMD=y CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES=n CONFIG_RTE_TEST_PMD_RECORD_BURST_STATS=n + +# +# Compile the performance thread sample application +# +CONFIG_RTE_PERFORMANCE_THREAD=y diff --git a/config/defconfig_i686-native-linuxapp-gcc b/config/defconfig_i686-native-linuxapp-gcc index a90de9b..06c9ad0 100644 --- a/config/defconfig_i686-native-linuxapp-gcc +++ b/config/defconfig_i686-native-linuxapp-gcc @@ -49,3 +49,8 @@ CONFIG_RTE_LIBRTE_KNI=n # Vectorized PMD is not supported on 32-bit # CONFIG_RTE_IXGBE_INC_VECTOR=n + +# +# Performance thread sample application is not supported on 32-bit +# +CONFIG_RTE_PERFORMANCE_THREAD=n diff --git a/config/defconfig_i686-native-linuxapp-icc b/config/defconfig_i686-native-linuxapp-icc index c021321..e4610d4 100644 --- a/config/defconfig_i686-native-linuxapp-icc +++ b/config/defconfig_i686-native-linuxapp-icc @@ -49,3 +49,8 @@ CONFIG_RTE_LIBRTE_KNI=n # Vectorized PMD is not supported on 32-bit # CONFIG_RTE_IXGBE_INC_VECTOR=n + +# +# Performance thread sample application is not supported on 32-bit +# +CONFIG_RTE_PERFORMANCE_THREAD=n diff --git a/config/defconfig_x86_x32-native-linuxapp-gcc b/config/defconfig_x86_x32-native-linuxapp-gcc index fb0afc4..5680328 100644 --- a/config/defconfig_x86_x32-native-linuxapp-gcc +++ b/config/defconfig_x86_x32-native-linuxapp-gcc @@ -44,3 +44,8 @@ CONFIG_RTE_TOOLCHAIN_GCC=y # KNI is not supported on 32-bit # CONFIG_RTE_LIBRTE_KNI=n + +# +# Performance thread sample application is not supported on 32-bit +# +CONFIG_RTE_PERFORMANCE_THREAD=n diff --git a/examples/Makefile b/examples/Makefile index b4eddbd..9dffac4 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -74,5 +74,6 @@ DIRS-$(CONFIG_RTE_LIBRTE_XEN_DOM0) += vhost_xen DIRS-y += vmdq DIRS-y += vmdq_dcb DIRS-$(CONFIG_RTE_LIBRTE_POWER) += vm_power_manager +DIRS-$(CONFIG_RTE_PERFORMANCE_THREAD) += performance-thread include $(RTE_SDK)/mk/rte.extsubdir.mk diff --git a/examples/performance-thread/Makefile b/examples/performance-thread/Makefile new file mode 100644 index 000..2045f14 --- /dev/null +++ b/examples/performance-thread/Makefile @@ -0,0 +1,45 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +ifeq ($(RTE_SDK),) +$(error "Please define RTE_SDK environment variable") +endif + +# Default target, can be overridden by command line or environment +RTE_TARGET ?= x86_64-native-linuxapp-gcc + +include $(RTE_SDK)/mk/rte.vars.mk + +DIRS-$(CONFIG_RTE_PERFORMANCE_THREAD) += l3fwd-thread +DIRS-$(CONFIG_RTE_PERFORMANCE_THREAD) += pthread_shim + + +include $(RTE_SDK)/mk/rte.extsubdir.m
[dpdk-dev] [PATCH v2 4/5] examples: add pthread-shim in performance-thread sample app
From: Ian Betts This commit adds a simple pthread_shim example for the cooperative included with this patchset. The shim demonstrates a way in which legacy code writtem for pthreads could be adapted to lighweight threads. Signed-off-by: Ian Betts --- examples/performance-thread/pthread_shim/Makefile | 60 ++ examples/performance-thread/pthread_shim/main.c| 284 .../performance-thread/pthread_shim/pthread_shim.c | 714 .../performance-thread/pthread_shim/pthread_shim.h | 113 4 files changed, 1171 insertions(+) create mode 100644 examples/performance-thread/pthread_shim/Makefile create mode 100644 examples/performance-thread/pthread_shim/main.c create mode 100644 examples/performance-thread/pthread_shim/pthread_shim.c create mode 100644 examples/performance-thread/pthread_shim/pthread_shim.h diff --git a/examples/performance-thread/pthread_shim/Makefile b/examples/performance-thread/pthread_shim/Makefile new file mode 100644 index 000..73fd8ec --- /dev/null +++ b/examples/performance-thread/pthread_shim/Makefile @@ -0,0 +1,60 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +ifeq ($(RTE_SDK),) +$(error "Please define RTE_SDK environment variable") +endif + +# Default target, can be overridden by command line or environment +RTE_TARGET ?= x86_64-native-linuxapp-gcc + +include $(RTE_SDK)/mk/rte.vars.mk + +# binary name +APP = lthread_pthread_shim + +# all source are stored in SRCS-y +SRCS-y := main.c pthread_shim.c +INCLUDES := -I$(RTE_SDK)/$(RTE_TARGET)/include -I$(SRCDIR) +include $(RTE_SDK)/examples/performance-thread/common/common.mk + +CFLAGS=-g -O3 $(USER_FLAGS) $(INCLUDES) +CFLAGS += $(WERROR_FLAGS) + +LDFLAGS += -lpthread + +# workaround for a gcc bug with noreturn attribute +# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603 +ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y) +CFLAGS_main.o += -Wno-return-type +endif + +include $(RTE_SDK)/mk/rte.extapp.mk diff --git a/examples/performance-thread/pthread_shim/main.c b/examples/performance-thread/pthread_shim/main.c new file mode 100644 index 000..fafcb0c --- /dev/null +++ b/examples/performance-thread/pthread_shim/main.c @@ -0,0 +1,284 @@ + +/*- + * BSD LICENSE + * + * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN
[dpdk-dev] [PATCH v2 3/5] examples: add l3fwd-thread in performance-thread sample app
From: Ian Betts This commit adds an l3fwd derivative that allows multiple EAL threads to be run on a single physical core or multiple lightwieght threads to be run in an EAL thread. Its purpose is to facilitate characterization of performance with different threading models. It depends on a simple cooperative scheduler included in this patchset. Changes in this version:- * Fix flaw causing incorrect routing * Changes to tx parameter * add CPU load stats Signed-off-by: Ian Betts --- examples/performance-thread/l3fwd-thread/Makefile | 57 + examples/performance-thread/l3fwd-thread/main.c | 3628 + 2 files changed, 3685 insertions(+) create mode 100644 examples/performance-thread/l3fwd-thread/Makefile create mode 100644 examples/performance-thread/l3fwd-thread/main.c diff --git a/examples/performance-thread/l3fwd-thread/Makefile b/examples/performance-thread/l3fwd-thread/Makefile new file mode 100644 index 000..d8fe5e6 --- /dev/null +++ b/examples/performance-thread/l3fwd-thread/Makefile @@ -0,0 +1,57 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2015 Intel Corporation. All rights reserved. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +ifeq ($(RTE_SDK),) +$(error "Please define RTE_SDK environment variable") +endif + +# Default target, can be overridden by command line or environment +RTE_TARGET ?= x86_64-native-linuxapp-gcc + +include $(RTE_SDK)/mk/rte.vars.mk + +# binary name +APP = l3fwd-thread + +# all source are stored in SRCS-y +SRCS-y := main.c + +include $(RTE_SDK)/examples/performance-thread/common/common.mk + +CFLAGS += -O3 -g $(USER_FLAGS) $(INCLUDES) $(WERROR_FLAGS) + +# workaround for a gcc bug with noreturn attribute +# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603 +#ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y) +CFLAGS_main.o += -Wno-return-type +#endif + +include $(RTE_SDK)/mk/rte.extapp.mk diff --git a/examples/performance-thread/l3fwd-thread/main.c b/examples/performance-thread/l3fwd-thread/main.c new file mode 100644 index 000..36eb4f2 --- /dev/null +++ b/examples/performance-thread/l3fwd-thread/main.c @@ -0,0 +1,3628 @@ +/*- + * BSD LICENSE + * + * Copyright(c) 2010-2015 Intel Corporation. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDIN
[dpdk-dev] [PATCH v2 2/5] examples: add cooperative scheduler subsytem for performance-thread app
From: Ian Betts This commit adds a cooperative scheduler subsystem in the performance-thread sample application. It is used in the performance-thread sample application by the l3fwd-thread application to enable multiple lightweight threads to be run in an EAL thread. Changes in this version: * minor bug fixes in lthread subsystem * improved comments * add missing copyright in ctx.c Signed-off-by: Ian Betts --- .../performance-thread/common/arch/x86/atomic.h| 59 ++ examples/performance-thread/common/arch/x86/ctx.c | 93 +++ examples/performance-thread/common/arch/x86/ctx.h | 57 ++ examples/performance-thread/common/common.mk | 40 + examples/performance-thread/common/lthread.c | 546 + examples/performance-thread/common/lthread.h | 99 +++ examples/performance-thread/common/lthread_api.h | 822 examples/performance-thread/common/lthread_cond.c | 241 ++ examples/performance-thread/common/lthread_cond.h | 77 ++ examples/performance-thread/common/lthread_diag.c | 321 examples/performance-thread/common/lthread_diag.h | 129 +++ .../performance-thread/common/lthread_diag_api.h | 319 examples/performance-thread/common/lthread_int.h | 212 + examples/performance-thread/common/lthread_mutex.c | 256 ++ examples/performance-thread/common/lthread_mutex.h | 52 ++ .../performance-thread/common/lthread_objcache.h | 160 examples/performance-thread/common/lthread_pool.h | 333 examples/performance-thread/common/lthread_queue.h | 303 examples/performance-thread/common/lthread_sched.c | 598 ++ examples/performance-thread/common/lthread_sched.h | 152 examples/performance-thread/common/lthread_timer.h | 47 ++ examples/performance-thread/common/lthread_tls.c | 242 ++ examples/performance-thread/common/lthread_tls.h | 64 ++ 23 files changed, 5222 insertions(+) create mode 100644 examples/performance-thread/common/arch/x86/atomic.h create mode 100644 examples/performance-thread/common/arch/x86/ctx.c create mode 100644 examples/performance-thread/common/arch/x86/ctx.h create mode 100644 examples/performance-thread/common/common.mk create mode 100644 examples/performance-thread/common/lthread.c create mode 100644 examples/performance-thread/common/lthread.h create mode 100644 examples/performance-thread/common/lthread_api.h create mode 100644 examples/performance-thread/common/lthread_cond.c create mode 100644 examples/performance-thread/common/lthread_cond.h create mode 100644 examples/performance-thread/common/lthread_diag.c create mode 100644 examples/performance-thread/common/lthread_diag.h create mode 100644 examples/performance-thread/common/lthread_diag_api.h create mode 100644 examples/performance-thread/common/lthread_int.h create mode 100644 examples/performance-thread/common/lthread_mutex.c create mode 100644 examples/performance-thread/common/lthread_mutex.h create mode 100644 examples/performance-thread/common/lthread_objcache.h create mode 100644 examples/performance-thread/common/lthread_pool.h create mode 100644 examples/performance-thread/common/lthread_queue.h create mode 100644 examples/performance-thread/common/lthread_sched.c create mode 100644 examples/performance-thread/common/lthread_sched.h create mode 100644 examples/performance-thread/common/lthread_timer.h create mode 100644 examples/performance-thread/common/lthread_tls.c create mode 100644 examples/performance-thread/common/lthread_tls.h diff --git a/examples/performance-thread/common/arch/x86/atomic.h b/examples/performance-thread/common/arch/x86/atomic.h new file mode 100644 index 000..968dbe2 --- /dev/null +++ b/examples/performance-thread/common/arch/x86/atomic.h @@ -0,0 +1,59 @@ +/* + *- + * BSD LICENSE + * + * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIM
[dpdk-dev] [PATCH v2 1/5] doc: add performance-thread sample application guide
From: Ian Betts This commit adds documentation for the performance-thread sample application. Changes in this version: * fix typos * changes to tx parameter * add diagrams * add CPU load stats Signed-off-by: Ian Betts --- doc/guides/rel_notes/release_2_2.rst | 11 + .../sample_app_ug/img/performance_thread_1.svg | 799 + .../sample_app_ug/img/performance_thread_2.svg | 865 ++ doc/guides/sample_app_ug/index.rst |1 + doc/guides/sample_app_ug/performance_thread.rst| 1243 5 files changed, 2919 insertions(+) create mode 100644 doc/guides/sample_app_ug/img/performance_thread_1.svg create mode 100644 doc/guides/sample_app_ug/img/performance_thread_2.svg create mode 100644 doc/guides/sample_app_ug/performance_thread.rst diff --git a/doc/guides/rel_notes/release_2_2.rst b/doc/guides/rel_notes/release_2_2.rst index 128f956..2c031de 100644 --- a/doc/guides/rel_notes/release_2_2.rst +++ b/doc/guides/rel_notes/release_2_2.rst @@ -75,6 +75,12 @@ Libraries Examples +* **examples: Introducing a performance thread example** + + This an l3fwd derivative focused to enable characterization of performance + with different threading models, including multiple EAL threads per physical + core, and multiple Lightweight threads running in an EAL thread. + The examples includes a simple cooperative scheduler. Other ~ @@ -82,6 +88,11 @@ Other Known Issues +* When running the performance thread application in configurations with more than + two EAL threads per phsycial core, then forwarding throughput may drop suddenly + to a low level. Stopping and restarting traffic restores correct operation. + This problem does not occur when running with multiple lightweight threads per + physical core. API Changes diff --git a/doc/guides/sample_app_ug/img/performance_thread_1.svg b/doc/guides/sample_app_ug/img/performance_thread_1.svg new file mode 100644 index 000..db01d7c --- /dev/null +++ b/doc/guides/sample_app_ug/img/performance_thread_1.svg @@ -0,0 +1,799 @@ + + + +http://purl.org/dc/elements/1.1/"; + xmlns:cc="http://creativecommons.org/ns#"; + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"; + xmlns:svg="http://www.w3.org/2000/svg"; + xmlns="http://www.w3.org/2000/svg"; + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"; + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"; + width="449.57141" + height="187.34319" + viewBox="0 0 449.57143 187.34319" + id="svg2" + version="1.1" + inkscape:version="0.48.3.1 r9886" + sodipodi:docname="performance_thread_1.svg" + inkscape:export-filename="C:\Users\tkulasex\Documents\L-threads\model-v2.png" + inkscape:export-xdpi="90" + inkscape:export-ydpi="90"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +image/svg+xml +http://purl.org/dc/dcmitype/StillImage"; /> + + + + + + + + + + Port 1 + + +Port 2 + + + rx-thread + +rings + + + + + + rx-thread + + + + Port 1 + + +Port 2 + + + tx-thread + + + + + + tx-thread + + + + + + + tx-thread + + + + + + + + diff --git a/doc/guides/sample_app_ug/img/performance_thread_2.svg b/doc/guides/sample_app_ug/img/performance_thread_2.svg new file mode 100644 index 000..48cf833 --- /dev/null +++ b/doc/guides/sample_app_ug/img/performance_thread_2.svg @@ -0,0 +1,865 @@ + + + +http://purl.org/dc/elements/1.1/"; + xmlns:cc="http://creativecommons.org/ns#"; + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"; + xmlns:svg="http://www.w3.org/2000/svg"; + xmlns="http://www.w3.org/2000/svg"; + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"; + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"; + width="449.57141" + height="187.34319" + viewBox="0 0 449.57143 187.34319" + id="svg2" + version="1.1" + inkscape:version="0.48.3.1 r9886" + sodipodi:docname="performance_thread_2.svg" + inksca
[dpdk-dev] [PATCH v2 0/5] Performance thread example application
From: Ian Betts This example comprises layer 3 forwarding derivative intended to facilitate characterization of performance with different threading models, specifically:- 1. EAL threads running on different physical cores 2. EAL threads running on the same physical core 3. Lightweight threads running in an EAL thread Purpose and justification Since dpdk 2.0 it has been possible to assign multiple EAL threads to a physical core ( case 2 above ). Currently no example application has focused on demonstrating the performance constraints of differing threading models. Whilst purpose built applications that fully comprehend the DPDK single threaded programming model will always yield superior performance, the desire to preserve ROI in legacy code written for multithreaded operating environments makes lightweight threads (case 3 above) worthy of consideration. As well as aiding with legacy code reuse, it is anticipated that lightweight threads will make it possible to scale a multithreaded application with fine granularity allowing an application to more easily take advantage of headroom on EAL cores, or conversely occupy more cores, as dictated by system load. To explore performance with lightweight threads a simple cooperative scheduler subsystem is being included in this example application. If the expected benefits and use cases prove to be of value, it is anticipated that this lightweight thread subsystem would become a library in some future DPDK release. A simple pthread shim in the form of a hello world example is also included. Ian Betts (5): doc: add performance-thread sample application guide examples: add cooperative scheduler subsytem for performance-thread app examples: add l3fwd-thread in performance-thread sample app examples: add pthread-shim in performance-thread sample app config: add build files for performance-thread config/common_linuxapp |5 + config/defconfig_i686-native-linuxapp-gcc |5 + config/defconfig_i686-native-linuxapp-icc |5 + config/defconfig_x86_x32-native-linuxapp-gcc |5 + doc/guides/rel_notes/release_2_2.rst | 11 + .../sample_app_ug/img/performance_thread_1.svg | 799 + .../sample_app_ug/img/performance_thread_2.svg | 865 + doc/guides/sample_app_ug/index.rst |1 + doc/guides/sample_app_ug/performance_thread.rst| 1243 +++ examples/Makefile |1 + examples/performance-thread/Makefile | 45 + .../performance-thread/common/arch/x86/atomic.h| 59 + examples/performance-thread/common/arch/x86/ctx.c | 93 + examples/performance-thread/common/arch/x86/ctx.h | 57 + examples/performance-thread/common/common.mk | 40 + examples/performance-thread/common/lthread.c | 546 +++ examples/performance-thread/common/lthread.h | 99 + examples/performance-thread/common/lthread_api.h | 822 + examples/performance-thread/common/lthread_cond.c | 241 ++ examples/performance-thread/common/lthread_cond.h | 77 + examples/performance-thread/common/lthread_diag.c | 321 ++ examples/performance-thread/common/lthread_diag.h | 129 + .../performance-thread/common/lthread_diag_api.h | 319 ++ examples/performance-thread/common/lthread_int.h | 212 ++ examples/performance-thread/common/lthread_mutex.c | 256 ++ examples/performance-thread/common/lthread_mutex.h | 52 + .../performance-thread/common/lthread_objcache.h | 160 + examples/performance-thread/common/lthread_pool.h | 333 ++ examples/performance-thread/common/lthread_queue.h | 303 ++ examples/performance-thread/common/lthread_sched.c | 598 examples/performance-thread/common/lthread_sched.h | 152 + examples/performance-thread/common/lthread_timer.h | 47 + examples/performance-thread/common/lthread_tls.c | 242 ++ examples/performance-thread/common/lthread_tls.h | 64 + examples/performance-thread/l3fwd-thread/Makefile | 57 + examples/performance-thread/l3fwd-thread/main.c| 3628 examples/performance-thread/pthread_shim/Makefile | 60 + examples/performance-thread/pthread_shim/main.c| 284 ++ .../performance-thread/pthread_shim/pthread_shim.c | 714 .../performance-thread/pthread_shim/pthread_shim.h | 113 + 40 files changed, 13063 insertions(+) create mode 100644 doc/guides/sample_app_ug/img/performance_thread_1.svg create mode 100644 doc/guides/sample_app_ug/img/performance_thread_2.svg create mode 100644 doc/guides/sample_app_ug/performance_thread.rst create mode 100644 examples/performance-thread/Makefile create mode 100644 examples/performance-thread/common/arch/x86/atomic.h create mode 100644 examples/performance-thread/common/arch/x86/ctx.c create mode 100644 examples/performance-thread/common/arch/x86/ctx.h create mode 100644 examples/performance-thread/common/common.mk create mode
[dpdk-dev] [PATCH v1 5/5] config: add build files for performance-thread
From: Ian Betts This commit adds the build controls for the performance-thread sample Signed-off-by: Ian Betts --- config/common_linuxapp | 6 config/defconfig_i686-native-linuxapp-gcc| 6 config/defconfig_i686-native-linuxapp-icc| 6 config/defconfig_x86_x32-native-linuxapp-gcc | 6 examples/Makefile| 1 + examples/performance-thread/Makefile | 44 6 files changed, 69 insertions(+) create mode 100644 examples/performance-thread/Makefile diff --git a/config/common_linuxapp b/config/common_linuxapp index 0de43d5..e1da564 100644 --- a/config/common_linuxapp +++ b/config/common_linuxapp @@ -466,3 +466,8 @@ CONFIG_RTE_APP_TEST=y CONFIG_RTE_TEST_PMD=y CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES=n CONFIG_RTE_TEST_PMD_RECORD_BURST_STATS=n + +# +# Compile the performance thread sample application +# +CONFIG_RTE_PERFORMANCE_THREAD=y diff --git a/config/defconfig_i686-native-linuxapp-gcc b/config/defconfig_i686-native-linuxapp-gcc index a90de9b..67caa06 100644 --- a/config/defconfig_i686-native-linuxapp-gcc +++ b/config/defconfig_i686-native-linuxapp-gcc @@ -49,3 +49,8 @@ CONFIG_RTE_LIBRTE_KNI=n # Vectorized PMD is not supported on 32-bit # CONFIG_RTE_IXGBE_INC_VECTOR=n + +# +# Performance thread sample application is not supported on 32-bit +# +CONFIG_RTE_PERFORMANCE_THREAD=n diff --git a/config/defconfig_i686-native-linuxapp-icc b/config/defconfig_i686-native-linuxapp-icc index c021321..2610b3f 100644 --- a/config/defconfig_i686-native-linuxapp-icc +++ b/config/defconfig_i686-native-linuxapp-icc @@ -49,3 +49,8 @@ CONFIG_RTE_LIBRTE_KNI=n # Vectorized PMD is not supported on 32-bit # CONFIG_RTE_IXGBE_INC_VECTOR=n + +# +# Performance thread sample application is not supported on 32-bit +# +CONFIG_RTE_PERFORMANCE_THREAD=n diff --git a/config/defconfig_x86_x32-native-linuxapp-gcc b/config/defconfig_x86_x32-native-linuxapp-gcc index fb0afc4..6e3f42a 100644 --- a/config/defconfig_x86_x32-native-linuxapp-gcc +++ b/config/defconfig_x86_x32-native-linuxapp-gcc @@ -44,3 +44,8 @@ CONFIG_RTE_TOOLCHAIN_GCC=y # KNI is not supported on 32-bit # CONFIG_RTE_LIBRTE_KNI=n + +# +# Performance thread sample application is not supported on 32-bit +# +CONFIG_RTE_PERFORMANCE_THREAD=n diff --git a/examples/Makefile b/examples/Makefile index b4eddbd..9dffac4 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -74,5 +74,6 @@ DIRS-$(CONFIG_RTE_LIBRTE_XEN_DOM0) += vhost_xen DIRS-y += vmdq DIRS-y += vmdq_dcb DIRS-$(CONFIG_RTE_LIBRTE_POWER) += vm_power_manager +DIRS-$(CONFIG_RTE_PERFORMANCE_THREAD) += performance-thread include $(RTE_SDK)/mk/rte.extsubdir.mk diff --git a/examples/performance-thread/Makefile b/examples/performance-thread/Makefile new file mode 100644 index 000..a9c75f7 --- /dev/null +++ b/examples/performance-thread/Makefile @@ -0,0 +1,44 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +ifeq ($(RTE_SDK),) +$(error "Please define RTE_SDK environment variable") +endif + +# Default target, can be overridden by command line or environment +RTE_TARGET ?= x86_64-native-linuxapp-gcc + +include $(RTE_SDK)/mk/rte.vars.mk + +DIRS-$(CONFIG_RTE_PERFORMANCE_THREAD) += l3fwd-thread +DIRS-$(CONFIG_RTE_PERFORMANCE_THREAD) += pthread_shim + +include $(RTE_SDK)/mk/rte.extsubdir.mk -- 1.
[dpdk-dev] [PATCH v1 4/5] examples: add pthread-shim in performance-thread sample app
From: Ian Betts This commit adds a simple pthread_shim example for the cooperative included with this patchset. The shim demonstrates a way in which legacy code writtem for pthreads could be adapted to lighweight threads. Signed-off-by: Ian Betts --- examples/performance-thread/pthread_shim/Makefile | 61 ++ examples/performance-thread/pthread_shim/main.c| 287 + .../performance-thread/pthread_shim/pthread_shim.c | 717 + .../performance-thread/pthread_shim/pthread_shim.h | 113 4 files changed, 1178 insertions(+) create mode 100644 examples/performance-thread/pthread_shim/Makefile create mode 100644 examples/performance-thread/pthread_shim/main.c create mode 100644 examples/performance-thread/pthread_shim/pthread_shim.c create mode 100644 examples/performance-thread/pthread_shim/pthread_shim.h diff --git a/examples/performance-thread/pthread_shim/Makefile b/examples/performance-thread/pthread_shim/Makefile new file mode 100644 index 000..953dc42 --- /dev/null +++ b/examples/performance-thread/pthread_shim/Makefile @@ -0,0 +1,60 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +ifeq ($(RTE_SDK),) +$(error "Please define RTE_SDK environment variable") +endif + +# Default target, can be overriden by command line or environment +RTE_TARGET ?= x86_64-native-linuxapp-gcc + +include $(RTE_SDK)/mk/rte.vars.mk + +# binary name +APP = lthread_pthread_shim + +# all source are stored in SRCS-y +SRCS-y := main.c pthread_shim.c +INCLUDES := -I$(RTE_SDK)/$(RTE_TARGET)/include -I$(SRCDIR) +include $(RTE_SDK)/examples/performance-thread/common/common.mk + +CFLAGS=-g -O3 $(USER_FLAGS) $(INCLUDES) +CFLAGS += $(WERROR_FLAGS) + +LDFLAGS += -lpthread + +# workaround for a gcc bug with noreturn attribute +# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603 +ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y) +CFLAGS_main.o += -Wno-return-type +endif + +include $(RTE_SDK)/mk/rte.extapp.mk diff --git a/examples/performance-thread/pthread_shim/main.c b/examples/performance-thread/pthread_shim/main.c new file mode 100644 index 000..afc12c8 --- /dev/null +++ b/examples/performance-thread/pthread_shim/main.c @@ -0,0 +1,284 @@ + +/*- + * BSD LICENSE + * + * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
[dpdk-dev] [PATCH v1 3/5] examples: add l3fwd-thread in performance-thread sample app
From: Ian Betts This commit adds an l3fwd derivative that allows multiple EAL threads to be run on a single physical core or multiple lightwieght threads to be run in an EAL thread. Its purpose is to facilitate characterization of performance with different threading models. It depends on a simple cooperative scheduler included in this patchset. Signed-off-by: Ian Betts --- examples/performance-thread/l3fwd-thread/Makefile | 57 + examples/performance-thread/l3fwd-thread/main.c | 3355 + 2 files changed, 3412 insertions(+) create mode 100644 examples/performance-thread/l3fwd-thread/Makefile create mode 100644 examples/performance-thread/l3fwd-thread/main.c diff --git a/examples/performance-thread/l3fwd-thread/Makefile b/examples/performance-thread/l3fwd-thread/Makefile new file mode 100644 index 000..d8fe5e6 --- /dev/null +++ b/examples/performance-thread/l3fwd-thread/Makefile @@ -0,0 +1,57 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2015 Intel Corporation. All rights reserved. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +ifeq ($(RTE_SDK),) +$(error "Please define RTE_SDK environment variable") +endif + +# Default target, can be overridden by command line or environment +RTE_TARGET ?= x86_64-native-linuxapp-gcc + +include $(RTE_SDK)/mk/rte.vars.mk + +# binary name +APP = l3fwd-thread + +# all source are stored in SRCS-y +SRCS-y := main.c + +include $(RTE_SDK)/examples/performance-thread/common/common.mk + +CFLAGS += -O3 -g $(USER_FLAGS) $(INCLUDES) $(WERROR_FLAGS) + +# workaround for a gcc bug with noreturn attribute +# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603 +#ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y) +CFLAGS_main.o += -Wno-return-type +#endif + +include $(RTE_SDK)/mk/rte.extapp.mk diff --git a/examples/performance-thread/l3fwd-thread/main.c b/examples/performance-thread/l3fwd-thread/main.c new file mode 100644 index 000..2708ec6 --- /dev/null +++ b/examples/performance-thread/l3fwd-thread/main.c @@ -0,0 +1,3355 @@ +/* + * BSD LICENSE + * + * Copyright(c) 2010-2015 Intel Corporation. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; O
[dpdk-dev] [PATCH v1 2/5] examples: add cooperative scheduler subsytem for performance-thread app
From: Ian Betts This commit adds a cooperative scheduler subsystem in the performance-thread sample application. It is used in the performance-thread sample application by the l3fwd-thread application to enable multiple lightweight threads to be run in an EAL thread. Signed-off-by: Ian Betts --- .../performance-thread/common/arch/x86/atomic.h| 60 ++ examples/performance-thread/common/arch/x86/ctx.c | 66 ++ examples/performance-thread/common/arch/x86/ctx.h | 57 ++ examples/performance-thread/common/common.mk | 40 + examples/performance-thread/common/lthread.c | 528 + examples/performance-thread/common/lthread.h | 99 +++ examples/performance-thread/common/lthread_api.h | 822 + examples/performance-thread/common/lthread_cond.c | 228 ++ examples/performance-thread/common/lthread_cond.h | 77 ++ examples/performance-thread/common/lthread_diag.c | 315 examples/performance-thread/common/lthread_diag.h | 129 .../performance-thread/common/lthread_diag_api.h | 295 examples/performance-thread/common/lthread_int.h | 212 ++ examples/performance-thread/common/lthread_mutex.c | 244 ++ examples/performance-thread/common/lthread_mutex.h | 52 ++ .../performance-thread/common/lthread_objcache.h | 160 examples/performance-thread/common/lthread_pool.h | 338 + examples/performance-thread/common/lthread_queue.h | 303 examples/performance-thread/common/lthread_sched.c | 644 examples/performance-thread/common/lthread_sched.h | 152 examples/performance-thread/common/lthread_timer.h | 47 ++ examples/performance-thread/common/lthread_tls.c | 242 ++ examples/performance-thread/common/lthread_tls.h | 64 ++ 23 files changed, 5174 insertions(+) create mode 100644 examples/performance-thread/common/arch/x86/atomic.h create mode 100644 examples/performance-thread/common/arch/x86/ctx.c create mode 100644 examples/performance-thread/common/arch/x86/ctx.h create mode 100644 examples/performance-thread/common/common.mk create mode 100644 examples/performance-thread/common/lthread.c create mode 100644 examples/performance-thread/common/lthread.h create mode 100644 examples/performance-thread/common/lthread_api.h create mode 100644 examples/performance-thread/common/lthread_cond.c create mode 100644 examples/performance-thread/common/lthread_cond.h create mode 100644 examples/performance-thread/common/lthread_diag.c create mode 100644 examples/performance-thread/common/lthread_diag.h create mode 100644 examples/performance-thread/common/lthread_diag_api.h create mode 100644 examples/performance-thread/common/lthread_int.h create mode 100644 examples/performance-thread/common/lthread_mutex.c create mode 100644 examples/performance-thread/common/lthread_mutex.h create mode 100644 examples/performance-thread/common/lthread_objcache.h create mode 100644 examples/performance-thread/common/lthread_pool.h create mode 100644 examples/performance-thread/common/lthread_queue.h create mode 100644 examples/performance-thread/common/lthread_sched.c create mode 100644 examples/performance-thread/common/lthread_sched.h create mode 100644 examples/performance-thread/common/lthread_timer.h create mode 100644 examples/performance-thread/common/lthread_tls.c create mode 100644 examples/performance-thread/common/lthread_tls.h diff --git a/examples/performance-thread/common/arch/x86/atomic.h b/examples/performance-thread/common/arch/x86/atomic.h new file mode 100644 index 000..b1fa703 --- /dev/null +++ b/examples/performance-thread/common/arch/x86/atomic.h @@ -0,0 +1,59 @@ +/* + *- + * BSD LICENSE + * + * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY
[dpdk-dev] [PATCH v1 1/5] doc: add performance-thread sample application guide
From: Ian Betts This commit adds documentation for the performance-thread sample application. Signed-off-by: Ian Betts --- doc/guides/rel_notes/release_2_2.rst|6 + doc/guides/sample_app_ug/index.rst |1 + doc/guides/sample_app_ug/performance_thread.rst | 1221 +++ 3 files changed, 1228 insertions(+) create mode 100644 doc/guides/sample_app_ug/performance_thread.rst diff --git a/doc/guides/rel_notes/release_2_2.rst b/doc/guides/rel_notes/release_2_2.rst index 5687676..e9772d3 100644 --- a/doc/guides/rel_notes/release_2_2.rst +++ b/doc/guides/rel_notes/release_2_2.rst @@ -52,6 +52,12 @@ Libraries Examples +* **examples: Introducing a performance thread example** + + This an l3fwd derivative focused to enable characterization of performance + with different threading models, including multiple EAL threads per physical + core, and multiple Lightweight threads running in an EAL thread. + The examples includes a simple cooperative scheduler. Other ~ diff --git a/doc/guides/sample_app_ug/index.rst b/doc/guides/sample_app_ug/index.rst index 9beedd9..70d4a5c 100644 --- a/doc/guides/sample_app_ug/index.rst +++ b/doc/guides/sample_app_ug/index.rst @@ -73,6 +73,7 @@ Sample Applications User Guide vm_power_management tep_termination proc_info +performance_thread **Figures** diff --git a/doc/guides/sample_app_ug/performance_thread.rst b/doc/guides/sample_app_ug/performance_thread.rst new file mode 100644 index 000..497d729 --- /dev/null +++ b/doc/guides/sample_app_ug/performance_thread.rst @@ -0,0 +1,1220 @@ +.. BSD LICENSE +Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +* Re-distributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in +the documentation and/or other materials provided with the +distribution. +* Neither the name of Intel Corporation nor the names of its +contributors may be used to endorse or promote products derived +from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +Performance Thread Sample Application += + +The performance thread sample application is a derivative of the standard L3 +forwarding application that demonstrates different threading models. + +Overview + +For a general description of the L3 forwarding applications capabilities +please refer to the documentation of the standard application in +:doc:`l3_forward`. + +The performance thread sample application differs from the standard L3 forward +example in that it divides the TX and Rx processing between different threads, +and makes it possible to assign individual threads to different cores. + +Three threading models are considered:- + +#. When there is EAL thread per physical core +#. When there are multiple EAL threads per physical core +#. When there are multiple lightweight threads per EAL thread + +Since DPDK release 2.0 it is possible to launch applications using the ?lcores +EAL parameter, specifying CPU sets for a physical core. With the performance +thread sample application its is now also possible to assign individual Rx +and TX functions to different cores. + +As an alternative to dividing the L3 forwarding work between different EAL +threads the performance thread sample introduces the possibility to run the +application threads as lightweight threads (L-threads) within one or +more EAL threads. + +In order to facilitate this threading model the example includes a primitive +cooperative scheduler (L-thread) subsystem. More details of the L-thread +subsystem can be found in :ref:`lthread_subsystem` + +**Note:** Whilst theoretcially possible it is not anticipated that multiple +L-thread schedulers would be run on the same ph
[dpdk-dev] [PATCH v1 0/5] examples: add performance thread example
From: Ian Betts Performance thread example application This example comprises layer 3 forwarding derivative intended to facilitate characterization of performance with different threading models, specifically:- 1. EAL threads running on different physical cores 2. EAL threads running on the same physical core 3. Lightweight threads running in an EAL thread Purpose and justification Since dpdk 2.0 it has been possible to assign multiple EAL threads to a physical core ( case 2 above ). Currently no example application has focused on demonstrating the performance constraints of differing threading models. Whilst purpose built applications that fully comprehend the DPDK single threaded programming model will always yield superior performance, the desire to preserve ROI in legacy code written for multithreaded operating environments makes lightweight threads ( case 3 above ) worthy of consideration. As well as aiding with legacy code reuse, it is anticipated that lightweight threads will make it possible to scale a multithreaded application with fine granularity allowing an application to more easily take advantage of headroom on EAL cores, or conversely occupy more cores, as dictated by system load. To explore performance with lightweight threads a simple cooperative scheduler subsystem is being included in this example application. If the expected benefits and use cases prove to be of value, it is anticipated that this lightweight thread subsystem would become a library in some future DPDK release. A simple pthread shim in the form of a hello world example is also included. Ian Betts (5): doc: add performance-thread sample application guide examples: add cooperative scheduler subsytem for performance-thread app examples: add l3fwd-thread in performance-thread sample app examples: add pthread-shim in performance-thread sample app config: add build files for performance-thread-app config/common_linuxapp |6 + config/defconfig_i686-native-linuxapp-gcc |6 + config/defconfig_i686-native-linuxapp-icc |6 + config/defconfig_x86_x32-native-linuxapp-gcc |6 + doc/guides/rel_notes/release_2_2.rst |6 + doc/guides/sample_app_ug/index.rst |1 + doc/guides/sample_app_ug/performance_thread.rst| 1221 +++ examples/Makefile |1 + .../performance-thread/common/arch/x86/atomic.h| 60 + examples/performance-thread/common/arch/x86/ctx.c | 66 + examples/performance-thread/common/arch/x86/ctx.h | 57 + examples/performance-thread/common/common.mk | 40 + examples/performance-thread/common/lthread.c | 528 +++ examples/performance-thread/common/lthread.h | 99 + examples/performance-thread/common/lthread_api.h | 822 + examples/performance-thread/common/lthread_cond.c | 228 ++ examples/performance-thread/common/lthread_cond.h | 77 + examples/performance-thread/common/lthread_diag.c | 315 ++ examples/performance-thread/common/lthread_diag.h | 129 + .../performance-thread/common/lthread_diag_api.h | 295 ++ examples/performance-thread/common/lthread_int.h | 212 ++ examples/performance-thread/common/lthread_mutex.c | 244 ++ examples/performance-thread/common/lthread_mutex.h | 52 + .../performance-thread/common/lthread_objcache.h | 160 + examples/performance-thread/common/lthread_pool.h | 338 ++ examples/performance-thread/common/lthread_queue.h | 303 ++ examples/performance-thread/common/lthread_sched.c | 644 examples/performance-thread/common/lthread_sched.h | 152 + examples/performance-thread/common/lthread_timer.h | 47 + examples/performance-thread/common/lthread_tls.c | 242 ++ examples/performance-thread/common/lthread_tls.h | 64 + examples/performance-thread/l3fwd-thread/Makefile | 57 + examples/performance-thread/l3fwd-thread/main.c| 3355 examples/performance-thread/pthread_shim/Makefile | 61 + examples/performance-thread/pthread_shim/main.c| 287 ++ .../performance-thread/pthread_shim/pthread_shim.c | 717 + .../performance-thread/pthread_shim/pthread_shim.h | 113 + 37 files changed, 11017 insertions(+) create mode 100644 doc/guides/sample_app_ug/performance_thread.rst create mode 100644 examples/performance-thread/common/arch/x86/atomic.h create mode 100644 examples/performance-thread/common/arch/x86/ctx.c create mode 100644 examples/performance-thread/common/arch/x86/ctx.h create mode 100644 examples/performance-thread/common/common.mk create mode 100644 examples/performance-thread/common/lthread.c create mode 100644 examples/performance-thread/common/lthread.h create mode 100644 examples/performance-thread/common/lthread_api.h create mode 100644 examples/performance-thread/common/lthread_cond.c create mode 100644 examples/performance-thread/common/lthread_cond.h create mode 10064