* [ptxdist] [PATCH v2] Added sockperf benchmarking utility
@ 2023-02-13 13:31 Sven Püschel
2023-02-17 15:35 ` [ptxdist] [APPLIED] " Michael Olbrich
0 siblings, 1 reply; 2+ messages in thread
From: Sven Püschel @ 2023-02-13 13:31 UTC (permalink / raw)
To: ptxdist; +Cc: Sven Püschel
Signed-off-by: Sven Püschel <s.pueschel@pengutronix.de>
---
.../0001-Fixed-AArch32-compilation.patch | 69 +++++++++++++++++++
patches/sockperf-3.10/series | 4 ++
rules/sockperf.in | 8 +++
rules/sockperf.make | 60 ++++++++++++++++
4 files changed, 141 insertions(+)
create mode 100644 patches/sockperf-3.10/0001-Fixed-AArch32-compilation.patch
create mode 100644 patches/sockperf-3.10/series
create mode 100644 rules/sockperf.in
create mode 100644 rules/sockperf.make
diff --git a/patches/sockperf-3.10/0001-Fixed-AArch32-compilation.patch b/patches/sockperf-3.10/0001-Fixed-AArch32-compilation.patch
new file mode 100644
index 000000000..5d15e2787
--- /dev/null
+++ b/patches/sockperf-3.10/0001-Fixed-AArch32-compilation.patch
@@ -0,0 +1,69 @@
+From: =?UTF-8?q?Sven=20P=C3=BCschel?= <s.pueschel@pengutronix.de>
+Date: Mon, 13 Feb 2023 10:16:51 +0100
+Subject: [PATCH] Fixed AArch32 compilation
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+sockperf added support for AArch64, but at the same time it broke AArch32 support,
+as this wasn't catched by a compiler macro anymore and resulted in trying to assemble a rdtsc instruction.
+
+See https://github.com/Mellanox/sockperf/commit/d84e8179f8ab007c7a19dfe263691b0429df7565
+and https://github.com/Mellanox/sockperf/pull/187
+
+Signed-off-by: Sven Püschel <s.pueschel@pengutronix.de>
+---
+ src/sockperf.cpp | 9 +++++++++
+ src/ticks_os.h | 5 +++++
+ 2 files changed, 14 insertions(+)
+
+diff --git a/src/sockperf.cpp b/src/sockperf.cpp
+index 293d21747592..5d6ee4141b35 100644
+--- a/src/sockperf.cpp
++++ b/src/sockperf.cpp
+@@ -2205,6 +2205,13 @@ static int parse_common_opt(const AOPT_OBJECT *common_obj) {
+ #endif /* DEFINED_TLS */
+ }
+
++#if defined(__arm__) && !defined(__aarch64__)
++ if (!s_user_params.b_no_rdtsc) {
++ log_msg("AArch32 target build does not support rdtsc, use --no-rdtsc");
++ rc = SOCKPERF_ERR_BAD_ARGUMENT;
++ }
++#endif
++
+ // resolve address: -i, -p and --tcp options must be processed before
+ if (!rc) {
+ int res = resolve_sockaddr(host_str, port_str, s_user_params.sock_type,
+@@ -3868,6 +3875,7 @@ packet pace limit = %d",
+ log_dbg("+INFO: taking time, using the given settings, consumes %.3lf nsec",
+ (double)(end - start).toNsec() / SIZE);
+
++#if !defined(__arm__) || defined(__aarch64__)
+ ticks_t tstart = 0, tend = 0;
+ tstart = os_gettimeoftsc();
+
+@@ -3878,6 +3886,7 @@ packet pace limit = %d",
+ double ticks_per_second = (double)get_tsc_rate_per_second();
+ log_dbg("+INFO: taking rdtsc directly consumes %.3lf nsec",
+ tdelta / SIZE * 1000 * 1000 * 1000 / ticks_per_second);
++#endif
+
+ // step #5: check is user defined a specific SEED value to be used in all rand() calls
+ // if no seed value is provided, the rand() function is automatically seeded with a value of
+diff --git a/src/ticks_os.h b/src/ticks_os.h
+index 0f23b2c6f6f5..8750e0374245 100644
+--- a/src/ticks_os.h
++++ b/src/ticks_os.h
+@@ -99,6 +99,11 @@ inline ticks_t os_gettimeoftsc() {
+ asm volatile("isb" : : : "memory");
+ asm volatile("mrs %0, cntvct_el0" : "=r" (ret));
+ return ret;
++#elif defined(__arm__)
++ // so the compiler will not complain. for
++ // AArch32 compile, this inline is not used
++ // since rdtsc is only supported in an optional timer extension
++ upper_32 = lower_32 = 0;
+ #else
+ // ReaD Time Stamp Counter (RDTCS)
+ __asm__ __volatile__("rdtsc" : "=a"(lower_32), "=d"(upper_32));
diff --git a/patches/sockperf-3.10/series b/patches/sockperf-3.10/series
new file mode 100644
index 000000000..5f59ae930
--- /dev/null
+++ b/patches/sockperf-3.10/series
@@ -0,0 +1,4 @@
+# generated by git-ptx-patches
+#tag:base --start-number 1
+0001-Fixed-AArch32-compilation.patch
+# 84265c4b5947716cec9ccf808fa7f92e - git-ptx-patches magic
diff --git a/rules/sockperf.in b/rules/sockperf.in
new file mode 100644
index 000000000..91851c2ed
--- /dev/null
+++ b/rules/sockperf.in
@@ -0,0 +1,8 @@
+## SECTION=test_suites
+
+config SOCKPERF
+ tristate
+ select GCCLIBS_CXX
+ prompt "sockperf"
+ help
+ Network benchmarking utility over socket API
diff --git a/rules/sockperf.make b/rules/sockperf.make
new file mode 100644
index 000000000..55b96875d
--- /dev/null
+++ b/rules/sockperf.make
@@ -0,0 +1,60 @@
+# -*-makefile-*-
+#
+# Copyright (C) 2023 by Mellanox Technologies Ltd.
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+
+#
+# We provide this package
+#
+PACKAGES-$(PTXCONF_SOCKPERF) += sockperf
+
+#
+# Paths and names
+#
+SOCKPERF_VERSION := 3.10
+SOCKPERF_MD5 := c589f072adf8c00eb95ef83c2d371f28
+SOCKPERF := sockperf-$(SOCKPERF_VERSION)
+SOCKPERF_SUFFIX := tar.gz
+SOCKPERF_URL := https://github.com/Mellanox/sockperf/archive/refs/tags/$(SOCKPERF_VERSION).$(SOCKPERF_SUFFIX)
+SOCKPERF_SOURCE := $(SRCDIR)/$(SOCKPERF).$(SOCKPERF_SUFFIX)
+SOCKPERF_DIR := $(BUILDDIR)/$(SOCKPERF)
+SOCKPERF_LICENSE := BSD-3-Clause
+SOCKPERF_LICENSE_FILES := file://copying;md5=13ab6d8129b2b03a18ec815d88b545ce
+
+# ----------------------------------------------------------------------------
+# Prepare
+# ----------------------------------------------------------------------------
+
+SOCKPERF_CONF_TOOL := autoconf
+SOCKPERF_CONF_ENV := $(CROSS_ENV) GIT_CEILING_DIRECTORIES="$(BUILDDIR)"
+SOCKPERF_MAKE_ENV := $(CROSS_ENV) GIT_CEILING_DIRECTORIES="$(BUILDDIR)"
+
+$(STATEDIR)/sockperf.prepare:
+ @$(call targetinfo)
+ @$(call world/execute, SOCKPERF, ./autogen.sh)
+ @$(call world/prepare, SOCKPERF)
+ @$(call touch)
+
+# ----------------------------------------------------------------------------
+# Target-Install
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/sockperf.targetinstall:
+ @$(call targetinfo)
+
+ @$(call install_init, sockperf)
+ @$(call install_fixup, sockperf,PRIORITY,optional)
+ @$(call install_fixup, sockperf,SECTION,base)
+ @$(call install_fixup, sockperf,AUTHOR,"Mellanox Technologies Ltd.")
+ @$(call install_fixup, sockperf,DESCRIPTION,missing)
+
+ @$(call install_copy, sockperf, 0, 0, 0755, -, /usr/bin/sockperf)
+
+ @$(call install_finish, sockperf)
+
+ @$(call touch)
+
+# vim: syntax=make
--
2.30.2
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [ptxdist] [APPLIED] Added sockperf benchmarking utility
2023-02-13 13:31 [ptxdist] [PATCH v2] Added sockperf benchmarking utility Sven Püschel
@ 2023-02-17 15:35 ` Michael Olbrich
0 siblings, 0 replies; 2+ messages in thread
From: Michael Olbrich @ 2023-02-17 15:35 UTC (permalink / raw)
To: ptxdist; +Cc: Sven Püschel
Thanks, applied as cceeee585de412653aa6d8dd2fd91d5d0c076275.
Michael
[sent from post-receive hook]
On Fri, 17 Feb 2023 16:35:46 +0100, Sven Püschel <s.pueschel@pengutronix.de> wrote:
> Signed-off-by: Sven Püschel <s.pueschel@pengutronix.de>
> Message-Id: <20230213133107.390465-1-s.pueschel@pengutronix.de>
> Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
>
> diff --git a/patches/sockperf-3.10/0001-Fixed-AArch32-compilation.patch b/patches/sockperf-3.10/0001-Fixed-AArch32-compilation.patch
> new file mode 100644
> index 000000000000..5d15e2787923
> --- /dev/null
> +++ b/patches/sockperf-3.10/0001-Fixed-AArch32-compilation.patch
> @@ -0,0 +1,69 @@
> +From: =?UTF-8?q?Sven=20P=C3=BCschel?= <s.pueschel@pengutronix.de>
> +Date: Mon, 13 Feb 2023 10:16:51 +0100
> +Subject: [PATCH] Fixed AArch32 compilation
> +MIME-Version: 1.0
> +Content-Type: text/plain; charset=UTF-8
> +Content-Transfer-Encoding: 8bit
> +
> +sockperf added support for AArch64, but at the same time it broke AArch32 support,
> +as this wasn't catched by a compiler macro anymore and resulted in trying to assemble a rdtsc instruction.
> +
> +See https://github.com/Mellanox/sockperf/commit/d84e8179f8ab007c7a19dfe263691b0429df7565
> +and https://github.com/Mellanox/sockperf/pull/187
> +
> +Signed-off-by: Sven Püschel <s.pueschel@pengutronix.de>
> +---
> + src/sockperf.cpp | 9 +++++++++
> + src/ticks_os.h | 5 +++++
> + 2 files changed, 14 insertions(+)
> +
> +diff --git a/src/sockperf.cpp b/src/sockperf.cpp
> +index 293d21747592..5d6ee4141b35 100644
> +--- a/src/sockperf.cpp
> ++++ b/src/sockperf.cpp
> +@@ -2205,6 +2205,13 @@ static int parse_common_opt(const AOPT_OBJECT *common_obj) {
> + #endif /* DEFINED_TLS */
> + }
> +
> ++#if defined(__arm__) && !defined(__aarch64__)
> ++ if (!s_user_params.b_no_rdtsc) {
> ++ log_msg("AArch32 target build does not support rdtsc, use --no-rdtsc");
> ++ rc = SOCKPERF_ERR_BAD_ARGUMENT;
> ++ }
> ++#endif
> ++
> + // resolve address: -i, -p and --tcp options must be processed before
> + if (!rc) {
> + int res = resolve_sockaddr(host_str, port_str, s_user_params.sock_type,
> +@@ -3868,6 +3875,7 @@ packet pace limit = %d",
> + log_dbg("+INFO: taking time, using the given settings, consumes %.3lf nsec",
> + (double)(end - start).toNsec() / SIZE);
> +
> ++#if !defined(__arm__) || defined(__aarch64__)
> + ticks_t tstart = 0, tend = 0;
> + tstart = os_gettimeoftsc();
> +
> +@@ -3878,6 +3886,7 @@ packet pace limit = %d",
> + double ticks_per_second = (double)get_tsc_rate_per_second();
> + log_dbg("+INFO: taking rdtsc directly consumes %.3lf nsec",
> + tdelta / SIZE * 1000 * 1000 * 1000 / ticks_per_second);
> ++#endif
> +
> + // step #5: check is user defined a specific SEED value to be used in all rand() calls
> + // if no seed value is provided, the rand() function is automatically seeded with a value of
> +diff --git a/src/ticks_os.h b/src/ticks_os.h
> +index 0f23b2c6f6f5..8750e0374245 100644
> +--- a/src/ticks_os.h
> ++++ b/src/ticks_os.h
> +@@ -99,6 +99,11 @@ inline ticks_t os_gettimeoftsc() {
> + asm volatile("isb" : : : "memory");
> + asm volatile("mrs %0, cntvct_el0" : "=r" (ret));
> + return ret;
> ++#elif defined(__arm__)
> ++ // so the compiler will not complain. for
> ++ // AArch32 compile, this inline is not used
> ++ // since rdtsc is only supported in an optional timer extension
> ++ upper_32 = lower_32 = 0;
> + #else
> + // ReaD Time Stamp Counter (RDTCS)
> + __asm__ __volatile__("rdtsc" : "=a"(lower_32), "=d"(upper_32));
> diff --git a/patches/sockperf-3.10/series b/patches/sockperf-3.10/series
> new file mode 100644
> index 000000000000..5f59ae9305ae
> --- /dev/null
> +++ b/patches/sockperf-3.10/series
> @@ -0,0 +1,4 @@
> +# generated by git-ptx-patches
> +#tag:base --start-number 1
> +0001-Fixed-AArch32-compilation.patch
> +# 84265c4b5947716cec9ccf808fa7f92e - git-ptx-patches magic
> diff --git a/rules/sockperf.in b/rules/sockperf.in
> new file mode 100644
> index 000000000000..91851c2ed775
> --- /dev/null
> +++ b/rules/sockperf.in
> @@ -0,0 +1,8 @@
> +## SECTION=test_suites
> +
> +config SOCKPERF
> + tristate
> + select GCCLIBS_CXX
> + prompt "sockperf"
> + help
> + Network benchmarking utility over socket API
> diff --git a/rules/sockperf.make b/rules/sockperf.make
> new file mode 100644
> index 000000000000..55b96875d5d4
> --- /dev/null
> +++ b/rules/sockperf.make
> @@ -0,0 +1,60 @@
> +# -*-makefile-*-
> +#
> +# Copyright (C) 2023 by Mellanox Technologies Ltd.
> +#
> +# For further information about the PTXdist project and license conditions
> +# see the README file.
> +#
> +
> +#
> +# We provide this package
> +#
> +PACKAGES-$(PTXCONF_SOCKPERF) += sockperf
> +
> +#
> +# Paths and names
> +#
> +SOCKPERF_VERSION := 3.10
> +SOCKPERF_MD5 := c589f072adf8c00eb95ef83c2d371f28
> +SOCKPERF := sockperf-$(SOCKPERF_VERSION)
> +SOCKPERF_SUFFIX := tar.gz
> +SOCKPERF_URL := https://github.com/Mellanox/sockperf/archive/refs/tags/$(SOCKPERF_VERSION).$(SOCKPERF_SUFFIX)
> +SOCKPERF_SOURCE := $(SRCDIR)/$(SOCKPERF).$(SOCKPERF_SUFFIX)
> +SOCKPERF_DIR := $(BUILDDIR)/$(SOCKPERF)
> +SOCKPERF_LICENSE := BSD-3-Clause
> +SOCKPERF_LICENSE_FILES := file://copying;md5=13ab6d8129b2b03a18ec815d88b545ce
> +
> +# ----------------------------------------------------------------------------
> +# Prepare
> +# ----------------------------------------------------------------------------
> +
> +SOCKPERF_CONF_TOOL := autoconf
> +SOCKPERF_CONF_ENV := $(CROSS_ENV) GIT_CEILING_DIRECTORIES="$(BUILDDIR)"
> +SOCKPERF_MAKE_ENV := $(CROSS_ENV) GIT_CEILING_DIRECTORIES="$(BUILDDIR)"
> +
> +$(STATEDIR)/sockperf.prepare:
> + @$(call targetinfo)
> + @$(call world/execute, SOCKPERF, ./autogen.sh)
> + @$(call world/prepare, SOCKPERF)
> + @$(call touch)
> +
> +# ----------------------------------------------------------------------------
> +# Target-Install
> +# ----------------------------------------------------------------------------
> +
> +$(STATEDIR)/sockperf.targetinstall:
> + @$(call targetinfo)
> +
> + @$(call install_init, sockperf)
> + @$(call install_fixup, sockperf,PRIORITY,optional)
> + @$(call install_fixup, sockperf,SECTION,base)
> + @$(call install_fixup, sockperf,AUTHOR,"Mellanox Technologies Ltd.")
> + @$(call install_fixup, sockperf,DESCRIPTION,missing)
> +
> + @$(call install_copy, sockperf, 0, 0, 0755, -, /usr/bin/sockperf)
> +
> + @$(call install_finish, sockperf)
> +
> + @$(call touch)
> +
> +# vim: syntax=make
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-02-17 15:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-13 13:31 [ptxdist] [PATCH v2] Added sockperf benchmarking utility Sven Püschel
2023-02-17 15:35 ` [ptxdist] [APPLIED] " Michael Olbrich
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox