From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Mon, 13 Feb 2023 14:31:54 +0100 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by lore.white.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1pRYw0-006G4r-EG for lore@lore.pengutronix.de; Mon, 13 Feb 2023 14:31:54 +0100 Received: from localhost ([127.0.0.1] helo=metis.ext.pengutronix.de) by metis.ext.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1pRYvx-0002zq-4Z; Mon, 13 Feb 2023 14:31:53 +0100 Received: from luzerne.office.stw.pengutronix.de ([2a0a:edc0:0:900:1d::52]) by metis.ext.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1pRYvJ-0002zc-OA; Mon, 13 Feb 2023 14:31:13 +0100 From: =?UTF-8?q?Sven=20P=C3=BCschel?= To: ptxdist@pengutronix.de Date: Mon, 13 Feb 2023 14:31:07 +0100 Message-Id: <20230213133107.390465-1-s.pueschel@pengutronix.de> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [ptxdist] [PATCH v2] Added sockperf benchmarking utility X-BeenThere: ptxdist@pengutronix.de X-Mailman-Version: 2.1.29 Precedence: list List-Id: PTXdist Development Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: ptxdist@pengutronix.de Cc: =?UTF-8?q?Sven=20P=C3=BCschel?= Sender: "ptxdist" X-SA-Exim-Connect-IP: 127.0.0.1 X-SA-Exim-Mail-From: ptxdist-bounces@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false Signed-off-by: Sven Püschel --- .../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?= +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 +--- + 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