From: Denys Zikratyi -X (dzikraty - SOFTSERVE INC at Cisco) Date: Wed, 5 Mar 2025 15:46:55 +0000 (+0000) Subject: Pull request #4638: build: add version check for numactl library X-Git-Tag: 3.7.1.0~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c669cbe9f836fc31f179d06cf1fe31d84caf5217;p=thirdparty%2Fsnort3.git Pull request #4638: build: add version check for numactl library Merge in SNORT/snort3 from ~DZIKRATY/snort3:add_version_check_for_numactl to master Squashed commit of the following: commit 3bdbc66908dce164db28ec693021224e38d8263d Author: Denys Zikratyi -X (dzikraty - SOFTSERVE INC at Cisco) Date: Wed Feb 26 07:13:27 2025 -0500 build: add version check for numactl --- diff --git a/cmake/FindNUMA.cmake b/cmake/FindNUMA.cmake index f51836396..ab3c35085 100644 --- a/cmake/FindNUMA.cmake +++ b/cmake/FindNUMA.cmake @@ -1,23 +1,24 @@ -find_path(NUMA_INCLUDE_DIRS numa.h) -find_library(NUMA_LIBRARIES NAMES numa) +find_package(PkgConfig) +pkg_check_modules(PC_NUMA numa>=2.0.14) -if(NUMA_INCLUDE_DIRS AND NUMA_LIBRARIES) - set(NUMA_FOUND TRUE) - set(NUMA_LIBRARIES ${NUMA_LIBRARIES}) - set(NUMA_INCLUDE_DIRS ${NUMA_INCLUDE_DIRS}) -endif() - -if (NOT NUMA_FOUND) - find_package(PkgConfig) - pkg_check_modules(PC_NUMA libnuma) +if(PC_NUMA_FOUND) + find_path(NUMA_INCLUDE_DIRS + numa.h + HINTS ${NUMA_INCLUDE_DIR_HINT} ${PC_NUMA_INCLUDEDIR} + ) + find_library(NUMA_LIBRARIES + NAMES numa + HINTS ${NUMA_LIBRARIES_DIR_HINT} ${PC_NUMA_LIBDIR} + ) - if(PC_NUMA_FOUND) + if(NUMA_INCLUDE_DIRS AND NUMA_LIBRARIES) set(NUMA_FOUND TRUE) - set(NUMA_INCLUDE_DIRS ${PC_NUMA_INCLUDEDIR} ${PC_NUMA_INCLUDE_DIRS}) - set(NUMA_LIBRARIES ${PC_NUMA_LIBDIR} ${PC_NUMA_LIBRARY_DIRS}) + set(NUMA_LIBRARIES ${NUMA_LIBRARIES}) + set(NUMA_INCLUDE_DIRS ${NUMA_INCLUDE_DIRS}) endif() endif() + if(NUMA_FOUND) set(HAVE_NUMA "1") endif() @@ -25,4 +26,4 @@ endif() include(FindPackageHandleStandardArgs) find_package_handle_standard_args(NUMA DEFAULT_MSG NUMA_LIBRARIES NUMA_INCLUDE_DIRS) -mark_as_advanced(NUMA_INCLUDE_DIRS NUMA_LIBRARIES) \ No newline at end of file +mark_as_advanced(NUMA_INCLUDE_DIRS NUMA_LIBRARIES) diff --git a/configure_cmake.sh b/configure_cmake.sh index d75862828..a6a1b4e84 100755 --- a/configure_cmake.sh +++ b/configure_cmake.sh @@ -126,6 +126,10 @@ Optional Packages: --with-libml-libraries=DIR libml library directory --without-libml build Snort ML with mock of LibML + --with-libnuma-includes=DIR + libnuma include directory + --with-libnuma-libraries=DIR + libnuma library directory Some influential variable definitions: SIGNAL_SNORT_RELOAD= @@ -487,6 +491,12 @@ while [ $# -ne 0 ]; do --without-libml) append_cache_entry USE_LIBML_MOCK BOOL true ;; + --with-libnuma-includes=*) + append_cache_entry NUMA_INCLUDE_DIR_HINT PATH $optarg + ;; + --with-libnuma-libraries=*) + append_cache_entry NUMA_LIBRARIES_DIR_HINT PATH $optarg + ;; SIGNAL_SNORT_RELOAD=*) append_cache_entry SIGNAL_SNORT_RELOAD STRING $optarg ;; diff --git a/src/main/dev_notes.txt b/src/main/dev_notes.txt index a42602e34..f1e1f3dd7 100644 --- a/src/main/dev_notes.txt +++ b/src/main/dev_notes.txt @@ -70,12 +70,13 @@ the NUMA (Non Uniform Memory Access) policy that is supported by the Linux kernel. Preferred memory mode support for NUMA systems has been added. set_mempolicy() is used to establish the memory policy for packet threads operating on different nodes within a NUMA system. -The libnuma-dev library must be installed to enable this support. -In systems without NUMA architecture, this feature will not affect system -performance or behavior. This, alongside with libhwloc, presents an efficient -cross-platform mechanism for thread configuration and managing CPU affinity -of threads, not only considering CPU architecture but also memory access policies, -providing a more balanced and optimized execution environment. +The libnuma-dev library, version 2.0.14 or higher, must be installed to +enable this support. In systems without NUMA architecture, this feature +will not affect system performance or behavior. This, alongside with libhwloc, +presents an efficient cross-platform mechanism for thread configuration and +managing CPU affinity of threads, not only considering CPU architecture but +also memory access policies, providing a more balanced and optimized +execution environment. use of get_relative_instance_number() in thread.cc: