From nobody Tue Feb 24 01:19:23 2026 X-Original-To: dev-commits-ports-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4fKfyM6Nw1z6Ss41 for ; Tue, 24 Feb 2026 01:19:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R12" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4fKfyM3ykyz3rxT for ; Tue, 24 Feb 2026 01:19:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1771895963; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=WoFr4lW4xBpxyu9YO/Lu1fPpR6J1wVL44mFhI1BySlw=; b=OwTaCFNKbtUUmLEeSHCJ8ghb0LBZZZy3XTGw2Ikn/TYxHyfi1TLA21YwZRhZnMrf29W6WD r7rDtOdobLUAvamrLr1boRC5pzVJxZjILptjAkfa+KzDQNsYkPyReKF8e0asMqxZtZ4Ho0 kRHR+HSQghmQnFT5Wa2nbq9sZLGKxX2RM03UPpJPg6GRd1JeFma5Bn1be5A5Tq8rNLx7gN q8T1Oyf0CnbRkRyfg5xXxiECWHeWAy2oC8D2mgkyFf4H+QM8yKhzLZ6fCYuLudvujVG6Sz tf3xtCuVDQ1gxLPCsLhgs1yZsK8PU+pjlMGGBGtb6RzlZ3vgaT3x/e71XyPHSw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1771895963; a=rsa-sha256; cv=none; b=QqDKV72gQOLd6oq4rLJVgpL1HzDn36jr8lOcyJyimdR8dq6ay8ZRdvUYMITiFhaHVyPqvz t42wkiGpJFN+9X7SZqChJLdPGQE4Un6vFa+BrYUyLhH7vEnKYx736d+ny+QljVuXqNLFyA 1KAuvDG+a9hSj8SJvNO6pFI4TpRO0r/U4TI2R5/Lvv1Eko5PRrsYXwi2L8ELukPA2kelM4 NX9QIuOY625+BWYDuAQkD/iHTXNJrUX0HC0TRA1fYin0z3Q+GFooKRc+2eWr/m5Hk4Tn6G 9+cZjZMmWrhNf2Tt2be2piqfgiKBVVkZ60P3tiOUVUzidUKzjjbTdNNJWliEhg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1771895963; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=WoFr4lW4xBpxyu9YO/Lu1fPpR6J1wVL44mFhI1BySlw=; b=RFWyCrHwMXBbt9vnD7JELFHefgxHxwFwb0JTrq/q1Nu0YrHHHoNtWAQ+dT5nSSSxk86m9g lqtbffO/qonIaHEqS43ezDP9kt+fKKiAfXi+IvKBGs8xUw0oGVVYXEP3LKR5CozcxeJDQ8 cs4ceRrWZjN9nnwGygf/OIB5r0RJxLdAXtA+g1T7rHvy7338OHHqiEQV0lh8krVGpMaDS3 iYa607iEO9/sXTvXmXekKVvVGFlTvknwlA2po62rfOgkks9+zHtbT6VznmhwYjgIqLkcPO jdQkxeyKaQGDnRhja8phKm17l/QWM0dZcS1cx4Ax+e+vg4NKuCelP/VK8q7L/Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4fKfyM3V1Yzv0S for ; Tue, 24 Feb 2026 01:19:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1909e by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 24 Feb 2026 01:19:23 +0000 To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org Cc: GenericRikka From: Robert Clausecker Subject: git: 294f65945aef - main - net/ucx: Unified Communication X for high-performance messaging List-Id: Commit messages for all branches of the ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-ports-all@freebsd.org Sender: owner-dev-commits-ports-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: fuz X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 294f65945aef29f1aed496f170e34a219121afbb Auto-Submitted: auto-generated Date: Tue, 24 Feb 2026 01:19:23 +0000 Message-Id: <699cfc9b.1909e.7c2db73c@gitrepo.freebsd.org> The branch main has been updated by fuz: URL: https://cgit.FreeBSD.org/ports/commit/?id=294f65945aef29f1aed496f170e34a219121afbb commit 294f65945aef29f1aed496f170e34a219121afbb Author: GenericRikka AuthorDate: 2026-02-18 13:02:58 +0000 Commit: Robert Clausecker CommitDate: 2026-02-24 00:44:48 +0000 net/ucx: Unified Communication X for high-performance messaging UCX (Unified Communication X) is a high-performance communication framework for modern HPC and data-intensive workloads. It provides low-latency, high-bandwidth messaging and remote-memory-access primitives across a wide range of transports, including shared memory, TCP/IP, and RDMA-capable interconnects such as InfiniBand and RoCE (when supported by the platform). UCX is commonly used as a communication substrate for MPI, OpenSHMEM, and other distributed runtimes. It exposes a set of layered APIs (UCP/UCT/UCS/UCM) to balance portability and performance while enabling optimized transport selection, rendezvous protocols, and progress models. PR: 292889 --- net/Makefile | 1 + net/ucx/Makefile | 66 +++++ net/ucx/distinfo | 3 + net/ucx/files/patch-Makefile.am | 13 + net/ucx/files/patch-config_m4_ucm.m4 | 33 +++ net/ucx/files/patch-configure.ac | 108 +++++++ net/ucx/files/patch-src_tools_info_Makefile.am | 15 + .../files/patch-src_tools_perf_mad_perftest__mad.c | 16 ++ net/ucx/files/patch-src_ucm_Makefile.am | 50 ++++ net/ucx/files/patch-src_ucm_event_event.c | 18 ++ ...atch-src_ucm_malloc_brk__sbrk__override__stub.c | 28 ++ net/ucx/files/patch-src_ucm_malloc_malloc__hook.c | 35 +++ .../patch-src_ucm_malloc_malloc__hook__stub.c | 58 ++++ net/ucx/files/patch-src_ucm_mmap_install.c | 55 ++++ net/ucx/files/patch-src_ucm_util_log.c | 40 +++ net/ucx/files/patch-src_ucm_util_reloc.c | 18 ++ net/ucx/files/patch-src_ucm_util_replace.c | 68 +++++ net/ucx/files/patch-src_ucm_util_sys.c | 103 +++++++ net/ucx/files/patch-src_ucm_util_sys.h | 11 + net/ucx/files/patch-src_ucp_core_ucp__worker.c | 127 +++++++++ net/ucx/files/patch-src_ucs_arch_aarch64_cpu.h | 10 + net/ucx/files/patch-src_ucs_async_signal.c | 47 ++++ net/ucx/files/patch-src_ucs_config_parser.c | 54 ++++ net/ucx/files/patch-src_ucs_debug_debug.c | 11 + net/ucx/files/patch-src_ucs_debug_log.c | 14 + net/ucx/files/patch-src_ucs_memory_numa.c | 23 ++ net/ucx/files/patch-src_ucs_sys_compiler.h | 17 ++ net/ucx/files/patch-src_ucs_sys_event__set.c | 232 +++++++++++++++ net/ucx/files/patch-src_ucs_sys_netlink.c | 50 ++++ net/ucx/files/patch-src_ucs_sys_netlink.h | 15 + net/ucx/files/patch-src_ucs_sys_sock.h | 21 ++ net/ucx/files/patch-src_ucs_sys_sys.c | 310 +++++++++++++++++++++ net/ucx/files/patch-src_ucs_sys_sys.h | 26 ++ net/ucx/files/patch-src_ucs_type_float8.h | 174 ++++++++++++ net/ucx/files/patch-src_ucs_vfs_fuse_vfs__fuse.c | 109 ++++++++ net/ucx/files/patch-src_ucs_vfs_sock_vfs__sock.c | 78 ++++++ net/ucx/files/patch-src_uct_ib_base_ib__device.h | 18 ++ net/ucx/files/patch-src_uct_ib_ud_base_ud__iface.c | 17 ++ net/ucx/files/patch-src_uct_tcp_tcp__base.c | 15 + net/ucx/files/patch-src_uct_tcp_tcp__net.c | 75 +++++ net/ucx/files/patch-test_apps_iodemo_io__demo.cc | 23 ++ .../files/patch-test_apps_iodemo_ucx__wrapper.cc | 43 +++ .../files/patch-test_apps_iodemo_ucx__wrapper.h | 14 + .../files/patch-test_gtest_common_test__helpers.cc | 13 + .../patch-test_gtest_common_test__watchdog.cc | 10 + net/ucx/files/patch-test_gtest_ucs_test__debug.cc | 22 ++ net/ucx/files/patch-test_gtest_uct_uct__test.cc | 28 ++ net/ucx/pkg-descr | 10 + net/ucx/pkg-plist | 144 ++++++++++ 49 files changed, 2489 insertions(+) diff --git a/net/Makefile b/net/Makefile index b2af8c396c8c..74797b5532d4 100644 --- a/net/Makefile +++ b/net/Makefile @@ -1633,6 +1633,7 @@ SUBDIR += turnserver SUBDIR += u6rd SUBDIR += ucarp + SUBDIR += ucx SUBDIR += udp-over-tcp SUBDIR += udpbroadcastrelay SUBDIR += udptunnel diff --git a/net/ucx/Makefile b/net/ucx/Makefile new file mode 100644 index 000000000000..f7cdf5e1385b --- /dev/null +++ b/net/ucx/Makefile @@ -0,0 +1,66 @@ +PORTNAME= ucx +DISTVERSION= 1.20.0 +CATEGORIES= net +MASTER_SITES= https://github.com/openucx/ucx/releases/download/v${DISTVERSION}/ + +MAINTAINER= rikka.goering@outlook.de +COMMENT= Unified Communication X framework (UCX) +WWW= https://openucx.org/ + +LICENSE= BSD3CLAUSE + +ONLY_FOR_ARCHS= aarch64 amd64 powerpc64le +ONLY_FOR_ARCHS_REASON= uses arch-specific CPU backends; armv7 is not supported upstream and does not build on FreeBSD + +BUILD_DEPENDS= ${LOCALBASE}/share/aclocal/ax_c_float_words_bigendian.m4:devel/autoconf-archive + +USES= autoreconf gmake libtool pkgconfig +USE_LDCONFIG= yes + +GNU_CONFIGURE= yes +CONFIGURE_ARGS= --enable-mt \ + --with-go=no \ + --enable-compiler-opt=0 \ + --disable-doxygen-doc +CONFIGURE_ENV+= GIT=/usr/bin/false + +INSTALL_TARGET= install-strip + +TEST_ENV+= LD_LIBRARY_PATH=${STAGEDIR}${PREFIX}/lib + +CFLAGS+= -Wno-error +CXXFLAGS+= -Wno-error +LDFLAGS+= -lexecinfo + +PORTDOCS= * +PORTEXAMPLES= * + +OPTIONS_DEFINE= DOCS EXAMPLES FUSE IBVERBS IODEMO UMAD PERFTEST +OPTIONS_DEFAULT= IODEMO PERFTEST FUSE +OPTIONS_SUB= yes + +IBVERBS_DESC= Enable InfiniBand/RDMA (verbs) transport +IODEMO_DESC= Install io_demo test application +PERFTEST_DESC= Install ucx_perftest benchmarks +UMAD_DESC= Build/install perftest MAD plugin (umad) + +FUSE_LIB_DEPENDS= libfuse3.so:filesystems/fusefs-libs3 +FUSE_CONFIGURE_ON= --with-fuse3=${LOCALBASE} +FUSE_CONFIGURE_OFF= --with-fuse3=no + +IBVERBS_CONFIGURE_ON= --with-verbs=${LOCALBASE} +IBVERBS_CONFIGURE_OFF= --with-verbs=no + +UMAD_IMPLIES= IBVERBS PERFTEST +UMAD_CONFIGURE_ON= --with-mad=${LOCALBASE} +UMAD_CONFIGURE_OFF= --with-mad=no + +post-install: + ${MV} ${STAGEDIR}${ETCDIR}/ucx.conf ${STAGEDIR}${ETCDIR}/ucx.conf.sample + +do-test: + @${ECHO_MSG} "===> Running UCX smoke tests (ucx_info)" + ${SETENVI} ${TEST_ENV} ${STAGEDIR}${PREFIX}/bin/ucx_info -v >/dev/null + ${SETENVI} ${TEST_ENV} ${STAGEDIR}${PREFIX}/bin/ucx_info -d >/dev/null + +.include diff --git a/net/ucx/distinfo b/net/ucx/distinfo new file mode 100644 index 000000000000..03dfb53b5e8e --- /dev/null +++ b/net/ucx/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1771060207 +SHA256 (ucx-1.20.0.tar.gz) = 7c8a6093cada179aa1d851b83625e3b25ed5658966e309de5118c27a038c7ef9 +SIZE (ucx-1.20.0.tar.gz) = 3500736 diff --git a/net/ucx/files/patch-Makefile.am b/net/ucx/files/patch-Makefile.am new file mode 100644 index 000000000000..8993d3b04bd6 --- /dev/null +++ b/net/ucx/files/patch-Makefile.am @@ -0,0 +1,13 @@ +--- Makefile.am.orig 2026-02-05 12:41:56 UTC ++++ Makefile.am +@@ -59,8 +59,10 @@ SUBDIRS += \ + cmake \ + config + ++if BUILD_GTEST + if HAVE_GTEST + SUBDIRS += test/gtest ++endif + endif + + if HAVE_MPICC diff --git a/net/ucx/files/patch-config_m4_ucm.m4 b/net/ucx/files/patch-config_m4_ucm.m4 new file mode 100644 index 000000000000..7ba238108c02 --- /dev/null +++ b/net/ucx/files/patch-config_m4_ucm.m4 @@ -0,0 +1,33 @@ +--- config/m4/ucm.m4.orig 2026-02-04 09:52:46 UTC ++++ config/m4/ucm.m4 +@@ -15,11 +15,18 @@ AC_ARG_WITH([allocator], + [], + [with_allocator=ptmalloc286]) + ++AC_CHECK_FUNCS([brk sbrk], [], [], [#include ]) ++ ++HAVE_UCM_PTMALLOC286=no ++ + case ${with_allocator} in + ptmalloc286) + AC_MSG_NOTICE(Memory allocator is ptmalloc-2.8.6 version) +- AC_DEFINE([HAVE_UCM_PTMALLOC286], 1, [Use ptmalloc-2.8.6 version]) +- HAVE_UCM_PTMALLOC286=yes ++ AS_IF([test "x$ac_cv_func_brk" = "xyes" && test "x$ac_cv_func_sbrk" = "xyes"], ++ [AC_DEFINE([HAVE_UCM_PTMALLOC286], 1, [Use ptmalloc-2.8.6 version]) ++ HAVE_UCM_PTMALLOC286=yes], ++ [AC_MSG_WARN([brk()/sbrk() not available; disabling ptmalloc286 allocator]) ++ HAVE_UCM_PTMALLOC286=no]) + ;; + *) + AC_MSG_ERROR(Cannot continue. Unsupported memory allocator name +@@ -83,6 +90,9 @@ AS_IF([test "x$mmap_hooks_happy" = "xyes"], + AS_IF([test "x$mmap_hooks_happy" = "xyes"], + AS_IF([test "x$ipc_hooks_happy" = "xyes" -o "x$shm_hooks_happy" = "xyes"], + [bistro_hooks_happy=yes])) ++ ++AS_IF([test "x$ac_cv_func_brk" != "xyes" -o "x$ac_cv_func_sbrk" != "xyes"], ++ [bistro_hooks_happy=no]) + + AS_IF([test "x$bistro_hooks_happy" = "xyes"], + [AC_DEFINE([UCM_BISTRO_HOOKS], [1], [Enable BISTRO hooks])], diff --git a/net/ucx/files/patch-configure.ac b/net/ucx/files/patch-configure.ac new file mode 100644 index 000000000000..59c76d368312 --- /dev/null +++ b/net/ucx/files/patch-configure.ac @@ -0,0 +1,108 @@ +--- configure.ac.orig 2026-02-05 12:41:56 UTC ++++ configure.ac +@@ -14,8 +14,6 @@ define([ucx_ver_extra], ) # Extra version string. Em + define([ucx_ver_patch], 0) # Patch version. Increased for a bugfix release. + define([ucx_ver_extra], ) # Extra version string. Empty for a general release. + +-define([ts], esyscmd([sh -c "date +%Y%m%d%H%M%S"])) +- + # This is the API version (see libtool library versioning) + # http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html + # current:rev:age +@@ -31,14 +29,20 @@ AC_CONFIG_HEADERS([config.h]) + AC_USE_SYSTEM_EXTENSIONS + AC_CONFIG_HEADERS([config.h]) + +-AC_CHECK_PROG(GITBIN, git, yes) +-AS_IF([test x"${GITBIN}" = x"yes"], +- [# remove preceding "refs/heads/" (11 characters) for symbolic ref +- AC_SUBST(SCM_BRANCH, esyscmd([sh -c 'git symbolic-ref --quiet HEAD | sed "s/^.\{11\}//"'])) +- AC_SUBST(SCM_VERSION, esyscmd([sh -c 'git rev-parse --short=7 HEAD']))], +- [AC_SUBST(SCM_BRANCH, "") +- AC_SUBST(SCM_VERSION, "0000000")]) ++AC_PATH_PROG([GIT], [git], [:]) + ++SCM_BRANCH="" ++SCM_VERSION="0000000" ++ ++AS_IF([test -d "${srcdir}/.git" && test "x$GIT" != "x:" && \ ++ $GIT -C "${srcdir}" rev-parse --is-inside-work-tree >/dev/null 2>&1], [ ++ SCM_BRANCH=`$GIT -C "${srcdir}" symbolic-ref --quiet HEAD 2>/dev/null | sed 's,^refs/heads/,,'` ++ SCM_VERSION=`$GIT -C "${srcdir}" rev-parse --short=7 HEAD 2>/dev/null` ++]) ++ ++AC_SUBST([SCM_BRANCH]) ++AC_SUBST([SCM_VERSION]) ++ + AH_TOP([ + #ifndef UCX_CONFIG_H + #define UCX_CONFIG_H +@@ -85,9 +89,44 @@ AC_FUNC_STRERROR_R + AC_C_RESTRICT + AC_FUNC_STRERROR_R + +-AC_PATH_TOOL([PKG_CONFIG], [pkg-config], [pkg-config]) ++PKG_PROG_PKG_CONFIG + ++dnl Float word order can differ from integer endianness on some ABIs. ++ dnl Prefer Autoconf's macro if available; otherwise fall back to autoconf-archive. ++ m4_ifdef([AC_C_FLOAT_WORDS_BIGENDIAN], ++ [AC_C_FLOAT_WORDS_BIGENDIAN], ++ [m4_ifdef([AX_C_FLOAT_WORDS_BIGENDIAN], ++ [AX_C_FLOAT_WORDS_BIGENDIAN], ++ [AC_MSG_ERROR([need AC_C_FLOAT_WORDS_BIGENDIAN or AX_C_FLOAT_WORDS_BIGENDIAN])])]) + ++AC_CHECK_HEADERS([sys/eventfd.h sys/timerfd.h]) ++AC_CHECK_HEADERS([netinet/in.h arpa/inet.h]) ++ ++AC_CHECK_FUNCS([brk sbrk]) ++ ++AS_IF([test "x$ac_cv_func_brk" = "xyes" && test "x$ac_cv_func_sbrk" = "xyes"], ++ [have_brk_sbrk=yes], ++ [have_brk_sbrk=no]) ++ ++have_ucm_malloc_hooks=no ++case "$host_os" in ++ linux*) have_ucm_malloc_hooks=yes ;; ++ *) have_ucm_malloc_hooks=no ;; ++esac ++AM_CONDITIONAL([HAVE_UCM_MALLOC_HOOKS], [test "x$have_ucm_malloc_hooks" = xyes]) ++ ++AM_CONDITIONAL([HAVE_BRK_SBRK], [test "x$have_brk_sbrk" = "xyes"]) ++AS_IF([test "x$have_brk_sbrk" = "xyes"], ++ [AC_DEFINE([HAVE_BRK_SBRK], [1], ++ [Define if both brk() and sbrk() are available])], ++ []) ++ ++case "$host_os" in ++ freebsd*) build_gtest=no ;; ++ *) build_gtest=yes ;; ++esac ++AM_CONDITIONAL([BUILD_GTEST], [test "x$build_gtest" = xyes]) ++ + # + # Define SHARED_LIB preprocessor macro when building a shared library + # +@@ -255,6 +294,22 @@ AS_IF([test "x$with_docs_only" = xyes], + m4_include([test/apps/iodemo/configure.m4]) + m4_include([test/apps/uct_info/configure.m4]) + ++AS_IF([test "x$with_docs_only" != xyes && test "x$build_gtest" = xyes], [ ++ PKG_CHECK_MODULES([GTEST], [gtest_main], ++ [have_gtest=yes], ++ [have_gtest=no]) ++], [ ++ have_gtest=no ++]) ++ ++AM_CONDITIONAL([HAVE_GTEST], [test "x$have_gtest" = "xyes"]) ++ ++GTEST_CPPFLAGS="${GTEST_CFLAGS}" ++GTEST_CXXFLAGS="${GTEST_CFLAGS}" ++GTEST_LDFLAGS="" ++AC_SUBST([GTEST_CPPFLAGS]) ++AC_SUBST([GTEST_CXXFLAGS]) ++AC_SUBST([GTEST_LDFLAGS]) + + # + # Disable checking user parameters diff --git a/net/ucx/files/patch-src_tools_info_Makefile.am b/net/ucx/files/patch-src_tools_info_Makefile.am new file mode 100644 index 000000000000..bb0ea71e540e --- /dev/null +++ b/net/ucx/files/patch-src_tools_info_Makefile.am @@ -0,0 +1,15 @@ +--- src/tools/info/Makefile.am.orig 2026-02-04 09:52:46 UTC ++++ src/tools/info/Makefile.am +@@ -14,7 +14,11 @@ build_config.h: $(top_builddir)/config.h Makefile + # Produce a C header file which contains all defined variables from config.h + # + build_config.h: $(top_builddir)/config.h Makefile +- $(SED) -nr 's:\s*#define\s+(\w+)(\s+(\w+)|\s+(".*")|\s*)$$:{"\1", UCS_PP_MAKE_STRING(\3\4)},:p' <$(top_builddir)/config.h >$@ ++ $(SED) -nE \ ++ -e 's/^[[:space:]]*#define[[:space:]]+([A-Za-z_][A-Za-z_0-9]*)[[:space:]]+(".*")$$/{"\1", UCS_PP_MAKE_STRING(\2)},/p' \ ++ -e 's/^[[:space:]]*#define[[:space:]]+([A-Za-z_][A-Za-z0-9_]*)[[:space:]]+([^[:space:]]+)$$/{"\1", UCS_PP_MAKE_STRING(\2)},/p' \ ++ -e 's/^[[:space:]]*#define[[:space:]]+([A-Za-z_][A-Za-z0-9_]*)$$/{"\1", ""},/p' \ ++ <$(top_builddir)/config.h >$@ + + ucx_info_CPPFLAGS = $(BASE_CPPFLAGS) + ucx_info_CFLAGS = $(BASE_CFLAGS) diff --git a/net/ucx/files/patch-src_tools_perf_mad_perftest__mad.c b/net/ucx/files/patch-src_tools_perf_mad_perftest__mad.c new file mode 100644 index 000000000000..4eddbc3e8082 --- /dev/null +++ b/net/ucx/files/patch-src_tools_perf_mad_perftest__mad.c @@ -0,0 +1,16 @@ +--- src/tools/perf/mad/perftest_mad.c.orig 2026-02-04 09:52:46 UTC ++++ src/tools/perf/mad/perftest_mad.c +@@ -20,7 +20,13 @@ + #include + #include + #include ++#if defined(__linux__) + #include /* __be64 */ ++#else ++#include ++#include /* be64toh */ ++typedef uint64_t __be64; ++#endif + + #include + #include diff --git a/net/ucx/files/patch-src_ucm_Makefile.am b/net/ucx/files/patch-src_ucm_Makefile.am new file mode 100644 index 000000000000..49b81a7ad4b8 --- /dev/null +++ b/net/ucx/files/patch-src_ucm_Makefile.am @@ -0,0 +1,50 @@ +--- src/ucm/Makefile.am.orig 2026-02-04 09:52:46 UTC ++++ src/ucm/Makefile.am +@@ -21,8 +21,6 @@ noinst_HEADERS = \ + + noinst_HEADERS = \ + event/event.h \ +- malloc/malloc_hook.h \ +- malloc/allocator.h \ + mmap/mmap.h \ + util/khash_safe.h \ + util/replace.h \ +@@ -38,7 +36,6 @@ libucm_la_SOURCES = \ + + libucm_la_SOURCES = \ + event/event.c \ +- malloc/malloc_hook.c \ + mmap/install.c \ + util/replace.c \ + util/log.c \ +@@ -50,6 +47,17 @@ libucm_la_SOURCES = \ + bistro/bistro_ppc64.c \ + bistro/bistro_rv64.c + ++if HAVE_UCM_MALLOC_HOOKS ++noinst_HEADERS += \ ++ malloc/malloc_hook.h \ ++ malloc/allocator.h ++ ++libucm_la_SOURCES += \ ++ malloc/malloc_hook.c ++else ++libucm_la_SOURCES += \ ++ malloc/malloc_hook_stub.c ++ + if HAVE_UCM_PTMALLOC286 + libucm_la_CPPFLAGS += \ + -fno-strict-aliasing \ +@@ -61,5 +69,12 @@ noinst_HEADERS += \ + + noinst_HEADERS += \ + ptmalloc286/malloc-2.8.6.h ++endif ++endif ++ ++if HAVE_BRK_SBRK ++else ++libucm_la_SOURCES += \ ++ malloc/brk_sbrk_override_stub.c + endif + diff --git a/net/ucx/files/patch-src_ucm_event_event.c b/net/ucx/files/patch-src_ucm_event_event.c new file mode 100644 index 000000000000..11a0577447e6 --- /dev/null +++ b/net/ucx/files/patch-src_ucm_event_event.c @@ -0,0 +1,18 @@ +--- src/ucm/event/event.c.orig 2026-02-04 09:52:46 UTC ++++ src/ucm/event/event.c +@@ -36,6 +36,15 @@ KHASH_INIT(ucm_ptr_size, const void*, size_t, 1, ucm_p + #define ucm_ptr_hash(_ptr) kh_int64_hash_func((uintptr_t)(_ptr)) + KHASH_INIT(ucm_ptr_size, const void*, size_t, 1, ucm_ptr_hash, kh_int64_hash_equal) + ++#if defined(__FreeBSD__) ++#ifndef MREMAP_FIXED ++#define MREMAP_FIXED 0 ++#endif ++#ifndef MREMAP_MAYMOVE ++#define MREMAP_MAYMOVE 0 ++#endif ++#endif ++ + static pthread_rwlock_t ucm_event_lock = PTHREAD_RWLOCK_INITIALIZER; + static ucs_init_once_t ucm_library_init_once = UCS_INIT_ONCE_INITIALIZER; + static ucs_list_link_t ucm_event_handlers; diff --git a/net/ucx/files/patch-src_ucm_malloc_brk__sbrk__override__stub.c b/net/ucx/files/patch-src_ucm_malloc_brk__sbrk__override__stub.c new file mode 100644 index 000000000000..7b8bcaa7accf --- /dev/null +++ b/net/ucx/files/patch-src_ucm_malloc_brk__sbrk__override__stub.c @@ -0,0 +1,28 @@ +--- src/ucm/malloc/brk_sbrk_override_stub.c.orig 2026-02-20 03:25:07 UTC ++++ src/ucm/malloc/brk_sbrk_override_stub.c +@@ -0,0 +1,25 @@ ++#include ++#include ++#include ++ ++/* ++ * Stubs for platforms/builds where we don't implement brk/sbrk overriding. ++ * Fail gracefully so callers can fall back or treat as unsupported. ++ * ++ * Marked weak so a real implementation (if later added) can override it. ++ */ ++__attribute__((weak)) ++int ucm_override_brk(void *addr) ++{ ++ (void)addr; ++ errno = ENOSYS; ++ return -1; ++} ++ ++__attribute__((weak)) ++void *ucm_override_sbrk(intptr_t increment) ++{ ++ (void)increment; ++ errno = ENOSYS; ++ return (void*)-1; ++} diff --git a/net/ucx/files/patch-src_ucm_malloc_malloc__hook.c b/net/ucx/files/patch-src_ucm_malloc_malloc__hook.c new file mode 100644 index 000000000000..197db69bab41 --- /dev/null +++ b/net/ucx/files/patch-src_ucm_malloc_malloc__hook.c @@ -0,0 +1,35 @@ +--- src/ucm/malloc/malloc_hook.c.orig 2026-02-04 09:52:46 UTC ++++ src/ucm/malloc/malloc_hook.c +@@ -35,6 +35,12 @@ + #include + #include + ++#if defined(__FreeBSD__) ++#include ++#include ++#include ++#include ++#endif + + #include + +@@ -45,7 +51,6 @@ + #define UCM_MALLOC_INSTALLED_OPT_SYMS UCS_BIT(2) /* Installed optional symbols */ + #define UCM_MALLOC_INSTALLED_MALL_SYMS UCS_BIT(3) /* Installed malloc symbols */ + +- + /* Mangled symbols of C++ allocators */ + #define UCM_OPERATOR_NEW_SYMBOL "_Znwm" + #define UCM_OPERATOR_DELETE_SYMBOL "_ZdlPv" +@@ -659,7 +664,11 @@ static void ucm_malloc_populate_glibc_cache() + + static void ucm_malloc_populate_glibc_cache() + { ++#if defined(__FreeBSD__) ++ static char hostname[UCS_HOST_NAME_MAX] = {0}; ++#else + char hostname[HOST_NAME_MAX]; ++#endif + + /* Trigger NSS initialization before we install malloc hooks. + * This is needed because NSS could allocate strings with our malloc(), but diff --git a/net/ucx/files/patch-src_ucm_malloc_malloc__hook__stub.c b/net/ucx/files/patch-src_ucm_malloc_malloc__hook__stub.c new file mode 100644 index 000000000000..3663f323d060 --- /dev/null +++ b/net/ucx/files/patch-src_ucm_malloc_malloc__hook__stub.c @@ -0,0 +1,58 @@ +--- src/ucm/malloc/malloc_hook_stub.c.orig 2026-02-20 02:50:52 UTC ++++ src/ucm/malloc/malloc_hook_stub.c +@@ -0,0 +1,55 @@ ++/* ++ * FreeBSD / non-glibc stub for UCX malloc hook support. ++ * ++ * This file provides the public API declared in malloc_hook.h, but does not ++ * attempt to install malloc hooks, relocate symbols, or tweak mallopt-style ++ * thresholds. Those mechanisms are glibc/ptmalloc-centric. ++ * ++ * The goal for now: link cleanly, behave safely, and fail gracefully when ++ * malloc hooking is actually required. ++ */ ++ ++#ifdef HAVE_CONFIG_H ++# include "config.h" ++#endif ++ ++#include "malloc_hook.h" ++ ++#include ++#include ++ ++ucs_status_t ucm_malloc_install(int events) ++{ ++ static int warned = 0; ++ ++ /* We don't implement malloc hook installation on this platform (yet). */ ++ if (!warned) { ++ ucm_debug("ucm_malloc_install(events=0x%x): stub (malloc hooks not supported on this build)", ++ events); ++ warned = 1; ++ } ++ ++ /* ++ * Conservative choice: ++ * - Return UNSUPPORTED so callers that *need* these hooks can fall back ++ * or disable the feature. ++ * ++ * If you find a call site that expects OK unconditionally, we can make this ++ * conditional (e.g., return OK when events==0), but UNSUPPORTED is the honest ++ * default. ++ */ ++ return (events == 0) ? UCS_OK : UCS_ERR_UNSUPPORTED; ++} ++ ++void ucm_init_malloc_hook(void) ++{ ++ /* No-op for stub. */ ++} ++ ++void ucm_malloc_state_reset(int default_mmap_thresh, int default_trim_thresh) ++{ ++ (void)default_mmap_thresh; ++ (void)default_trim_thresh; ++ ++ /* No-op for stub (no mallopt-style tuning here). */ ++} diff --git a/net/ucx/files/patch-src_ucm_mmap_install.c b/net/ucx/files/patch-src_ucm_mmap_install.c new file mode 100644 index 000000000000..33a4ea90b28f --- /dev/null +++ b/net/ucx/files/patch-src_ucm_mmap_install.c @@ -0,0 +1,55 @@ +--- src/ucm/mmap/install.c.orig 2026-02-04 09:52:46 UTC ++++ src/ucm/mmap/install.c +@@ -86,8 +86,10 @@ static ucm_mmap_func_t ucm_mmap_funcs[] = { + #endif + { UCM_MMAP_RELOC_ENTRY(shmat), UCM_EVENT_SHMAT, UCM_EVENT_NONE}, + { UCM_MMAP_RELOC_ENTRY(shmdt), UCM_EVENT_SHMDT, UCM_EVENT_SHMAT}, ++#ifdef HAVE_BRK_SBRK + { UCM_MMAP_RELOC_ENTRY(sbrk), UCM_EVENT_SBRK, UCM_EVENT_NONE}, + { UCM_MMAP_RELOC_ENTRY(brk), UCM_EVENT_BRK, UCM_EVENT_NONE}, ++#endif + { UCM_MMAP_RELOC_ENTRY(madvise), UCM_EVENT_MADVISE, UCM_EVENT_NONE}, + { {NULL, NULL, NULL}, UCM_EVENT_NONE} + }; +@@ -135,6 +137,7 @@ static void ucm_mmap_event_test_callback(ucm_event_typ + } + } + ++#ifdef HAVE_BRK_SBRK + /* Call brk() and check return value, to avoid compile error of unused result */ + static void ucm_brk_checked(void *addr) + { +@@ -143,6 +146,7 @@ static void ucm_brk_checked(void *addr) + ucm_diag("brk(addr=%p) failed: %m", addr); + } + } ++#endif + + /* Fire events with pre/post action. The problem is in call sequence: we + * can't just fire single event - most of the system calls require set of +@@ -199,6 +203,7 @@ ucm_fire_mmap_events_internal(int events, ucm_mmap_tes + } + + if (exclusive && !RUNNING_ON_VALGRIND) { ++#ifdef HAVE_BRK_SBRK + sbrk_size = ucm_get_page_size(); + if (events & (UCM_EVENT_BRK|UCM_EVENT_VM_MAPPED|UCM_EVENT_VM_UNMAPPED)) { + p = ucm_get_current_brk(); +@@ -213,14 +218,17 @@ ucm_fire_mmap_events_internal(int events, ucm_mmap_tes + UCM_FIRE_EVENT(events, UCM_EVENT_SBRK|UCM_EVENT_VM_UNMAPPED, + data, (void)sbrk(-sbrk_size)); + } ++#endif + } else { + /* To avoid side effects on other threads and valgrind heap corruption, + * pass invalid parameters. We assume that if the natives events are + * delivered, it means VM_MAPPED/UNMAPPED would be delivered as well. + */ ++#ifdef HAVE_BRK_SBRK + if (events & UCM_EVENT_BRK) { + UCM_FIRE_EVENT(events, UCM_EVENT_BRK, data, ucm_brk_checked(NULL)); + } ++#endif + } + + if (events & (UCM_EVENT_MADVISE|UCM_EVENT_VM_UNMAPPED)) { diff --git a/net/ucx/files/patch-src_ucm_util_log.c b/net/ucx/files/patch-src_ucm_util_log.c new file mode 100644 index 000000000000..26c2a7d8044d --- /dev/null +++ b/net/ucx/files/patch-src_ucm_util_log.c @@ -0,0 +1,40 @@ +--- src/ucm/util/log.c.orig 2026-02-04 09:52:46 UTC ++++ src/ucm/util/log.c +@@ -13,6 +13,7 @@ + + #include + #include ++#include + #include + #include + #include +@@ -23,12 +24,21 @@ + #include + #include + #include ++#if defined(__FreeBSD__) ++#include ++#include ++#else + #include ++#endif + + #define UCM_LOG_BUF_SIZE 512 + + static int ucm_log_fileno = 1; /* stdout */ ++#if defined(__FreeBSD__) ++static char ucm_log_hostname[UCS_HOST_NAME_MAX] = {0}; ++#else + static char ucm_log_hostname[HOST_NAME_MAX] = {0}; ++#endif + + const char *ucm_log_level_names[] = { + [UCS_LOG_LEVEL_FATAL] = "FATAL", +@@ -47,7 +57,6 @@ const char *ucm_log_level_names[] = { + #define UCM_LOG_LTOA_FLAG_LONG UCS_BIT(2) /* long number */ + #define UCM_LOG_LTOA_FLAG_PAD0 UCS_BIT(3) /* pad with zeroes */ + #define UCM_LOG_LTOA_PAD_LEFT UCS_BIT(4) /* pad to left */ +- + + static char *ucm_log_add_padding(char *p, char *end, int pad, char fill) + { diff --git a/net/ucx/files/patch-src_ucm_util_reloc.c b/net/ucx/files/patch-src_ucm_util_reloc.c new file mode 100644 index 000000000000..436cc4bd600e --- /dev/null +++ b/net/ucx/files/patch-src_ucm_util_reloc.c @@ -0,0 +1,18 @@ +--- src/ucm/util/reloc.c.orig 2026-02-04 09:52:46 UTC ++++ src/ucm/util/reloc.c +@@ -673,10 +673,13 @@ static int ucm_dlclose(void *handle) + * cached information anyway, and it may be re-added on the next call to + * ucm_reloc_apply_patch(). + */ +- dl_name = ucm_reloc_get_dl_name(lm_entry->l_name, lm_entry->l_addr, ++ ElfW(Addr) dlpi_addr; ++ dlpi_addr = (ElfW(Addr))(uintptr_t)lm_entry->l_addr; ++ ++ dl_name = ucm_reloc_get_dl_name(lm_entry->l_name, dlpi_addr, + dl_name_buffer, sizeof(dl_name_buffer)); + pthread_mutex_lock(&ucm_reloc_patch_list_lock); +- ucm_reloc_dl_info_cleanup(lm_entry->l_addr, dl_name); ++ ucm_reloc_dl_info_cleanup(dlpi_addr, dl_name); + pthread_mutex_unlock(&ucm_reloc_patch_list_lock); + } + diff --git a/net/ucx/files/patch-src_ucm_util_replace.c b/net/ucx/files/patch-src_ucm_util_replace.c new file mode 100644 index 000000000000..c14023c8fe4b --- /dev/null +++ b/net/ucx/files/patch-src_ucm_util_replace.c @@ -0,0 +1,68 @@ +--- src/ucm/util/replace.c.orig 2026-02-04 09:52:46 UTC ++++ src/ucm/util/replace.c +@@ -55,8 +55,10 @@ UCM_DEFINE_REPLACE_FUNC(shmdt, int, -1, co + #endif + UCM_DEFINE_REPLACE_FUNC(shmat, void*, MAP_FAILED, int, const void*, int) + UCM_DEFINE_REPLACE_FUNC(shmdt, int, -1, const void*) ++#ifdef HAVE_BRK_SBRK + UCM_DEFINE_REPLACE_FUNC(sbrk, void*, MAP_FAILED, intptr_t) + UCM_DEFINE_REPLACE_FUNC(brk, int, -1, void*) ++#endif + UCM_DEFINE_REPLACE_FUNC(madvise, int, -1, void*, size_t, int) + + UCM_DEFINE_SELECT_FUNC(mmap, void*, SYS_mmap, void*, size_t, int, int, int, +@@ -122,6 +124,7 @@ int ucm_orig_shmdt(const void *shmaddr) + + #endif + ++#ifdef HAVE_BRK_SBRK + _UCM_DEFINE_DLSYM_FUNC(brk, ucm_orig_dlsym_brk, ucm_override_brk, int, void*) + + int ucm_orig_brk(void *addr) +@@ -156,7 +159,32 @@ void *ucm_orig_sbrk(intptr_t increment) + (void*)-1 : prev; + } + } ++#else ++int ucm_orig_brk(void *addr) ++{ ++ (void)addr; ++ errno = ENOSYS; ++ return -1; ++} + ++void *ucm_orig_sbrk(intptr_t increment) ++{ ++ (void)increment; ++ errno = ENOSYS; ++ return MAP_FAILED; ++} ++ ++int ucm_override_brk(void *addr) ++{ ++ return ucm_orig_brk(addr); ++} ++ ++void *ucm_override_sbrk(intptr_t increment) ++{ ++ return ucm_orig_sbrk(increment); ++} ++#endif ++ + #else /* UCM_BISTRO_HOOKS */ + + UCM_DEFINE_DLSYM_FUNC(brk, int, void*) +@@ -168,9 +196,13 @@ void *ucm_get_current_brk() + + void *ucm_get_current_brk() + { ++#ifdef HAVE_BRK_SBRK + #if HAVE___CURBRK + return __curbrk; + #else + return ucm_brk_syscall(0); ++#endif ++#else ++ return NULL; + #endif + } diff --git a/net/ucx/files/patch-src_ucm_util_sys.c b/net/ucx/files/patch-src_ucm_util_sys.c new file mode 100644 index 000000000000..8982c6fd9cda --- /dev/null +++ b/net/ucx/files/patch-src_ucm_util_sys.c @@ -0,0 +1,103 @@ +--- src/ucm/util/sys.c.orig 2026-02-04 09:52:46 UTC ++++ src/ucm/util/sys.c +@@ -21,10 +21,17 @@ + #include + #include + #include ++#ifdef HAVE_LINUX_MMAN_H + #include ++#endif + #include + #include ++#ifdef __linux__ + #include ++#elif defined(__FreeBSD__) ++#include ++#include ++#endif + #include + #include + #include +@@ -34,6 +41,24 @@ + + #define UCM_PROC_SELF_MAPS "/proc/self/maps" + ++#if !defined(__linux__) ++#include ++#include ++ ++void *ucm_orig_mremap(void *old_address, size_t old_size, size_t new_size, ++ int flags, void *new_address) ++{ ++ (void)old_address; ++ (void)old_size; ++ (void)new_size; ++ (void)flags; ++ (void)new_address; ++ ++ errno = ENOSYS; ++ return MAP_FAILED; ++} ++#endif ++ + ucm_global_config_t ucm_global_opts = { + .log_level = UCS_LOG_LEVEL_WARN, + .enable_events = 1, +@@ -136,7 +161,22 @@ void *ucm_sys_realloc(void *ptr, size_t size) + return ptr; + } + ++#if defined(__linux__) + newptr = ucm_orig_mremap(oldptr, oldsize, sys_size, MREMAP_MAYMOVE, NULL); ++#else ++ /* FreeBSD: no Linux mremap/MREMAP_MAYMOVE. Fallback: allocate+copy+unmap. ++ * If upper layers can tolerate "not supported", you can instead: ++ * errno = ENOTSUP; return MAP_FAILED; ++ */ ++ newptr = mmap(NULL, sys_size, PROT_READ | PROT_WRITE, ++ MAP_PRIVATE | MAP_ANON, -1, 0); ++ if (newptr != MAP_FAILED) { ++ size_t copy_sz = (oldsize < sys_size) ? oldsize : sys_size; ++ memcpy(newptr, oldptr, copy_sz); ++ munmap(oldptr, oldsize); ++ } ++#endif ++ + if (newptr == MAP_FAILED) { + ucm_error("mremap(oldptr=%p oldsize=%zu, newsize=%zu) failed: %m", + oldptr, oldsize, sys_size); +@@ -377,15 +417,31 @@ void *ucm_brk_syscall(void *addr) + + void *ucm_brk_syscall(void *addr) + { ++#if defined(__linux__) + /* Return type is equivalent to full pointer size */ + UCS_STATIC_ASSERT(sizeof(syscall(0)) == sizeof(void*)); +- + return (void*)syscall(SYS_brk, addr); ++#else ++ (void)addr; ++ errno = ENOSYS; ++ return NULL; ++#endif + } + +-pid_t ucm_get_tid() ++pid_t ucm_get_tid(void) + { +- return syscall(SYS_gettid); ++#if defined(__linux__) ++ return (pid_t)syscall(SYS_gettid); ++#elif defined(__FreeBSD__) ++ long tid; ++ if (thr_self(&tid) == 0) { ++ return (pid_t)tid; ++ } ++ /* fallback */ ++ return (pid_t)getpid(); ++#else ++ return (pid_t)getpid(); ++#endif + } + + void UCS_F_CTOR ucm_init() diff --git a/net/ucx/files/patch-src_ucm_util_sys.h b/net/ucx/files/patch-src_ucm_util_sys.h new file mode 100644 index 000000000000..9cdbf800eda0 --- /dev/null +++ b/net/ucx/files/patch-src_ucm_util_sys.h @@ -0,0 +1,11 @@ +--- src/ucm/util/sys.h.orig 2026-02-04 09:52:46 UTC ++++ src/ucm/util/sys.h +@@ -108,7 +108,7 @@ void *ucm_brk_syscall(void *addr); + /** + * @return System thread id of the current thread. + */ +-pid_t ucm_get_tid(); ++pid_t ucm_get_tid(void); + + + /** diff --git a/net/ucx/files/patch-src_ucp_core_ucp__worker.c b/net/ucx/files/patch-src_ucp_core_ucp__worker.c new file mode 100644 index 000000000000..dbb3d655732e --- /dev/null +++ b/net/ucx/files/patch-src_ucp_core_ucp__worker.c @@ -0,0 +1,127 @@ +--- src/ucp/core/ucp_worker.c.orig 2026-02-05 12:41:56 UTC ++++ src/ucp/core/ucp_worker.c +@@ -9,6 +9,8 @@ + # include "config.h" + #endif + ++#include ++ + #include "ucp_am.h" + #include "ucp_ep_vfs.h" + #include "ucp_worker.h" +@@ -35,9 +37,15 @@ + #include + #include + #include +-#include +-#include +-#include ++#if defined(HAVE_SYS_EVENTFD_H) ++# include ++#endif ++#if defined(HAVE_SYS_TIMERFD_H) ++# include ++#endif ++#if defined(__linux__) ++# include ++#endif + #include + + +@@ -320,6 +328,7 @@ static ucs_status_t ucp_worker_wakeup_init(ucp_worker_ + worker->flags |= UCP_WORKER_FLAG_EDGE_TRIGGERED; + } + ++#if defined(HAVE_SYS_EVENTFD_H) + worker->eventfd = eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK); + if (worker->eventfd == -1) { + ucs_error("Failed to create event fd: %m"); +@@ -328,6 +337,10 @@ static ucs_status_t ucp_worker_wakeup_init(ucp_worker_ + } + + ucp_worker_wakeup_ctl_fd(worker, UCP_WORKER_EPFD_OP_ADD, worker->eventfd); ++#else ++ /* No eventfd(). */ ++ worker->eventfd = -1; ++#endif *** 1878 LINES SKIPPED ***