mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: Michael Olbrich <m.olbrich@pengutronix.de>
To: ptxdist@pengutronix.de
Cc: "Sven Püschel" <s.pueschel@pengutronix.de>
Subject: Re: [ptxdist] [APPLIED] Added sockperf benchmarking utility
Date: Fri, 17 Feb 2023 16:35:47 +0100	[thread overview]
Message-ID: <20230217153547.1262993-1-m.olbrich@pengutronix.de> (raw)
In-Reply-To: <20230213133107.390465-1-s.pueschel@pengutronix.de>

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



      reply	other threads:[~2023-02-17 15:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-13 13:31 [ptxdist] [PATCH v2] " Sven Püschel
2023-02-17 15:35 ` Michael Olbrich [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230217153547.1262993-1-m.olbrich@pengutronix.de \
    --to=m.olbrich@pengutronix.de \
    --cc=ptxdist@pengutronix.de \
    --cc=s.pueschel@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox