All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/6] eal: change rte pause as architecture specific function
@ 2017-05-11 10:10 Jerin Jacob
  2017-05-11 10:10 ` [PATCH 2/6] eal/arm32: rte pause implementation for arm32 Jerin Jacob
                   ` (5 more replies)
  0 siblings, 6 replies; 20+ messages in thread
From: Jerin Jacob @ 2017-05-11 10:10 UTC (permalink / raw)
  To: dev; +Cc: thomas, jianbo.liu, viktorin, Jerin Jacob

Each architecture may have different instructions for optimized
and power consumption aware rte_pause() implementation.

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
---
 doc/api/doxy-api-index.md                         |  3 +-
 lib/librte_eal/common/Makefile                    |  2 +-
 lib/librte_eal/common/include/generic/rte_pause.h | 52 +++++++++++++++++++++++
 3 files changed, 55 insertions(+), 2 deletions(-)
 create mode 100644 lib/librte_eal/common/include/generic/rte_pause.h

diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md
index f5f1f199f..a6f3fedd4 100644
--- a/doc/api/doxy-api-index.md
+++ b/doc/api/doxy-api-index.md
@@ -77,7 +77,8 @@ There are many libraries, so their headers may be grouped by topics:
   [SIMD]               (@ref rte_vect.h),
   [byte order]         (@ref rte_byteorder.h),
   [CPU flags]          (@ref rte_cpuflags.h),
-  [I/O access]         (@ref rte_io.h)
+  [I/O access]         (@ref rte_io.h),
+  [cpu pause]          (@ref rte_pause.h)
 
 - **CPU multicore**:
   [interrupts]         (@ref rte_interrupts.h),
diff --git a/lib/librte_eal/common/Makefile b/lib/librte_eal/common/Makefile
index a5bd1089a..fb1e2aab6 100644
--- a/lib/librte_eal/common/Makefile
+++ b/lib/librte_eal/common/Makefile
@@ -44,7 +44,7 @@ INC += rte_malloc.h rte_keepalive.h rte_time.h
 
 GENERIC_INC := rte_atomic.h rte_byteorder.h rte_cycles.h rte_prefetch.h
 GENERIC_INC += rte_spinlock.h rte_memcpy.h rte_cpuflags.h rte_rwlock.h
-GENERIC_INC += rte_vect.h rte_io.h
+GENERIC_INC += rte_vect.h rte_io.h rte_pause.h
 
 # defined in mk/arch/$(RTE_ARCH)/rte.vars.mk
 ARCH_DIR ?= $(RTE_ARCH)
diff --git a/lib/librte_eal/common/include/generic/rte_pause.h b/lib/librte_eal/common/include/generic/rte_pause.h
new file mode 100644
index 000000000..9625e580c
--- /dev/null
+++ b/lib/librte_eal/common/include/generic/rte_pause.h
@@ -0,0 +1,52 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2017 Cavium. 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 Cavium 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.
+ */
+
+#ifndef _RTE_PAUSE_H_
+#define _RTE_PAUSE_H_
+
+/**
+ * @file
+ *
+ * CPU pause operation.
+ *
+ */
+
+/**
+ * Pause CPU execution for a short while
+ *
+ * This call is intended for tight loops which poll a shared resource or wait
+ * for an event. A short pause within the loop may reduce the power consumption.
+ */
+static inline void rte_pause(void);
+
+#endif /* _RTE_PAUSE_H_ */
-- 
2.12.2

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

* [PATCH 2/6] eal/arm32: rte pause implementation for arm32
  2017-05-11 10:10 [PATCH 1/6] eal: change rte pause as architecture specific function Jerin Jacob
@ 2017-05-11 10:10 ` Jerin Jacob
  2017-05-18  8:11   ` Jan Viktorin
  2017-05-11 10:10 ` [PATCH 3/6] eal/arm64: rte pause implementation for arm64 Jerin Jacob
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 20+ messages in thread
From: Jerin Jacob @ 2017-05-11 10:10 UTC (permalink / raw)
  To: dev; +Cc: thomas, jianbo.liu, viktorin, Jerin Jacob

The patch does not provide any functional change for ARM32
with respect to existing rte_pause() definition.

CC: Jan Viktorin <viktorin@rehivetech.com>
CC: Jianbo Liu <jianbo.liu@linaro.org>
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
---
 lib/librte_eal/common/include/arch/arm/rte_pause.h | 46 +++++++++++++++++++
 .../common/include/arch/arm/rte_pause_32.h         | 51 ++++++++++++++++++++++
 2 files changed, 97 insertions(+)
 create mode 100644 lib/librte_eal/common/include/arch/arm/rte_pause.h
 create mode 100644 lib/librte_eal/common/include/arch/arm/rte_pause_32.h

diff --git a/lib/librte_eal/common/include/arch/arm/rte_pause.h b/lib/librte_eal/common/include/arch/arm/rte_pause.h
new file mode 100644
index 000000000..0fe88aba9
--- /dev/null
+++ b/lib/librte_eal/common/include/arch/arm/rte_pause.h
@@ -0,0 +1,46 @@
+/*
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2017 Cavium. 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 Cavium 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.
+ */
+
+#ifndef _RTE_PAUSE_ARM_H_
+#define _RTE_PAUSE_ARM_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rte_pause_32.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_PAUSE_ARM_H_ */
diff --git a/lib/librte_eal/common/include/arch/arm/rte_pause_32.h b/lib/librte_eal/common/include/arch/arm/rte_pause_32.h
new file mode 100644
index 000000000..cfe31d8ba
--- /dev/null
+++ b/lib/librte_eal/common/include/arch/arm/rte_pause_32.h
@@ -0,0 +1,51 @@
+/*
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2017 Cavium. 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 Cavium 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.
+ */
+
+#ifndef _RTE_PAUSE_ARM32_H_
+#define _RTE_PAUSE_ARM32_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rte_common.h>
+#include "generic/rte_pause.h"
+
+static inline void rte_pause(void)
+{
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_PAUSE_ARM32_H_ */
-- 
2.12.2

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

* [PATCH 3/6] eal/arm64: rte pause implementation for arm64
  2017-05-11 10:10 [PATCH 1/6] eal: change rte pause as architecture specific function Jerin Jacob
  2017-05-11 10:10 ` [PATCH 2/6] eal/arm32: rte pause implementation for arm32 Jerin Jacob
@ 2017-05-11 10:10 ` Jerin Jacob
  2017-05-18  9:40   ` Jianbo Liu
  2017-05-11 10:10 ` [PATCH 4/6] eal/x86: rte pause implementation for x86 Jerin Jacob
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 20+ messages in thread
From: Jerin Jacob @ 2017-05-11 10:10 UTC (permalink / raw)
  To: dev; +Cc: thomas, jianbo.liu, viktorin, Jerin Jacob

CC: Jianbo Liu <jianbo.liu@linaro.org>
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
---
 lib/librte_eal/common/include/arch/arm/rte_pause.h |  4 ++
 .../common/include/arch/arm/rte_pause_64.h         | 55 ++++++++++++++++++++++
 2 files changed, 59 insertions(+)
 create mode 100644 lib/librte_eal/common/include/arch/arm/rte_pause_64.h

diff --git a/lib/librte_eal/common/include/arch/arm/rte_pause.h b/lib/librte_eal/common/include/arch/arm/rte_pause.h
index 0fe88aba9..9b79405e6 100644
--- a/lib/librte_eal/common/include/arch/arm/rte_pause.h
+++ b/lib/librte_eal/common/include/arch/arm/rte_pause.h
@@ -37,7 +37,11 @@
 extern "C" {
 #endif
 
+#ifdef RTE_ARCH_64
+#include <rte_pause_64.h>
+#else
 #include <rte_pause_32.h>
+#endif
 
 #ifdef __cplusplus
 }
diff --git a/lib/librte_eal/common/include/arch/arm/rte_pause_64.h b/lib/librte_eal/common/include/arch/arm/rte_pause_64.h
new file mode 100644
index 000000000..cae996de8
--- /dev/null
+++ b/lib/librte_eal/common/include/arch/arm/rte_pause_64.h
@@ -0,0 +1,55 @@
+/*
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2017 Cavium. 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 Cavium 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.
+ */
+
+#ifndef _RTE_PAUSE_ARM64_H_
+#define _RTE_PAUSE_ARM64_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rte_common.h>
+#include "generic/rte_pause.h"
+
+static inline void rte_pause(void)
+{
+	/* YIELD hints the CPU to switch to another thread if possible
+	 * and executes as a NOP otherwise.
+	 */
+	asm volatile("yield" ::: "memory");
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_PAUSE_ARM64_H_ */
-- 
2.12.2

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

* [PATCH 4/6] eal/x86: rte pause implementation for x86
  2017-05-11 10:10 [PATCH 1/6] eal: change rte pause as architecture specific function Jerin Jacob
  2017-05-11 10:10 ` [PATCH 2/6] eal/arm32: rte pause implementation for arm32 Jerin Jacob
  2017-05-11 10:10 ` [PATCH 3/6] eal/arm64: rte pause implementation for arm64 Jerin Jacob
@ 2017-05-11 10:10 ` Jerin Jacob
  2017-05-11 10:10 ` [PATCH 5/6] eal/ppc64: rte pause implementation for ppc64 Jerin Jacob
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 20+ messages in thread
From: Jerin Jacob @ 2017-05-11 10:10 UTC (permalink / raw)
  To: dev
  Cc: thomas, jianbo.liu, viktorin, Jerin Jacob, Bruce Richardson,
	Konstantin Ananyev

The patch does not provide any functional change for x86
with respect to existing rte_pause() definition.

CC: Bruce Richardson <bruce.richardson@intel.com>
CC: Konstantin Ananyev <konstantin.ananyev@intel.com>
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
---
 lib/librte_eal/common/include/arch/x86/rte_pause.h | 59 ++++++++++++++++++++++
 1 file changed, 59 insertions(+)
 create mode 100644 lib/librte_eal/common/include/arch/x86/rte_pause.h

diff --git a/lib/librte_eal/common/include/arch/x86/rte_pause.h b/lib/librte_eal/common/include/arch/x86/rte_pause.h
new file mode 100644
index 000000000..22b879a7b
--- /dev/null
+++ b/lib/librte_eal/common/include/arch/x86/rte_pause.h
@@ -0,0 +1,59 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) Cavium. 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 Cavium 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.
+ */
+
+#ifndef _RTE_PAUSE_X86_H_
+#define _RTE_PAUSE_X86_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "generic/rte_pause.h"
+
+#ifdef __SSE2__
+#include <emmintrin.h>
+static inline void rte_pause(void)
+{
+	_mm_pause();
+}
+#else
+static inline void rte_pause(void)
+{
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_PAUSE_X86_H_ */
-- 
2.12.2

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

* [PATCH 5/6] eal/ppc64: rte pause implementation for ppc64
  2017-05-11 10:10 [PATCH 1/6] eal: change rte pause as architecture specific function Jerin Jacob
                   ` (2 preceding siblings ...)
  2017-05-11 10:10 ` [PATCH 4/6] eal/x86: rte pause implementation for x86 Jerin Jacob
@ 2017-05-11 10:10 ` Jerin Jacob
  2017-05-18  6:35   ` Chao Zhu
  2017-05-11 10:10 ` [PATCH 6/6] eal: switchover to architecture specific rte pause function Jerin Jacob
  2017-06-05  8:58 ` [PATCH v2 1/6] eal: change rte pause as architecture specific function Jerin Jacob
  5 siblings, 1 reply; 20+ messages in thread
From: Jerin Jacob @ 2017-05-11 10:10 UTC (permalink / raw)
  To: dev; +Cc: thomas, jianbo.liu, viktorin, Jerin Jacob, Chao Zhu

The patch does not provide any functional change for ppc64
with respect to existing rte_pause() definition.

CC: Chao Zhu <chaozhu@linux.vnet.ibm.com>
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
---
 .../common/include/arch/ppc_64/rte_pause.h         | 51 ++++++++++++++++++++++
 1 file changed, 51 insertions(+)
 create mode 100644 lib/librte_eal/common/include/arch/ppc_64/rte_pause.h

diff --git a/lib/librte_eal/common/include/arch/ppc_64/rte_pause.h b/lib/librte_eal/common/include/arch/ppc_64/rte_pause.h
new file mode 100644
index 000000000..489cf2f13
--- /dev/null
+++ b/lib/librte_eal/common/include/arch/ppc_64/rte_pause.h
@@ -0,0 +1,51 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) Cavium. 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 Cavium 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.
+ */
+
+#ifndef _RTE_PAUSE_PPC64_H_
+#define _RTE_PAUSE_PPC64_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "generic/rte_pause.h"
+
+static inline void rte_pause(void)
+{
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_PAUSE_PPC64_H_ */
-- 
2.12.2

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

* [PATCH 6/6] eal: switchover to architecture specific rte pause function
  2017-05-11 10:10 [PATCH 1/6] eal: change rte pause as architecture specific function Jerin Jacob
                   ` (3 preceding siblings ...)
  2017-05-11 10:10 ` [PATCH 5/6] eal/ppc64: rte pause implementation for ppc64 Jerin Jacob
@ 2017-05-11 10:10 ` Jerin Jacob
  2017-06-05  8:58 ` [PATCH v2 1/6] eal: change rte pause as architecture specific function Jerin Jacob
  5 siblings, 0 replies; 20+ messages in thread
From: Jerin Jacob @ 2017-05-11 10:10 UTC (permalink / raw)
  To: dev; +Cc: thomas, jianbo.liu, viktorin, Jerin Jacob

Remove rte_pause() definition from rte_common.h and
switchover to architecture specific rte_pause.h

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
---
 examples/distributor/main.c                              |  1 +
 examples/l2fwd-jobstats/main.c                           |  1 +
 examples/performance-thread/l3fwd-thread/main.c          |  1 +
 examples/tep_termination/main.c                          |  1 +
 examples/vhost/main.c                                    |  1 +
 examples/vhost_xen/main.c                                |  1 +
 lib/librte_distributor/rte_distributor.c                 |  2 ++
 lib/librte_distributor/rte_distributor_v20.c             |  2 ++
 lib/librte_eal/common/eal_common_timer.c                 |  1 +
 lib/librte_eal/common/include/arch/ppc_64/rte_spinlock.h |  1 +
 lib/librte_eal/common/include/arch/x86/rte_spinlock.h    |  1 +
 lib/librte_eal/common/include/generic/rte_rwlock.h       |  1 +
 lib/librte_eal/common/include/generic/rte_spinlock.h     |  1 +
 lib/librte_eal/common/include/rte_common.h               | 15 ---------------
 lib/librte_eal/common/include/rte_eal_memconfig.h        |  1 +
 lib/librte_eal/linuxapp/eal/eal_interrupts.c             |  1 +
 lib/librte_hash/rte_cuckoo_hash.c                        |  1 +
 lib/librte_ring/rte_ring.h                               |  1 +
 lib/librte_timer/rte_timer.c                             |  1 +
 test/test/test_common.c                                  |  1 +
 test/test/test_cryptodev.c                               |  1 +
 test/test/test_cryptodev_blockcipher.c                   |  1 +
 test/test/test_distributor_perf.c                        |  1 +
 test/test/test_eventdev_sw.c                             |  3 ++-
 test/test/test_ring_perf.c                               |  1 +
 test/test/test_timer.c                                   |  1 +
 test/test/test_timer_perf.c                              |  1 +
 test/test/test_timer_racecond.c                          |  1 +
 28 files changed, 30 insertions(+), 16 deletions(-)

diff --git a/examples/distributor/main.c b/examples/distributor/main.c
index 8071f9195..cf8982a71 100644
--- a/examples/distributor/main.c
+++ b/examples/distributor/main.c
@@ -43,6 +43,7 @@
 #include <rte_debug.h>
 #include <rte_prefetch.h>
 #include <rte_distributor.h>
+#include <rte_pause.h>
 
 #define RX_RING_SIZE 512
 #define TX_RING_SIZE 512
diff --git a/examples/l2fwd-jobstats/main.c b/examples/l2fwd-jobstats/main.c
index e6e6c2286..d21e8338e 100644
--- a/examples/l2fwd-jobstats/main.c
+++ b/examples/l2fwd-jobstats/main.c
@@ -67,6 +67,7 @@
 #include <rte_jobstats.h>
 #include <rte_timer.h>
 #include <rte_alarm.h>
+#include <rte_pause.h>
 
 #define RTE_LOGTYPE_L2FWD RTE_LOGTYPE_USER1
 
diff --git a/examples/performance-thread/l3fwd-thread/main.c b/examples/performance-thread/l3fwd-thread/main.c
index 2d98473eb..f24409a32 100644
--- a/examples/performance-thread/l3fwd-thread/main.c
+++ b/examples/performance-thread/l3fwd-thread/main.c
@@ -73,6 +73,7 @@
 #include <rte_tcp.h>
 #include <rte_udp.h>
 #include <rte_string_fns.h>
+#include <rte_pause.h>
 
 #include <cmdline_parse.h>
 #include <cmdline_parse_etheraddr.h>
diff --git a/examples/tep_termination/main.c b/examples/tep_termination/main.c
index cd6e3f1cf..224893413 100644
--- a/examples/tep_termination/main.c
+++ b/examples/tep_termination/main.c
@@ -50,6 +50,7 @@
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
 #include <rte_vhost.h>
+#include <rte_pause.h>
 
 #include "main.h"
 #include "vxlan.h"
diff --git a/examples/vhost/main.c b/examples/vhost/main.c
index e07f86693..076935bf5 100644
--- a/examples/vhost/main.c
+++ b/examples/vhost/main.c
@@ -52,6 +52,7 @@
 #include <rte_vhost.h>
 #include <rte_ip.h>
 #include <rte_tcp.h>
+#include <rte_pause.h>
 
 #include "main.h"
 
diff --git a/examples/vhost_xen/main.c b/examples/vhost_xen/main.c
index d9ef140f7..e5166214c 100644
--- a/examples/vhost_xen/main.c
+++ b/examples/vhost_xen/main.c
@@ -48,6 +48,7 @@
 #include <rte_ethdev.h>
 #include <rte_log.h>
 #include <rte_string_fns.h>
+#include <rte_pause.h>
 
 #include "main.h"
 #include "virtio-net.h"
diff --git a/lib/librte_distributor/rte_distributor.c b/lib/librte_distributor/rte_distributor.c
index e4dfa7f0e..32dd18edc 100644
--- a/lib/librte_distributor/rte_distributor.c
+++ b/lib/librte_distributor/rte_distributor.c
@@ -42,6 +42,8 @@
 #include <rte_string_fns.h>
 #include <rte_eal_memconfig.h>
 #include <rte_compat.h>
+#include <rte_pause.h>
+
 #include "rte_distributor_private.h"
 #include "rte_distributor.h"
 #include "rte_distributor_v20.h"
diff --git a/lib/librte_distributor/rte_distributor_v20.c b/lib/librte_distributor/rte_distributor_v20.c
index bb6c5d709..b09abecd5 100644
--- a/lib/librte_distributor/rte_distributor_v20.c
+++ b/lib/librte_distributor/rte_distributor_v20.c
@@ -41,6 +41,8 @@
 #include <rte_compat.h>
 #include <rte_string_fns.h>
 #include <rte_eal_memconfig.h>
+#include <rte_pause.h>
+
 #include "rte_distributor_v20.h"
 #include "rte_distributor_private.h"
 
diff --git a/lib/librte_eal/common/eal_common_timer.c b/lib/librte_eal/common/eal_common_timer.c
index 72656176e..ed0b16d05 100644
--- a/lib/librte_eal/common/eal_common_timer.c
+++ b/lib/librte_eal/common/eal_common_timer.c
@@ -41,6 +41,7 @@
 #include <rte_common.h>
 #include <rte_log.h>
 #include <rte_cycles.h>
+#include <rte_pause.h>
 
 #include "eal_private.h"
 
diff --git a/lib/librte_eal/common/include/arch/ppc_64/rte_spinlock.h b/lib/librte_eal/common/include/arch/ppc_64/rte_spinlock.h
index af139c9d3..39815d9ee 100644
--- a/lib/librte_eal/common/include/arch/ppc_64/rte_spinlock.h
+++ b/lib/librte_eal/common/include/arch/ppc_64/rte_spinlock.h
@@ -38,6 +38,7 @@ extern "C" {
 #endif
 
 #include <rte_common.h>
+#include <rte_pause.h>
 #include "generic/rte_spinlock.h"
 
 /* Fixme: Use intrinsics to implement the spinlock on Power architecture */
diff --git a/lib/librte_eal/common/include/arch/x86/rte_spinlock.h b/lib/librte_eal/common/include/arch/x86/rte_spinlock.h
index 8e630c219..5675c2b45 100644
--- a/lib/librte_eal/common/include/arch/x86/rte_spinlock.h
+++ b/lib/librte_eal/common/include/arch/x86/rte_spinlock.h
@@ -43,6 +43,7 @@ extern "C" {
 #include "rte_cpuflags.h"
 #include "rte_branch_prediction.h"
 #include "rte_common.h"
+#include "rte_pause.h"
 
 #define RTE_RTM_MAX_RETRIES (10)
 #define RTE_XABORT_LOCK_BUSY (0xff)
diff --git a/lib/librte_eal/common/include/generic/rte_rwlock.h b/lib/librte_eal/common/include/generic/rte_rwlock.h
index 7a0fdc55c..fdb3113d3 100644
--- a/lib/librte_eal/common/include/generic/rte_rwlock.h
+++ b/lib/librte_eal/common/include/generic/rte_rwlock.h
@@ -52,6 +52,7 @@ extern "C" {
 
 #include <rte_common.h>
 #include <rte_atomic.h>
+#include <rte_pause.h>
 
 /**
  * The rte_rwlock_t type.
diff --git a/lib/librte_eal/common/include/generic/rte_spinlock.h b/lib/librte_eal/common/include/generic/rte_spinlock.h
index e51fc56ba..54f83a4c5 100644
--- a/lib/librte_eal/common/include/generic/rte_spinlock.h
+++ b/lib/librte_eal/common/include/generic/rte_spinlock.h
@@ -51,6 +51,7 @@
 #ifdef RTE_FORCE_INTRINSICS
 #include <rte_common.h>
 #endif
+#include <rte_pause.h>
 
 /**
  * The rte_spinlock_t type.
diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h
index e057f6e21..31d5021ec 100644
--- a/lib/librte_eal/common/include/rte_common.h
+++ b/lib/librte_eal/common/include/rte_common.h
@@ -294,21 +294,6 @@ rte_align64pow2(uint64_t v)
 
 /*********** Other general functions / macros ********/
 
-#ifdef __SSE2__
-#include <emmintrin.h>
-/**
- * PAUSE instruction for tight loops (avoid busy waiting)
- */
-static inline void
-rte_pause (void)
-{
-	_mm_pause();
-}
-#else
-static inline void
-rte_pause(void) {}
-#endif
-
 /**
  * Searches the input parameter for the least significant set bit
  * (starting from zero).
diff --git a/lib/librte_eal/common/include/rte_eal_memconfig.h b/lib/librte_eal/common/include/rte_eal_memconfig.h
index 2b5e0b170..b9eee702e 100644
--- a/lib/librte_eal/common/include/rte_eal_memconfig.h
+++ b/lib/librte_eal/common/include/rte_eal_memconfig.h
@@ -39,6 +39,7 @@
 #include <rte_memzone.h>
 #include <rte_malloc_heap.h>
 #include <rte_rwlock.h>
+#include <rte_pause.h>
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/lib/librte_eal/linuxapp/eal/eal_interrupts.c b/lib/librte_eal/linuxapp/eal/eal_interrupts.c
index 2e3bd12a4..3e9ac41ee 100644
--- a/lib/librte_eal/linuxapp/eal/eal_interrupts.c
+++ b/lib/librte_eal/linuxapp/eal/eal_interrupts.c
@@ -64,6 +64,7 @@
 #include <rte_malloc.h>
 #include <rte_errno.h>
 #include <rte_spinlock.h>
+#include <rte_pause.h>
 
 #include "eal_private.h"
 #include "eal_vfio.h"
diff --git a/lib/librte_hash/rte_cuckoo_hash.c b/lib/librte_hash/rte_cuckoo_hash.c
index 645c0cfab..83444d39d 100644
--- a/lib/librte_hash/rte_cuckoo_hash.c
+++ b/lib/librte_hash/rte_cuckoo_hash.c
@@ -57,6 +57,7 @@
 #include <rte_spinlock.h>
 #include <rte_ring.h>
 #include <rte_compat.h>
+#include <rte_pause.h>
 
 #include "rte_hash.h"
 #include "rte_cuckoo_hash.h"
diff --git a/lib/librte_ring/rte_ring.h b/lib/librte_ring/rte_ring.h
index 97f025a1f..5f93cb7a6 100644
--- a/lib/librte_ring/rte_ring.h
+++ b/lib/librte_ring/rte_ring.h
@@ -101,6 +101,7 @@ extern "C" {
 #include <rte_atomic.h>
 #include <rte_branch_prediction.h>
 #include <rte_memzone.h>
+#include <rte_pause.h>
 
 #define RTE_TAILQ_RING_NAME "RTE_RING"
 
diff --git a/lib/librte_timer/rte_timer.c b/lib/librte_timer/rte_timer.c
index 18782fab0..9994f5515 100644
--- a/lib/librte_timer/rte_timer.c
+++ b/lib/librte_timer/rte_timer.c
@@ -51,6 +51,7 @@
 #include <rte_branch_prediction.h>
 #include <rte_spinlock.h>
 #include <rte_random.h>
+#include <rte_pause.h>
 
 #include "rte_timer.h"
 
diff --git a/test/test/test_common.c b/test/test/test_common.c
index 8effa2f9e..6e803f5d3 100644
--- a/test/test/test_common.c
+++ b/test/test/test_common.c
@@ -35,6 +35,7 @@
 #include <string.h>
 #include <rte_common.h>
 #include <rte_hexdump.h>
+#include <rte_pause.h>
 
 #include "test.h"
 
diff --git a/test/test/test_cryptodev.c b/test/test/test_cryptodev.c
index 029ce8a0f..671911a5d 100644
--- a/test/test/test_cryptodev.c
+++ b/test/test/test_cryptodev.c
@@ -35,6 +35,7 @@
 #include <rte_mbuf.h>
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
+#include <rte_pause.h>
 
 #include <rte_crypto.h>
 #include <rte_cryptodev.h>
diff --git a/test/test/test_cryptodev_blockcipher.c b/test/test/test_cryptodev_blockcipher.c
index 603c77652..ce350e39f 100644
--- a/test/test/test_cryptodev_blockcipher.c
+++ b/test/test/test_cryptodev_blockcipher.c
@@ -35,6 +35,7 @@
 #include <rte_mbuf.h>
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
+#include <rte_pause.h>
 
 #include <rte_crypto.h>
 #include <rte_cryptodev.h>
diff --git a/test/test/test_distributor_perf.c b/test/test/test_distributor_perf.c
index 732d86d0e..7d69887b9 100644
--- a/test/test/test_distributor_perf.c
+++ b/test/test/test_distributor_perf.c
@@ -40,6 +40,7 @@
 #include <rte_common.h>
 #include <rte_mbuf.h>
 #include <rte_distributor.h>
+#include <rte_pause.h>
 
 #define ITER_POWER_CL 25 /* log 2 of how many iterations  for Cache Line test */
 #define ITER_POWER 21 /* log 2 of how many iterations we do when timing. */
diff --git a/test/test/test_eventdev_sw.c b/test/test/test_eventdev_sw.c
index b187d0290..a17adbfbe 100644
--- a/test/test/test_eventdev_sw.c
+++ b/test/test/test_eventdev_sw.c
@@ -47,8 +47,9 @@
 #include <rte_debug.h>
 #include <rte_ethdev.h>
 #include <rte_cycles.h>
-
 #include <rte_eventdev.h>
+#include <rte_pause.h>
+
 #include "test.h"
 
 #define MAX_PORTS 16
diff --git a/test/test/test_ring_perf.c b/test/test/test_ring_perf.c
index ed89896b3..84d200332 100644
--- a/test/test/test_ring_perf.c
+++ b/test/test/test_ring_perf.c
@@ -37,6 +37,7 @@
 #include <rte_ring.h>
 #include <rte_cycles.h>
 #include <rte_launch.h>
+#include <rte_pause.h>
 
 #include "test.h"
 
diff --git a/test/test/test_timer.c b/test/test/test_timer.c
index 2f6525a50..de0c312fa 100644
--- a/test/test/test_timer.c
+++ b/test/test/test_timer.c
@@ -136,6 +136,7 @@
 #include <rte_timer.h>
 #include <rte_random.h>
 #include <rte_malloc.h>
+#include <rte_pause.h>
 
 #define TEST_DURATION_S 1 /* in seconds */
 #define NB_TIMER 4
diff --git a/test/test/test_timer_perf.c b/test/test/test_timer_perf.c
index fa77efbd2..467ae13da 100644
--- a/test/test/test_timer_perf.c
+++ b/test/test/test_timer_perf.c
@@ -42,6 +42,7 @@
 #include <rte_lcore.h>
 #include <rte_random.h>
 #include <rte_malloc.h>
+#include <rte_pause.h>
 
 #define MAX_ITERATIONS 1000000
 
diff --git a/test/test/test_timer_racecond.c b/test/test/test_timer_racecond.c
index 7824ec4bf..5e08f06be 100644
--- a/test/test/test_timer_racecond.c
+++ b/test/test/test_timer_racecond.c
@@ -42,6 +42,7 @@
 #include <rte_lcore.h>
 #include <rte_random.h>
 #include <rte_malloc.h>
+#include <rte_pause.h>
 
 #undef TEST_TIMER_RACECOND_VERBOSE
 
-- 
2.12.2

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

* Re: [PATCH 5/6] eal/ppc64: rte pause implementation for ppc64
  2017-05-11 10:10 ` [PATCH 5/6] eal/ppc64: rte pause implementation for ppc64 Jerin Jacob
@ 2017-05-18  6:35   ` Chao Zhu
  0 siblings, 0 replies; 20+ messages in thread
From: Chao Zhu @ 2017-05-18  6:35 UTC (permalink / raw)
  To: 'Jerin Jacob', dev; +Cc: thomas, jianbo.liu, viktorin

> -----Original Message-----
> From: Jerin Jacob [mailto:jerin.jacob@caviumnetworks.com]
> Sent: 2017年5月11日 18:11
> To: dev@dpdk.org
> Cc: thomas@monjalon.net; jianbo.liu@linaro.org; viktorin@rehivetech.com;
> Jerin Jacob <jerin.jacob@caviumnetworks.com>; Chao Zhu
> <chaozhu@linux.vnet.ibm.com>
> Subject: [dpdk-dev] [PATCH 5/6] eal/ppc64: rte pause implementation for
ppc64
> 
> The patch does not provide any functional change for ppc64 with respect to
> existing rte_pause() definition.
> 
> CC: Chao Zhu <chaozhu@linux.vnet.ibm.com>
> Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> ---
>  .../common/include/arch/ppc_64/rte_pause.h         | 51
> ++++++++++++++++++++++
>  1 file changed, 51 insertions(+)
>  create mode 100644 lib/librte_eal/common/include/arch/ppc_64/rte_pause.h
> 
> diff --git a/lib/librte_eal/common/include/arch/ppc_64/rte_pause.h
> b/lib/librte_eal/common/include/arch/ppc_64/rte_pause.h
> new file mode 100644
> index 000000000..489cf2f13
> --- /dev/null
> +++ b/lib/librte_eal/common/include/arch/ppc_64/rte_pause.h
> @@ -0,0 +1,51 @@
> +/*-
> + *   BSD LICENSE
> + *
> + *   Copyright(c) Cavium. 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 Cavium 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.
> + */
> +
> +#ifndef _RTE_PAUSE_PPC64_H_
> +#define _RTE_PAUSE_PPC64_H_
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +#include "generic/rte_pause.h"
> +
> +static inline void rte_pause(void)
> +{
> +}
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif /* _RTE_PAUSE_PPC64_H_ */
> --
> 2.12.2

Acked-by: Chao Zhu <chaozhu@linux.vnet.ibm.com>

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

* Re: [PATCH 2/6] eal/arm32: rte pause implementation for arm32
  2017-05-11 10:10 ` [PATCH 2/6] eal/arm32: rte pause implementation for arm32 Jerin Jacob
@ 2017-05-18  8:11   ` Jan Viktorin
  2017-05-18  9:14     ` Jianbo Liu
  0 siblings, 1 reply; 20+ messages in thread
From: Jan Viktorin @ 2017-05-18  8:11 UTC (permalink / raw)
  To: Jerin Jacob; +Cc: dev, thomas, jianbo.liu

On Thu, 11 May 2017 15:40:42 +0530
Jerin Jacob <jerin.jacob@caviumnetworks.com> wrote:

> The patch does not provide any functional change for ARM32
> with respect to existing rte_pause() definition.
> 
> CC: Jan Viktorin <viktorin@rehivetech.com>
> CC: Jianbo Liu <jianbo.liu@linaro.org>
> Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>

Acked-by: Jan Viktorin <viktorin@rehivetech.com>

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

* Re: [PATCH 2/6] eal/arm32: rte pause implementation for arm32
  2017-05-18  8:11   ` Jan Viktorin
@ 2017-05-18  9:14     ` Jianbo Liu
  0 siblings, 0 replies; 20+ messages in thread
From: Jianbo Liu @ 2017-05-18  9:14 UTC (permalink / raw)
  To: Jan Viktorin; +Cc: Jerin Jacob, dev, thomas

On 18 May 2017 at 16:11, Jan Viktorin <viktorin@rehivetech.com> wrote:
> On Thu, 11 May 2017 15:40:42 +0530
> Jerin Jacob <jerin.jacob@caviumnetworks.com> wrote:
>
>> The patch does not provide any functional change for ARM32
>> with respect to existing rte_pause() definition.
>>
>> CC: Jan Viktorin <viktorin@rehivetech.com>
>> CC: Jianbo Liu <jianbo.liu@linaro.org>
>> Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
>
> Acked-by: Jan Viktorin <viktorin@rehivetech.com>

Acked-by: Jianbo Liu <jianbo.liu@linaro.org>

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

* Re: [PATCH 3/6] eal/arm64: rte pause implementation for arm64
  2017-05-11 10:10 ` [PATCH 3/6] eal/arm64: rte pause implementation for arm64 Jerin Jacob
@ 2017-05-18  9:40   ` Jianbo Liu
  2017-05-18 10:16     ` Jerin Jacob
  0 siblings, 1 reply; 20+ messages in thread
From: Jianbo Liu @ 2017-05-18  9:40 UTC (permalink / raw)
  To: Jerin Jacob; +Cc: dev, thomas, Jan Viktorin

On 11 May 2017 at 18:10, Jerin Jacob <jerin.jacob@caviumnetworks.com> wrote:
> CC: Jianbo Liu <jianbo.liu@linaro.org>
> Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> ---
>  lib/librte_eal/common/include/arch/arm/rte_pause.h |  4 ++
>  .../common/include/arch/arm/rte_pause_64.h         | 55 ++++++++++++++++++++++
>  2 files changed, 59 insertions(+)
>  create mode 100644 lib/librte_eal/common/include/arch/arm/rte_pause_64.h
>
> diff --git a/lib/librte_eal/common/include/arch/arm/rte_pause.h b/lib/librte_eal/common/include/arch/arm/rte_pause.h
> index 0fe88aba9..9b79405e6 100644
> --- a/lib/librte_eal/common/include/arch/arm/rte_pause.h
> +++ b/lib/librte_eal/common/include/arch/arm/rte_pause.h
> @@ -37,7 +37,11 @@
>  extern "C" {
>  #endif
>
> +#ifdef RTE_ARCH_64
> +#include <rte_pause_64.h>
> +#else
>  #include <rte_pause_32.h>
> +#endif
>
>  #ifdef __cplusplus
>  }
> diff --git a/lib/librte_eal/common/include/arch/arm/rte_pause_64.h b/lib/librte_eal/common/include/arch/arm/rte_pause_64.h
> new file mode 100644
> index 000000000..cae996de8
> --- /dev/null
> +++ b/lib/librte_eal/common/include/arch/arm/rte_pause_64.h
> @@ -0,0 +1,55 @@
> +/*
> + *   BSD LICENSE
> + *
> + *   Copyright(c) 2017 Cavium. 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 Cavium 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.
> + */
> +
> +#ifndef _RTE_PAUSE_ARM64_H_
> +#define _RTE_PAUSE_ARM64_H_
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +#include <rte_common.h>
> +#include "generic/rte_pause.h"
> +
> +static inline void rte_pause(void)
> +{
> +       /* YIELD hints the CPU to switch to another thread if possible
> +        * and executes as a NOP otherwise.

I think you can remove the second line if you are trying to explain
what YIELD instruction is.
And I wonder if it can save power as rte_thread is bounded to certain
core and always polling while YIELD is only a hint instruction.

> +        */
> +       asm volatile("yield" ::: "memory");
> +}
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif /* _RTE_PAUSE_ARM64_H_ */
> --
> 2.12.2
>

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

* Re: [PATCH 3/6] eal/arm64: rte pause implementation for arm64
  2017-05-18  9:40   ` Jianbo Liu
@ 2017-05-18 10:16     ` Jerin Jacob
  2017-05-19  1:46       ` Jianbo Liu
  0 siblings, 1 reply; 20+ messages in thread
From: Jerin Jacob @ 2017-05-18 10:16 UTC (permalink / raw)
  To: Jianbo Liu; +Cc: dev, thomas, Jan Viktorin

-----Original Message-----
> Date: Thu, 18 May 2017 17:40:58 +0800
> From: Jianbo Liu <jianbo.liu@linaro.org>
> To: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> Cc: dev@dpdk.org, thomas@monjalon.net, Jan Viktorin
>  <viktorin@rehivetech.com>
> Subject: Re: [dpdk-dev] [PATCH 3/6] eal/arm64: rte pause implementation for
>  arm64
> 
> On 11 May 2017 at 18:10, Jerin Jacob <jerin.jacob@caviumnetworks.com> wrote:
> > CC: Jianbo Liu <jianbo.liu@linaro.org>
> > Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> > ---
> >  lib/librte_eal/common/include/arch/arm/rte_pause.h |  4 ++
> >  .../common/include/arch/arm/rte_pause_64.h         | 55 ++++++++++++++++++++++
> >  2 files changed, 59 insertions(+)
> >  create mode 100644 lib/librte_eal/common/include/arch/arm/rte_pause_64.h
> >
> > diff --git a/lib/librte_eal/common/include/arch/arm/rte_pause.h b/lib/librte_eal/common/include/arch/arm/rte_pause.h
> > index 0fe88aba9..9b79405e6 100644
> > --- a/lib/librte_eal/common/include/arch/arm/rte_pause.h
> > +++ b/lib/librte_eal/common/include/arch/arm/rte_pause.h
> > @@ -37,7 +37,11 @@
> >  extern "C" {
> >  #endif
> >
> > +#ifdef RTE_ARCH_64
> > +#include <rte_pause_64.h>
> > +#else
> >  #include <rte_pause_32.h>
> > +#endif
> >
> >  #ifdef __cplusplus
> >  }
> > diff --git a/lib/librte_eal/common/include/arch/arm/rte_pause_64.h b/lib/librte_eal/common/include/arch/arm/rte_pause_64.h
> > new file mode 100644
> > index 000000000..cae996de8
> > --- /dev/null
> > +++ b/lib/librte_eal/common/include/arch/arm/rte_pause_64.h
> > @@ -0,0 +1,55 @@
> > +/*
> > + *   BSD LICENSE
> > + *
> > + *   Copyright(c) 2017 Cavium. 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 Cavium 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.
> > + */
> > +
> > +#ifndef _RTE_PAUSE_ARM64_H_
> > +#define _RTE_PAUSE_ARM64_H_
> > +
> > +#ifdef __cplusplus
> > +extern "C" {
> > +#endif
> > +
> > +#include <rte_common.h>
> > +#include "generic/rte_pause.h"
> > +
> > +static inline void rte_pause(void)
> > +{
> > +       /* YIELD hints the CPU to switch to another thread if possible
> > +        * and executes as a NOP otherwise.
> 
> I think you can remove the second line if you are trying to explain
> what YIELD instruction is.
> And I wonder if it can save power as rte_thread is bounded to certain
> core and always polling while YIELD is only a hint instruction.

AFAIK, It is HW thread not software OS thread.ie Simultaneous Multi-Threading (SMT)
or Hyper threading.

For example, Cavium 99xx has 4 HW threads per physical core.

I agree on comment. I think, I can remove the comment as YIELD is just a hint
and varies based on arm64 implementation. Will fix it v2.

> 
> > +        */
> > +       asm volatile("yield" ::: "memory");
> > +}
> > +
> > +#ifdef __cplusplus
> > +}
> > +#endif
> > +
> > +#endif /* _RTE_PAUSE_ARM64_H_ */
> > --
> > 2.12.2
> >

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

* Re: [PATCH 3/6] eal/arm64: rte pause implementation for arm64
  2017-05-18 10:16     ` Jerin Jacob
@ 2017-05-19  1:46       ` Jianbo Liu
  0 siblings, 0 replies; 20+ messages in thread
From: Jianbo Liu @ 2017-05-19  1:46 UTC (permalink / raw)
  To: Jerin Jacob; +Cc: dev, thomas, Jan Viktorin

On 18 May 2017 at 18:16, Jerin Jacob <jerin.jacob@caviumnetworks.com> wrote:
> -----Original Message-----
>> Date: Thu, 18 May 2017 17:40:58 +0800
>> From: Jianbo Liu <jianbo.liu@linaro.org>
>> To: Jerin Jacob <jerin.jacob@caviumnetworks.com>
>> Cc: dev@dpdk.org, thomas@monjalon.net, Jan Viktorin
>>  <viktorin@rehivetech.com>
>> Subject: Re: [dpdk-dev] [PATCH 3/6] eal/arm64: rte pause implementation for
>>  arm64
>>
>> On 11 May 2017 at 18:10, Jerin Jacob <jerin.jacob@caviumnetworks.com> wrote:
>> > CC: Jianbo Liu <jianbo.liu@linaro.org>
>> > Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
>> > ---
>> >  lib/librte_eal/common/include/arch/arm/rte_pause.h |  4 ++
>> >  .../common/include/arch/arm/rte_pause_64.h         | 55 ++++++++++++++++++++++
>> >  2 files changed, 59 insertions(+)
>> >  create mode 100644 lib/librte_eal/common/include/arch/arm/rte_pause_64.h
>> >
>> > diff --git a/lib/librte_eal/common/include/arch/arm/rte_pause.h b/lib/librte_eal/common/include/arch/arm/rte_pause.h
>> > index 0fe88aba9..9b79405e6 100644
>> > --- a/lib/librte_eal/common/include/arch/arm/rte_pause.h
>> > +++ b/lib/librte_eal/common/include/arch/arm/rte_pause.h
>> > @@ -37,7 +37,11 @@
>> >  extern "C" {
>> >  #endif
>> >
>> > +#ifdef RTE_ARCH_64
>> > +#include <rte_pause_64.h>
>> > +#else
>> >  #include <rte_pause_32.h>
>> > +#endif
>> >
>> >  #ifdef __cplusplus
>> >  }
>> > diff --git a/lib/librte_eal/common/include/arch/arm/rte_pause_64.h b/lib/librte_eal/common/include/arch/arm/rte_pause_64.h
>> > new file mode 100644
>> > index 000000000..cae996de8
>> > --- /dev/null
>> > +++ b/lib/librte_eal/common/include/arch/arm/rte_pause_64.h
>> > @@ -0,0 +1,55 @@
>> > +/*
>> > + *   BSD LICENSE
>> > + *
>> > + *   Copyright(c) 2017 Cavium. 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 Cavium 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.
>> > + */
>> > +
>> > +#ifndef _RTE_PAUSE_ARM64_H_
>> > +#define _RTE_PAUSE_ARM64_H_
>> > +
>> > +#ifdef __cplusplus
>> > +extern "C" {
>> > +#endif
>> > +
>> > +#include <rte_common.h>
>> > +#include "generic/rte_pause.h"
>> > +
>> > +static inline void rte_pause(void)
>> > +{
>> > +       /* YIELD hints the CPU to switch to another thread if possible
>> > +        * and executes as a NOP otherwise.
>>
>> I think you can remove the second line if you are trying to explain
>> what YIELD instruction is.
>> And I wonder if it can save power as rte_thread is bounded to certain
>> core and always polling while YIELD is only a hint instruction.
>
> AFAIK, It is HW thread not software OS thread.ie Simultaneous Multi-Threading (SMT)
> or Hyper threading.
>

I read aarch64 ISA, and thought it's software thread.
It's likely each partner can extend more on its own implementation.

> For example, Cavium 99xx has 4 HW threads per physical core.
>
> I agree on comment. I think, I can remove the comment as YIELD is just a hint
> and varies based on arm64 implementation. Will fix it v2.
>

OK

>>
>> > +        */
>> > +       asm volatile("yield" ::: "memory");
>> > +}
>> > +
>> > +#ifdef __cplusplus
>> > +}
>> > +#endif
>> > +
>> > +#endif /* _RTE_PAUSE_ARM64_H_ */
>> > --
>> > 2.12.2
>> >

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

* [PATCH v2 1/6] eal: change rte pause as architecture specific function
  2017-05-11 10:10 [PATCH 1/6] eal: change rte pause as architecture specific function Jerin Jacob
                   ` (4 preceding siblings ...)
  2017-05-11 10:10 ` [PATCH 6/6] eal: switchover to architecture specific rte pause function Jerin Jacob
@ 2017-06-05  8:58 ` Jerin Jacob
  2017-06-05  8:58   ` [PATCH v2 2/6] eal/arm32: rte pause implementation for arm32 Jerin Jacob
                     ` (5 more replies)
  5 siblings, 6 replies; 20+ messages in thread
From: Jerin Jacob @ 2017-06-05  8:58 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson, Jerin Jacob

Each architecture may have different instructions for optimized
and power consumption aware rte_pause() implementation.

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
---
 doc/api/doxy-api-index.md                         |  3 +-
 lib/librte_eal/common/Makefile                    |  2 +-
 lib/librte_eal/common/include/generic/rte_pause.h | 52 +++++++++++++++++++++++
 3 files changed, 55 insertions(+), 2 deletions(-)
 create mode 100644 lib/librte_eal/common/include/generic/rte_pause.h

diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md
index f5f1f199f..a6f3fedd4 100644
--- a/doc/api/doxy-api-index.md
+++ b/doc/api/doxy-api-index.md
@@ -77,7 +77,8 @@ There are many libraries, so their headers may be grouped by topics:
   [SIMD]               (@ref rte_vect.h),
   [byte order]         (@ref rte_byteorder.h),
   [CPU flags]          (@ref rte_cpuflags.h),
-  [I/O access]         (@ref rte_io.h)
+  [I/O access]         (@ref rte_io.h),
+  [cpu pause]          (@ref rte_pause.h)
 
 - **CPU multicore**:
   [interrupts]         (@ref rte_interrupts.h),
diff --git a/lib/librte_eal/common/Makefile b/lib/librte_eal/common/Makefile
index a5bd1089a..fb1e2aab6 100644
--- a/lib/librte_eal/common/Makefile
+++ b/lib/librte_eal/common/Makefile
@@ -44,7 +44,7 @@ INC += rte_malloc.h rte_keepalive.h rte_time.h
 
 GENERIC_INC := rte_atomic.h rte_byteorder.h rte_cycles.h rte_prefetch.h
 GENERIC_INC += rte_spinlock.h rte_memcpy.h rte_cpuflags.h rte_rwlock.h
-GENERIC_INC += rte_vect.h rte_io.h
+GENERIC_INC += rte_vect.h rte_io.h rte_pause.h
 
 # defined in mk/arch/$(RTE_ARCH)/rte.vars.mk
 ARCH_DIR ?= $(RTE_ARCH)
diff --git a/lib/librte_eal/common/include/generic/rte_pause.h b/lib/librte_eal/common/include/generic/rte_pause.h
new file mode 100644
index 000000000..9625e580c
--- /dev/null
+++ b/lib/librte_eal/common/include/generic/rte_pause.h
@@ -0,0 +1,52 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2017 Cavium. 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 Cavium 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.
+ */
+
+#ifndef _RTE_PAUSE_H_
+#define _RTE_PAUSE_H_
+
+/**
+ * @file
+ *
+ * CPU pause operation.
+ *
+ */
+
+/**
+ * Pause CPU execution for a short while
+ *
+ * This call is intended for tight loops which poll a shared resource or wait
+ * for an event. A short pause within the loop may reduce the power consumption.
+ */
+static inline void rte_pause(void);
+
+#endif /* _RTE_PAUSE_H_ */
-- 
2.13.0

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

* [PATCH v2 2/6] eal/arm32: rte pause implementation for arm32
  2017-06-05  8:58 ` [PATCH v2 1/6] eal: change rte pause as architecture specific function Jerin Jacob
@ 2017-06-05  8:58   ` Jerin Jacob
  2017-06-05  8:58   ` [PATCH v2 3/6] eal/arm64: rte pause implementation for arm64 Jerin Jacob
                     ` (4 subsequent siblings)
  5 siblings, 0 replies; 20+ messages in thread
From: Jerin Jacob @ 2017-06-05  8:58 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson, Jerin Jacob, Jan Viktorin, Jianbo Liu

The patch does not provide any functional change for ARM32
with respect to existing rte_pause() definition.

CC: Jan Viktorin <viktorin@rehivetech.com>
CC: Jianbo Liu <jianbo.liu@linaro.org>
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Jan Viktorin <viktorin@rehivetech.com>
Acked-by: Jianbo Liu <jianbo.liu@linaro.org>
---
 lib/librte_eal/common/include/arch/arm/rte_pause.h | 46 +++++++++++++++++++
 .../common/include/arch/arm/rte_pause_32.h         | 51 ++++++++++++++++++++++
 2 files changed, 97 insertions(+)
 create mode 100644 lib/librte_eal/common/include/arch/arm/rte_pause.h
 create mode 100644 lib/librte_eal/common/include/arch/arm/rte_pause_32.h

diff --git a/lib/librte_eal/common/include/arch/arm/rte_pause.h b/lib/librte_eal/common/include/arch/arm/rte_pause.h
new file mode 100644
index 000000000..0fe88aba9
--- /dev/null
+++ b/lib/librte_eal/common/include/arch/arm/rte_pause.h
@@ -0,0 +1,46 @@
+/*
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2017 Cavium. 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 Cavium 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.
+ */
+
+#ifndef _RTE_PAUSE_ARM_H_
+#define _RTE_PAUSE_ARM_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rte_pause_32.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_PAUSE_ARM_H_ */
diff --git a/lib/librte_eal/common/include/arch/arm/rte_pause_32.h b/lib/librte_eal/common/include/arch/arm/rte_pause_32.h
new file mode 100644
index 000000000..cfe31d8ba
--- /dev/null
+++ b/lib/librte_eal/common/include/arch/arm/rte_pause_32.h
@@ -0,0 +1,51 @@
+/*
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2017 Cavium. 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 Cavium 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.
+ */
+
+#ifndef _RTE_PAUSE_ARM32_H_
+#define _RTE_PAUSE_ARM32_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rte_common.h>
+#include "generic/rte_pause.h"
+
+static inline void rte_pause(void)
+{
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_PAUSE_ARM32_H_ */
-- 
2.13.0

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

* [PATCH v2 3/6] eal/arm64: rte pause implementation for arm64
  2017-06-05  8:58 ` [PATCH v2 1/6] eal: change rte pause as architecture specific function Jerin Jacob
  2017-06-05  8:58   ` [PATCH v2 2/6] eal/arm32: rte pause implementation for arm32 Jerin Jacob
@ 2017-06-05  8:58   ` Jerin Jacob
  2017-06-06  1:36     ` Jianbo Liu
  2017-06-05  8:58   ` [PATCH v2 4/6] eal/x86: rte pause implementation for x86 Jerin Jacob
                     ` (3 subsequent siblings)
  5 siblings, 1 reply; 20+ messages in thread
From: Jerin Jacob @ 2017-06-05  8:58 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson, Jerin Jacob, Jianbo Liu

CC: Jianbo Liu <jianbo.liu@linaro.org>
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
---
v2:
- Removed YEILD instruction comment, as it is an implementation specific(Jianbo)
---
 lib/librte_eal/common/include/arch/arm/rte_pause.h |  4 ++
 .../common/include/arch/arm/rte_pause_64.h         | 52 ++++++++++++++++++++++
 2 files changed, 56 insertions(+)
 create mode 100644 lib/librte_eal/common/include/arch/arm/rte_pause_64.h

diff --git a/lib/librte_eal/common/include/arch/arm/rte_pause.h b/lib/librte_eal/common/include/arch/arm/rte_pause.h
index 0fe88aba9..9b79405e6 100644
--- a/lib/librte_eal/common/include/arch/arm/rte_pause.h
+++ b/lib/librte_eal/common/include/arch/arm/rte_pause.h
@@ -37,7 +37,11 @@
 extern "C" {
 #endif
 
+#ifdef RTE_ARCH_64
+#include <rte_pause_64.h>
+#else
 #include <rte_pause_32.h>
+#endif
 
 #ifdef __cplusplus
 }
diff --git a/lib/librte_eal/common/include/arch/arm/rte_pause_64.h b/lib/librte_eal/common/include/arch/arm/rte_pause_64.h
new file mode 100644
index 000000000..4101553e2
--- /dev/null
+++ b/lib/librte_eal/common/include/arch/arm/rte_pause_64.h
@@ -0,0 +1,52 @@
+/*
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2017 Cavium. 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 Cavium 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.
+ */
+
+#ifndef _RTE_PAUSE_ARM64_H_
+#define _RTE_PAUSE_ARM64_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rte_common.h>
+#include "generic/rte_pause.h"
+
+static inline void rte_pause(void)
+{
+	asm volatile("yield" ::: "memory");
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_PAUSE_ARM64_H_ */
-- 
2.13.0

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

* [PATCH v2 4/6] eal/x86: rte pause implementation for x86
  2017-06-05  8:58 ` [PATCH v2 1/6] eal: change rte pause as architecture specific function Jerin Jacob
  2017-06-05  8:58   ` [PATCH v2 2/6] eal/arm32: rte pause implementation for arm32 Jerin Jacob
  2017-06-05  8:58   ` [PATCH v2 3/6] eal/arm64: rte pause implementation for arm64 Jerin Jacob
@ 2017-06-05  8:58   ` Jerin Jacob
  2017-06-05  8:58   ` [PATCH v2 5/6] eal/ppc64: rte pause implementation for ppc64 Jerin Jacob
                     ` (2 subsequent siblings)
  5 siblings, 0 replies; 20+ messages in thread
From: Jerin Jacob @ 2017-06-05  8:58 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson, Jerin Jacob, Konstantin Ananyev

The patch does not provide any functional change for x86
with respect to existing rte_pause() definition.

CC: Bruce Richardson <bruce.richardson@intel.com>
CC: Konstantin Ananyev <konstantin.ananyev@intel.com>
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
---
 lib/librte_eal/common/include/arch/x86/rte_pause.h | 59 ++++++++++++++++++++++
 1 file changed, 59 insertions(+)
 create mode 100644 lib/librte_eal/common/include/arch/x86/rte_pause.h

diff --git a/lib/librte_eal/common/include/arch/x86/rte_pause.h b/lib/librte_eal/common/include/arch/x86/rte_pause.h
new file mode 100644
index 000000000..22b879a7b
--- /dev/null
+++ b/lib/librte_eal/common/include/arch/x86/rte_pause.h
@@ -0,0 +1,59 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) Cavium. 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 Cavium 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.
+ */
+
+#ifndef _RTE_PAUSE_X86_H_
+#define _RTE_PAUSE_X86_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "generic/rte_pause.h"
+
+#ifdef __SSE2__
+#include <emmintrin.h>
+static inline void rte_pause(void)
+{
+	_mm_pause();
+}
+#else
+static inline void rte_pause(void)
+{
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_PAUSE_X86_H_ */
-- 
2.13.0

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

* [PATCH v2 5/6] eal/ppc64: rte pause implementation for ppc64
  2017-06-05  8:58 ` [PATCH v2 1/6] eal: change rte pause as architecture specific function Jerin Jacob
                     ` (2 preceding siblings ...)
  2017-06-05  8:58   ` [PATCH v2 4/6] eal/x86: rte pause implementation for x86 Jerin Jacob
@ 2017-06-05  8:58   ` Jerin Jacob
  2017-06-05  8:58   ` [PATCH v2 6/6] eal: switchover to architecture specific rte pause function Jerin Jacob
  2017-07-03 21:59   ` [PATCH v2 1/6] eal: change rte pause as architecture specific function Thomas Monjalon
  5 siblings, 0 replies; 20+ messages in thread
From: Jerin Jacob @ 2017-06-05  8:58 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson, Jerin Jacob, Chao Zhu

The patch does not provide any functional change for ppc64
with respect to existing rte_pause() definition.

CC: Chao Zhu <chaozhu@linux.vnet.ibm.com>
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Chao Zhu <chaozhu@linux.vnet.ibm.com>
---
 .../common/include/arch/ppc_64/rte_pause.h         | 51 ++++++++++++++++++++++
 1 file changed, 51 insertions(+)
 create mode 100644 lib/librte_eal/common/include/arch/ppc_64/rte_pause.h

diff --git a/lib/librte_eal/common/include/arch/ppc_64/rte_pause.h b/lib/librte_eal/common/include/arch/ppc_64/rte_pause.h
new file mode 100644
index 000000000..489cf2f13
--- /dev/null
+++ b/lib/librte_eal/common/include/arch/ppc_64/rte_pause.h
@@ -0,0 +1,51 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) Cavium. 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 Cavium 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.
+ */
+
+#ifndef _RTE_PAUSE_PPC64_H_
+#define _RTE_PAUSE_PPC64_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "generic/rte_pause.h"
+
+static inline void rte_pause(void)
+{
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_PAUSE_PPC64_H_ */
-- 
2.13.0

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

* [PATCH v2 6/6] eal: switchover to architecture specific rte pause function
  2017-06-05  8:58 ` [PATCH v2 1/6] eal: change rte pause as architecture specific function Jerin Jacob
                     ` (3 preceding siblings ...)
  2017-06-05  8:58   ` [PATCH v2 5/6] eal/ppc64: rte pause implementation for ppc64 Jerin Jacob
@ 2017-06-05  8:58   ` Jerin Jacob
  2017-07-03 21:59   ` [PATCH v2 1/6] eal: change rte pause as architecture specific function Thomas Monjalon
  5 siblings, 0 replies; 20+ messages in thread
From: Jerin Jacob @ 2017-06-05  8:58 UTC (permalink / raw)
  To: dev; +Cc: thomas, bruce.richardson, Jerin Jacob

Remove rte_pause() definition from rte_common.h and
switchover to architecture specific rte_pause.h

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
---
 examples/distributor/main.c                              |  1 +
 examples/l2fwd-jobstats/main.c                           |  1 +
 examples/performance-thread/l3fwd-thread/main.c          |  1 +
 examples/tep_termination/main.c                          |  1 +
 examples/vhost/main.c                                    |  1 +
 examples/vhost_xen/main.c                                |  1 +
 lib/librte_distributor/rte_distributor.c                 |  2 ++
 lib/librte_distributor/rte_distributor_v20.c             |  2 ++
 lib/librte_eal/common/eal_common_timer.c                 |  1 +
 lib/librte_eal/common/include/arch/ppc_64/rte_spinlock.h |  1 +
 lib/librte_eal/common/include/arch/x86/rte_spinlock.h    |  1 +
 lib/librte_eal/common/include/generic/rte_rwlock.h       |  1 +
 lib/librte_eal/common/include/generic/rte_spinlock.h     |  1 +
 lib/librte_eal/common/include/rte_common.h               | 15 ---------------
 lib/librte_eal/common/include/rte_eal_memconfig.h        |  1 +
 lib/librte_eal/linuxapp/eal/eal_interrupts.c             |  1 +
 lib/librte_hash/rte_cuckoo_hash.c                        |  1 +
 lib/librte_ring/rte_ring.h                               |  1 +
 lib/librte_timer/rte_timer.c                             |  1 +
 test/test/test_common.c                                  |  1 +
 test/test/test_cryptodev.c                               |  1 +
 test/test/test_cryptodev_blockcipher.c                   |  1 +
 test/test/test_distributor_perf.c                        |  1 +
 test/test/test_eventdev_sw.c                             |  3 ++-
 test/test/test_ring_perf.c                               |  1 +
 test/test/test_timer.c                                   |  1 +
 test/test/test_timer_perf.c                              |  1 +
 test/test/test_timer_racecond.c                          |  1 +
 28 files changed, 30 insertions(+), 16 deletions(-)

diff --git a/examples/distributor/main.c b/examples/distributor/main.c
index 8071f9195..cf8982a71 100644
--- a/examples/distributor/main.c
+++ b/examples/distributor/main.c
@@ -43,6 +43,7 @@
 #include <rte_debug.h>
 #include <rte_prefetch.h>
 #include <rte_distributor.h>
+#include <rte_pause.h>
 
 #define RX_RING_SIZE 512
 #define TX_RING_SIZE 512
diff --git a/examples/l2fwd-jobstats/main.c b/examples/l2fwd-jobstats/main.c
index e6e6c2286..d21e8338e 100644
--- a/examples/l2fwd-jobstats/main.c
+++ b/examples/l2fwd-jobstats/main.c
@@ -67,6 +67,7 @@
 #include <rte_jobstats.h>
 #include <rte_timer.h>
 #include <rte_alarm.h>
+#include <rte_pause.h>
 
 #define RTE_LOGTYPE_L2FWD RTE_LOGTYPE_USER1
 
diff --git a/examples/performance-thread/l3fwd-thread/main.c b/examples/performance-thread/l3fwd-thread/main.c
index ac85a369f..778adaf8a 100644
--- a/examples/performance-thread/l3fwd-thread/main.c
+++ b/examples/performance-thread/l3fwd-thread/main.c
@@ -73,6 +73,7 @@
 #include <rte_tcp.h>
 #include <rte_udp.h>
 #include <rte_string_fns.h>
+#include <rte_pause.h>
 
 #include <cmdline_parse.h>
 #include <cmdline_parse_etheraddr.h>
diff --git a/examples/tep_termination/main.c b/examples/tep_termination/main.c
index cd6e3f1cf..224893413 100644
--- a/examples/tep_termination/main.c
+++ b/examples/tep_termination/main.c
@@ -50,6 +50,7 @@
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
 #include <rte_vhost.h>
+#include <rte_pause.h>
 
 #include "main.h"
 #include "vxlan.h"
diff --git a/examples/vhost/main.c b/examples/vhost/main.c
index e07f86693..076935bf5 100644
--- a/examples/vhost/main.c
+++ b/examples/vhost/main.c
@@ -52,6 +52,7 @@
 #include <rte_vhost.h>
 #include <rte_ip.h>
 #include <rte_tcp.h>
+#include <rte_pause.h>
 
 #include "main.h"
 
diff --git a/examples/vhost_xen/main.c b/examples/vhost_xen/main.c
index d9ef140f7..e5166214c 100644
--- a/examples/vhost_xen/main.c
+++ b/examples/vhost_xen/main.c
@@ -48,6 +48,7 @@
 #include <rte_ethdev.h>
 #include <rte_log.h>
 #include <rte_string_fns.h>
+#include <rte_pause.h>
 
 #include "main.h"
 #include "virtio-net.h"
diff --git a/lib/librte_distributor/rte_distributor.c b/lib/librte_distributor/rte_distributor.c
index e4dfa7f0e..32dd18edc 100644
--- a/lib/librte_distributor/rte_distributor.c
+++ b/lib/librte_distributor/rte_distributor.c
@@ -42,6 +42,8 @@
 #include <rte_string_fns.h>
 #include <rte_eal_memconfig.h>
 #include <rte_compat.h>
+#include <rte_pause.h>
+
 #include "rte_distributor_private.h"
 #include "rte_distributor.h"
 #include "rte_distributor_v20.h"
diff --git a/lib/librte_distributor/rte_distributor_v20.c b/lib/librte_distributor/rte_distributor_v20.c
index bb6c5d709..b09abecd5 100644
--- a/lib/librte_distributor/rte_distributor_v20.c
+++ b/lib/librte_distributor/rte_distributor_v20.c
@@ -41,6 +41,8 @@
 #include <rte_compat.h>
 #include <rte_string_fns.h>
 #include <rte_eal_memconfig.h>
+#include <rte_pause.h>
+
 #include "rte_distributor_v20.h"
 #include "rte_distributor_private.h"
 
diff --git a/lib/librte_eal/common/eal_common_timer.c b/lib/librte_eal/common/eal_common_timer.c
index 72656176e..ed0b16d05 100644
--- a/lib/librte_eal/common/eal_common_timer.c
+++ b/lib/librte_eal/common/eal_common_timer.c
@@ -41,6 +41,7 @@
 #include <rte_common.h>
 #include <rte_log.h>
 #include <rte_cycles.h>
+#include <rte_pause.h>
 
 #include "eal_private.h"
 
diff --git a/lib/librte_eal/common/include/arch/ppc_64/rte_spinlock.h b/lib/librte_eal/common/include/arch/ppc_64/rte_spinlock.h
index af139c9d3..39815d9ee 100644
--- a/lib/librte_eal/common/include/arch/ppc_64/rte_spinlock.h
+++ b/lib/librte_eal/common/include/arch/ppc_64/rte_spinlock.h
@@ -38,6 +38,7 @@ extern "C" {
 #endif
 
 #include <rte_common.h>
+#include <rte_pause.h>
 #include "generic/rte_spinlock.h"
 
 /* Fixme: Use intrinsics to implement the spinlock on Power architecture */
diff --git a/lib/librte_eal/common/include/arch/x86/rte_spinlock.h b/lib/librte_eal/common/include/arch/x86/rte_spinlock.h
index 8e630c219..5675c2b45 100644
--- a/lib/librte_eal/common/include/arch/x86/rte_spinlock.h
+++ b/lib/librte_eal/common/include/arch/x86/rte_spinlock.h
@@ -43,6 +43,7 @@ extern "C" {
 #include "rte_cpuflags.h"
 #include "rte_branch_prediction.h"
 #include "rte_common.h"
+#include "rte_pause.h"
 
 #define RTE_RTM_MAX_RETRIES (10)
 #define RTE_XABORT_LOCK_BUSY (0xff)
diff --git a/lib/librte_eal/common/include/generic/rte_rwlock.h b/lib/librte_eal/common/include/generic/rte_rwlock.h
index 7a0fdc55c..fdb3113d3 100644
--- a/lib/librte_eal/common/include/generic/rte_rwlock.h
+++ b/lib/librte_eal/common/include/generic/rte_rwlock.h
@@ -52,6 +52,7 @@ extern "C" {
 
 #include <rte_common.h>
 #include <rte_atomic.h>
+#include <rte_pause.h>
 
 /**
  * The rte_rwlock_t type.
diff --git a/lib/librte_eal/common/include/generic/rte_spinlock.h b/lib/librte_eal/common/include/generic/rte_spinlock.h
index e51fc56ba..54f83a4c5 100644
--- a/lib/librte_eal/common/include/generic/rte_spinlock.h
+++ b/lib/librte_eal/common/include/generic/rte_spinlock.h
@@ -51,6 +51,7 @@
 #ifdef RTE_FORCE_INTRINSICS
 #include <rte_common.h>
 #endif
+#include <rte_pause.h>
 
 /**
  * The rte_spinlock_t type.
diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h
index e057f6e21..31d5021ec 100644
--- a/lib/librte_eal/common/include/rte_common.h
+++ b/lib/librte_eal/common/include/rte_common.h
@@ -294,21 +294,6 @@ rte_align64pow2(uint64_t v)
 
 /*********** Other general functions / macros ********/
 
-#ifdef __SSE2__
-#include <emmintrin.h>
-/**
- * PAUSE instruction for tight loops (avoid busy waiting)
- */
-static inline void
-rte_pause (void)
-{
-	_mm_pause();
-}
-#else
-static inline void
-rte_pause(void) {}
-#endif
-
 /**
  * Searches the input parameter for the least significant set bit
  * (starting from zero).
diff --git a/lib/librte_eal/common/include/rte_eal_memconfig.h b/lib/librte_eal/common/include/rte_eal_memconfig.h
index 2b5e0b170..b9eee702e 100644
--- a/lib/librte_eal/common/include/rte_eal_memconfig.h
+++ b/lib/librte_eal/common/include/rte_eal_memconfig.h
@@ -39,6 +39,7 @@
 #include <rte_memzone.h>
 #include <rte_malloc_heap.h>
 #include <rte_rwlock.h>
+#include <rte_pause.h>
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/lib/librte_eal/linuxapp/eal/eal_interrupts.c b/lib/librte_eal/linuxapp/eal/eal_interrupts.c
index 2e3bd12a4..3e9ac41ee 100644
--- a/lib/librte_eal/linuxapp/eal/eal_interrupts.c
+++ b/lib/librte_eal/linuxapp/eal/eal_interrupts.c
@@ -64,6 +64,7 @@
 #include <rte_malloc.h>
 #include <rte_errno.h>
 #include <rte_spinlock.h>
+#include <rte_pause.h>
 
 #include "eal_private.h"
 #include "eal_vfio.h"
diff --git a/lib/librte_hash/rte_cuckoo_hash.c b/lib/librte_hash/rte_cuckoo_hash.c
index 645c0cfab..83444d39d 100644
--- a/lib/librte_hash/rte_cuckoo_hash.c
+++ b/lib/librte_hash/rte_cuckoo_hash.c
@@ -57,6 +57,7 @@
 #include <rte_spinlock.h>
 #include <rte_ring.h>
 #include <rte_compat.h>
+#include <rte_pause.h>
 
 #include "rte_hash.h"
 #include "rte_cuckoo_hash.h"
diff --git a/lib/librte_ring/rte_ring.h b/lib/librte_ring/rte_ring.h
index 97f025a1f..5f93cb7a6 100644
--- a/lib/librte_ring/rte_ring.h
+++ b/lib/librte_ring/rte_ring.h
@@ -101,6 +101,7 @@ extern "C" {
 #include <rte_atomic.h>
 #include <rte_branch_prediction.h>
 #include <rte_memzone.h>
+#include <rte_pause.h>
 
 #define RTE_TAILQ_RING_NAME "RTE_RING"
 
diff --git a/lib/librte_timer/rte_timer.c b/lib/librte_timer/rte_timer.c
index 18782fab0..9994f5515 100644
--- a/lib/librte_timer/rte_timer.c
+++ b/lib/librte_timer/rte_timer.c
@@ -51,6 +51,7 @@
 #include <rte_branch_prediction.h>
 #include <rte_spinlock.h>
 #include <rte_random.h>
+#include <rte_pause.h>
 
 #include "rte_timer.h"
 
diff --git a/test/test/test_common.c b/test/test/test_common.c
index 8effa2f9e..6e803f5d3 100644
--- a/test/test/test_common.c
+++ b/test/test/test_common.c
@@ -35,6 +35,7 @@
 #include <string.h>
 #include <rte_common.h>
 #include <rte_hexdump.h>
+#include <rte_pause.h>
 
 #include "test.h"
 
diff --git a/test/test/test_cryptodev.c b/test/test/test_cryptodev.c
index 029ce8a0f..671911a5d 100644
--- a/test/test/test_cryptodev.c
+++ b/test/test/test_cryptodev.c
@@ -35,6 +35,7 @@
 #include <rte_mbuf.h>
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
+#include <rte_pause.h>
 
 #include <rte_crypto.h>
 #include <rte_cryptodev.h>
diff --git a/test/test/test_cryptodev_blockcipher.c b/test/test/test_cryptodev_blockcipher.c
index 603c77652..ce350e39f 100644
--- a/test/test/test_cryptodev_blockcipher.c
+++ b/test/test/test_cryptodev_blockcipher.c
@@ -35,6 +35,7 @@
 #include <rte_mbuf.h>
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
+#include <rte_pause.h>
 
 #include <rte_crypto.h>
 #include <rte_cryptodev.h>
diff --git a/test/test/test_distributor_perf.c b/test/test/test_distributor_perf.c
index 732d86d0e..7d69887b9 100644
--- a/test/test/test_distributor_perf.c
+++ b/test/test/test_distributor_perf.c
@@ -40,6 +40,7 @@
 #include <rte_common.h>
 #include <rte_mbuf.h>
 #include <rte_distributor.h>
+#include <rte_pause.h>
 
 #define ITER_POWER_CL 25 /* log 2 of how many iterations  for Cache Line test */
 #define ITER_POWER 21 /* log 2 of how many iterations we do when timing. */
diff --git a/test/test/test_eventdev_sw.c b/test/test/test_eventdev_sw.c
index b187d0290..a17adbfbe 100644
--- a/test/test/test_eventdev_sw.c
+++ b/test/test/test_eventdev_sw.c
@@ -47,8 +47,9 @@
 #include <rte_debug.h>
 #include <rte_ethdev.h>
 #include <rte_cycles.h>
-
 #include <rte_eventdev.h>
+#include <rte_pause.h>
+
 #include "test.h"
 
 #define MAX_PORTS 16
diff --git a/test/test/test_ring_perf.c b/test/test/test_ring_perf.c
index ed89896b3..84d200332 100644
--- a/test/test/test_ring_perf.c
+++ b/test/test/test_ring_perf.c
@@ -37,6 +37,7 @@
 #include <rte_ring.h>
 #include <rte_cycles.h>
 #include <rte_launch.h>
+#include <rte_pause.h>
 
 #include "test.h"
 
diff --git a/test/test/test_timer.c b/test/test/test_timer.c
index 2f6525a50..de0c312fa 100644
--- a/test/test/test_timer.c
+++ b/test/test/test_timer.c
@@ -136,6 +136,7 @@
 #include <rte_timer.h>
 #include <rte_random.h>
 #include <rte_malloc.h>
+#include <rte_pause.h>
 
 #define TEST_DURATION_S 1 /* in seconds */
 #define NB_TIMER 4
diff --git a/test/test/test_timer_perf.c b/test/test/test_timer_perf.c
index fa77efbd2..467ae13da 100644
--- a/test/test/test_timer_perf.c
+++ b/test/test/test_timer_perf.c
@@ -42,6 +42,7 @@
 #include <rte_lcore.h>
 #include <rte_random.h>
 #include <rte_malloc.h>
+#include <rte_pause.h>
 
 #define MAX_ITERATIONS 1000000
 
diff --git a/test/test/test_timer_racecond.c b/test/test/test_timer_racecond.c
index 7824ec4bf..5e08f06be 100644
--- a/test/test/test_timer_racecond.c
+++ b/test/test/test_timer_racecond.c
@@ -42,6 +42,7 @@
 #include <rte_lcore.h>
 #include <rte_random.h>
 #include <rte_malloc.h>
+#include <rte_pause.h>
 
 #undef TEST_TIMER_RACECOND_VERBOSE
 
-- 
2.13.0

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

* Re: [PATCH v2 3/6] eal/arm64: rte pause implementation for arm64
  2017-06-05  8:58   ` [PATCH v2 3/6] eal/arm64: rte pause implementation for arm64 Jerin Jacob
@ 2017-06-06  1:36     ` Jianbo Liu
  0 siblings, 0 replies; 20+ messages in thread
From: Jianbo Liu @ 2017-06-06  1:36 UTC (permalink / raw)
  To: Jerin Jacob; +Cc: dev, thomas, Bruce Richardson

On 5 June 2017 at 16:58, Jerin Jacob <jerin.jacob@caviumnetworks.com> wrote:
> CC: Jianbo Liu <jianbo.liu@linaro.org>
> Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> ---
> v2:
> - Removed YEILD instruction comment, as it is an implementation specific(Jianbo)
> ---
>  lib/librte_eal/common/include/arch/arm/rte_pause.h |  4 ++
>  .../common/include/arch/arm/rte_pause_64.h         | 52 ++++++++++++++++++++++
>  2 files changed, 56 insertions(+)
>  create mode 100644 lib/librte_eal/common/include/arch/arm/rte_pause_64.h
>
> diff --git a/lib/librte_eal/common/include/arch/arm/rte_pause.h b/lib/librte_eal/common/include/arch/arm/rte_pause.h
> index 0fe88aba9..9b79405e6 100644
> --- a/lib/librte_eal/common/include/arch/arm/rte_pause.h
> +++ b/lib/librte_eal/common/include/arch/arm/rte_pause.h
> @@ -37,7 +37,11 @@
>  extern "C" {
>  #endif
>
> +#ifdef RTE_ARCH_64
> +#include <rte_pause_64.h>
> +#else
>  #include <rte_pause_32.h>
> +#endif
>
>  #ifdef __cplusplus
>  }
> diff --git a/lib/librte_eal/common/include/arch/arm/rte_pause_64.h b/lib/librte_eal/common/include/arch/arm/rte_pause_64.h
> new file mode 100644
> index 000000000..4101553e2
> --- /dev/null
> +++ b/lib/librte_eal/common/include/arch/arm/rte_pause_64.h
> @@ -0,0 +1,52 @@
> +/*
> + *   BSD LICENSE
> + *
> + *   Copyright(c) 2017 Cavium. 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 Cavium 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.
> + */
> +
> +#ifndef _RTE_PAUSE_ARM64_H_
> +#define _RTE_PAUSE_ARM64_H_
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +#include <rte_common.h>
> +#include "generic/rte_pause.h"
> +
> +static inline void rte_pause(void)
> +{
> +       asm volatile("yield" ::: "memory");
> +}
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif /* _RTE_PAUSE_ARM64_H_ */
> --
> 2.13.0
>

Acked-by: Jianbo Liu <jianbo.liu@linaro.org>

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

* Re: [PATCH v2 1/6] eal: change rte pause as architecture specific function
  2017-06-05  8:58 ` [PATCH v2 1/6] eal: change rte pause as architecture specific function Jerin Jacob
                     ` (4 preceding siblings ...)
  2017-06-05  8:58   ` [PATCH v2 6/6] eal: switchover to architecture specific rte pause function Jerin Jacob
@ 2017-07-03 21:59   ` Thomas Monjalon
  5 siblings, 0 replies; 20+ messages in thread
From: Thomas Monjalon @ 2017-07-03 21:59 UTC (permalink / raw)
  To: Jerin Jacob; +Cc: dev

05/06/2017 10:58, Jerin Jacob:
> Each architecture may have different instructions for optimized
> and power consumption aware rte_pause() implementation.
> 
> Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>

Series applied, thanks

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

end of thread, other threads:[~2017-07-03 21:59 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-11 10:10 [PATCH 1/6] eal: change rte pause as architecture specific function Jerin Jacob
2017-05-11 10:10 ` [PATCH 2/6] eal/arm32: rte pause implementation for arm32 Jerin Jacob
2017-05-18  8:11   ` Jan Viktorin
2017-05-18  9:14     ` Jianbo Liu
2017-05-11 10:10 ` [PATCH 3/6] eal/arm64: rte pause implementation for arm64 Jerin Jacob
2017-05-18  9:40   ` Jianbo Liu
2017-05-18 10:16     ` Jerin Jacob
2017-05-19  1:46       ` Jianbo Liu
2017-05-11 10:10 ` [PATCH 4/6] eal/x86: rte pause implementation for x86 Jerin Jacob
2017-05-11 10:10 ` [PATCH 5/6] eal/ppc64: rte pause implementation for ppc64 Jerin Jacob
2017-05-18  6:35   ` Chao Zhu
2017-05-11 10:10 ` [PATCH 6/6] eal: switchover to architecture specific rte pause function Jerin Jacob
2017-06-05  8:58 ` [PATCH v2 1/6] eal: change rte pause as architecture specific function Jerin Jacob
2017-06-05  8:58   ` [PATCH v2 2/6] eal/arm32: rte pause implementation for arm32 Jerin Jacob
2017-06-05  8:58   ` [PATCH v2 3/6] eal/arm64: rte pause implementation for arm64 Jerin Jacob
2017-06-06  1:36     ` Jianbo Liu
2017-06-05  8:58   ` [PATCH v2 4/6] eal/x86: rte pause implementation for x86 Jerin Jacob
2017-06-05  8:58   ` [PATCH v2 5/6] eal/ppc64: rte pause implementation for ppc64 Jerin Jacob
2017-06-05  8:58   ` [PATCH v2 6/6] eal: switchover to architecture specific rte pause function Jerin Jacob
2017-07-03 21:59   ` [PATCH v2 1/6] eal: change rte pause as architecture specific function Thomas Monjalon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.