From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id 7E3F04F98 for ; Thu, 4 Apr 2019 01:21:03 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Apr 2019 16:21:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,306,1549958400"; d="scan'208";a="139791630" Received: from txasoft-yocto.an.intel.com ([10.123.72.192]) by orsmga003.jf.intel.com with ESMTP; 03 Apr 2019 16:21:01 -0700 From: Gage Eads To: dev@dpdk.org Cc: olivier.matz@6wind.com, arybchenko@solarflare.com, bruce.richardson@intel.com, konstantin.ananyev@intel.com, gavin.hu@arm.com, Honnappa.Nagarahalli@arm.com, nd@arm.com, thomas@monjalon.net Date: Wed, 3 Apr 2019 18:20:12 -0500 Message-Id: <20190403232020.12784-1-gage.eads@intel.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20190403205041.4651-1-gage.eads@intel.com> References: <20190403205041.4651-1-gage.eads@intel.com> Subject: [dpdk-dev] [PATCH v9 0/8] Add stack library and new mempool handler X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Apr 2019 23:21:04 -0000 This patchset introduces a stack library, supporting both lock-based and lock-free stacks, and a lock-free stack mempool handler. The lock-based stack code is derived from the existing stack mempool handler, and that handler is refactored to use the stack library. The lock-free stack mempool handler is intended for usages where the rte ring's "non-preemptive" constraint is not acceptable; for example, if the application uses a mixture of pinned high-priority threads and multiplexed low-priority threads that share a mempool. Note that the lock-free algorithm relies on a 128-bit compare-and-swap[1], so it is currently limited to the x86_64 platform. This patchset is the successor to a patchset containing only the new mempool handler[2]. [1] http://mails.dpdk.org/archives/dev/2019-April/129014.html [2] http://mails.dpdk.org/archives/dev/2019-January/123555.html --- v9: - Add rte_atomic.h includes to rte_stack.h, test_stack.c, and test_stack_perf.c to fix ARM builds v8: - Add rte_debug.h include to rte_stack.h for RTE_ASSERT() v7: - Add rte_branch_prediction.h include to rte_stack_std.h for unlikely() - Add rte_compat.h include to rte_stack.h for __rte_experimental v6: - Add load-acquire fence to the lock-free push function - Correct generic implementation's pop_elems 128b CAS success and failure memorder to match those in the C11 implementation. v5: - Add comment to explain padding in *_get_memsize() functions - Prefix internal functions with '__' - Use RTE_ASSERT for performance critical run-time checks - Don't use __atomic_load in the C11 pop_elems function, and put an acquire thread fence at the start of the 2nd do-while loop - Change pop_elems 128b CAS success memorder to RELEASE and failure memorder to RELAXED - Change compile-time assertion to run for all 64-bit architectures - Reorganize the code with standard and lock-free .c and .h files v4: - Fix 32-bit build error in test_stack.c by using %zu format specifier for size_t - Rebase onto master v3: - Rebase patchset onto master (test/test/ -> app/test/) - Fix rte_stack_std_push() segfault introduced in v2 v2: - Reworked structure and function naming to use rte_stack_{std, lf}_... - Updated to the latest rte_atomic128_cmp_exchange() interface. - Rename STACK_F_NB -> RTE_STACK_F_LF. - Remove rte_rmb() and rte_wmb() from the generic push and pop implementations. These are obviated by rte_atomic128_cmp_exchange()'s two memorder arguments. - Edit stack_lib.rst text to 80 chars/line. - Fix rte_stack.h doxygen formatting. - Allocate popped_objs array from the heap - Fix stack_thread_push_pop bug ("&t->sz" -> "t->sz") - Remove unnecessary NULL check from test_stack_basic - Properly terminate the name string in test_stack_name_length - Add an empty array of struct rte_nb_lifo_elem elements - In rte_nb_lifo_push(), retrieve the last element from __nb_lifo_pop() - Split C11 implementation into a separate patchset Gage Eads (8): stack: introduce rte stack library mempool/stack: convert mempool to use rte stack test/stack: add stack test test/stack: add stack perf test stack: add lock-free stack implementation stack: add C11 atomic implementation test/stack: add lock-free stack tests mempool/stack: add lock-free stack mempool handler MAINTAINERS | 9 +- app/test/Makefile | 3 + app/test/meson.build | 7 + app/test/test_stack.c | 424 ++++++++++++++++++++++++ app/test/test_stack_perf.c | 358 ++++++++++++++++++++ config/common_base | 5 + doc/api/doxy-api-index.md | 1 + doc/api/doxy-api.conf.in | 1 + doc/guides/prog_guide/env_abstraction_layer.rst | 10 + doc/guides/prog_guide/index.rst | 1 + doc/guides/prog_guide/stack_lib.rst | 83 +++++ doc/guides/rel_notes/release_19_05.rst | 13 + drivers/mempool/stack/Makefile | 3 +- drivers/mempool/stack/meson.build | 6 +- drivers/mempool/stack/rte_mempool_stack.c | 115 +++---- lib/Makefile | 2 + lib/librte_stack/Makefile | 29 ++ lib/librte_stack/meson.build | 12 + lib/librte_stack/rte_stack.c | 196 +++++++++++ lib/librte_stack/rte_stack.h | 262 +++++++++++++++ lib/librte_stack/rte_stack_lf.c | 31 ++ lib/librte_stack/rte_stack_lf.h | 106 ++++++ lib/librte_stack/rte_stack_lf_c11.h | 175 ++++++++++ lib/librte_stack/rte_stack_lf_generic.h | 164 +++++++++ lib/librte_stack/rte_stack_pvt.h | 34 ++ lib/librte_stack/rte_stack_std.c | 26 ++ lib/librte_stack/rte_stack_std.h | 121 +++++++ lib/librte_stack/rte_stack_version.map | 9 + lib/meson.build | 2 +- mk/rte.app.mk | 1 + 30 files changed, 2137 insertions(+), 72 deletions(-) create mode 100644 app/test/test_stack.c create mode 100644 app/test/test_stack_perf.c create mode 100644 doc/guides/prog_guide/stack_lib.rst create mode 100644 lib/librte_stack/Makefile create mode 100644 lib/librte_stack/meson.build create mode 100644 lib/librte_stack/rte_stack.c create mode 100644 lib/librte_stack/rte_stack.h create mode 100644 lib/librte_stack/rte_stack_lf.c create mode 100644 lib/librte_stack/rte_stack_lf.h create mode 100644 lib/librte_stack/rte_stack_lf_c11.h create mode 100644 lib/librte_stack/rte_stack_lf_generic.h create mode 100644 lib/librte_stack/rte_stack_pvt.h create mode 100644 lib/librte_stack/rte_stack_std.c create mode 100644 lib/librte_stack/rte_stack_std.h create mode 100644 lib/librte_stack/rte_stack_version.map -- 2.13.6 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 0E945A0679 for ; Thu, 4 Apr 2019 01:21:07 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id CBF8958FA; Thu, 4 Apr 2019 01:21:05 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id 7E3F04F98 for ; Thu, 4 Apr 2019 01:21:03 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Apr 2019 16:21:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,306,1549958400"; d="scan'208";a="139791630" Received: from txasoft-yocto.an.intel.com ([10.123.72.192]) by orsmga003.jf.intel.com with ESMTP; 03 Apr 2019 16:21:01 -0700 From: Gage Eads To: dev@dpdk.org Cc: olivier.matz@6wind.com, arybchenko@solarflare.com, bruce.richardson@intel.com, konstantin.ananyev@intel.com, gavin.hu@arm.com, Honnappa.Nagarahalli@arm.com, nd@arm.com, thomas@monjalon.net Date: Wed, 3 Apr 2019 18:20:12 -0500 Message-Id: <20190403232020.12784-1-gage.eads@intel.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20190403205041.4651-1-gage.eads@intel.com> References: <20190403205041.4651-1-gage.eads@intel.com> Subject: [dpdk-dev] [PATCH v9 0/8] Add stack library and new mempool handler X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Content-Type: text/plain; charset="UTF-8" Message-ID: <20190403232012.6oMo4vbXdHhru-C1rNI2GzD5wgr6yjGyTALW2w2G9tw@z> This patchset introduces a stack library, supporting both lock-based and lock-free stacks, and a lock-free stack mempool handler. The lock-based stack code is derived from the existing stack mempool handler, and that handler is refactored to use the stack library. The lock-free stack mempool handler is intended for usages where the rte ring's "non-preemptive" constraint is not acceptable; for example, if the application uses a mixture of pinned high-priority threads and multiplexed low-priority threads that share a mempool. Note that the lock-free algorithm relies on a 128-bit compare-and-swap[1], so it is currently limited to the x86_64 platform. This patchset is the successor to a patchset containing only the new mempool handler[2]. [1] http://mails.dpdk.org/archives/dev/2019-April/129014.html [2] http://mails.dpdk.org/archives/dev/2019-January/123555.html --- v9: - Add rte_atomic.h includes to rte_stack.h, test_stack.c, and test_stack_perf.c to fix ARM builds v8: - Add rte_debug.h include to rte_stack.h for RTE_ASSERT() v7: - Add rte_branch_prediction.h include to rte_stack_std.h for unlikely() - Add rte_compat.h include to rte_stack.h for __rte_experimental v6: - Add load-acquire fence to the lock-free push function - Correct generic implementation's pop_elems 128b CAS success and failure memorder to match those in the C11 implementation. v5: - Add comment to explain padding in *_get_memsize() functions - Prefix internal functions with '__' - Use RTE_ASSERT for performance critical run-time checks - Don't use __atomic_load in the C11 pop_elems function, and put an acquire thread fence at the start of the 2nd do-while loop - Change pop_elems 128b CAS success memorder to RELEASE and failure memorder to RELAXED - Change compile-time assertion to run for all 64-bit architectures - Reorganize the code with standard and lock-free .c and .h files v4: - Fix 32-bit build error in test_stack.c by using %zu format specifier for size_t - Rebase onto master v3: - Rebase patchset onto master (test/test/ -> app/test/) - Fix rte_stack_std_push() segfault introduced in v2 v2: - Reworked structure and function naming to use rte_stack_{std, lf}_... - Updated to the latest rte_atomic128_cmp_exchange() interface. - Rename STACK_F_NB -> RTE_STACK_F_LF. - Remove rte_rmb() and rte_wmb() from the generic push and pop implementations. These are obviated by rte_atomic128_cmp_exchange()'s two memorder arguments. - Edit stack_lib.rst text to 80 chars/line. - Fix rte_stack.h doxygen formatting. - Allocate popped_objs array from the heap - Fix stack_thread_push_pop bug ("&t->sz" -> "t->sz") - Remove unnecessary NULL check from test_stack_basic - Properly terminate the name string in test_stack_name_length - Add an empty array of struct rte_nb_lifo_elem elements - In rte_nb_lifo_push(), retrieve the last element from __nb_lifo_pop() - Split C11 implementation into a separate patchset Gage Eads (8): stack: introduce rte stack library mempool/stack: convert mempool to use rte stack test/stack: add stack test test/stack: add stack perf test stack: add lock-free stack implementation stack: add C11 atomic implementation test/stack: add lock-free stack tests mempool/stack: add lock-free stack mempool handler MAINTAINERS | 9 +- app/test/Makefile | 3 + app/test/meson.build | 7 + app/test/test_stack.c | 424 ++++++++++++++++++++++++ app/test/test_stack_perf.c | 358 ++++++++++++++++++++ config/common_base | 5 + doc/api/doxy-api-index.md | 1 + doc/api/doxy-api.conf.in | 1 + doc/guides/prog_guide/env_abstraction_layer.rst | 10 + doc/guides/prog_guide/index.rst | 1 + doc/guides/prog_guide/stack_lib.rst | 83 +++++ doc/guides/rel_notes/release_19_05.rst | 13 + drivers/mempool/stack/Makefile | 3 +- drivers/mempool/stack/meson.build | 6 +- drivers/mempool/stack/rte_mempool_stack.c | 115 +++---- lib/Makefile | 2 + lib/librte_stack/Makefile | 29 ++ lib/librte_stack/meson.build | 12 + lib/librte_stack/rte_stack.c | 196 +++++++++++ lib/librte_stack/rte_stack.h | 262 +++++++++++++++ lib/librte_stack/rte_stack_lf.c | 31 ++ lib/librte_stack/rte_stack_lf.h | 106 ++++++ lib/librte_stack/rte_stack_lf_c11.h | 175 ++++++++++ lib/librte_stack/rte_stack_lf_generic.h | 164 +++++++++ lib/librte_stack/rte_stack_pvt.h | 34 ++ lib/librte_stack/rte_stack_std.c | 26 ++ lib/librte_stack/rte_stack_std.h | 121 +++++++ lib/librte_stack/rte_stack_version.map | 9 + lib/meson.build | 2 +- mk/rte.app.mk | 1 + 30 files changed, 2137 insertions(+), 72 deletions(-) create mode 100644 app/test/test_stack.c create mode 100644 app/test/test_stack_perf.c create mode 100644 doc/guides/prog_guide/stack_lib.rst create mode 100644 lib/librte_stack/Makefile create mode 100644 lib/librte_stack/meson.build create mode 100644 lib/librte_stack/rte_stack.c create mode 100644 lib/librte_stack/rte_stack.h create mode 100644 lib/librte_stack/rte_stack_lf.c create mode 100644 lib/librte_stack/rte_stack_lf.h create mode 100644 lib/librte_stack/rte_stack_lf_c11.h create mode 100644 lib/librte_stack/rte_stack_lf_generic.h create mode 100644 lib/librte_stack/rte_stack_pvt.h create mode 100644 lib/librte_stack/rte_stack_std.c create mode 100644 lib/librte_stack/rte_stack_std.h create mode 100644 lib/librte_stack/rte_stack_version.map -- 2.13.6