Implement runtime dynamic loading for RDMA libraries#284
Merged
Conversation
bjosv
reviewed
Feb 20, 2026
c9d3474 to
a32e4ee
Compare
Contributor
Author
|
@bjosv Thank you for the review! That makes perfect sense. I've updated the build files to follow the existing naming conventions and scopes:
|
Signed-off-by: Ada-Church-Closure <nunotabashinobu066@gmail.com>
a32e4ee to
ce73a2e
Compare
bjosv
approved these changes
Feb 23, 2026
zuiderkwast
pushed a commit
to valkey-io/valkey
that referenced
this pull request
Feb 26, 2026
…3072) This PR decouples the mandatory RDMA library dependency from `valkey-cli` and `valkey-benchmark` by implementing a **runtime dynamic loading (lazy loading)** mechanism. When `BUILD_RDMA=module` is used, the CLI tools are no longer hard-linked to `librdmacm` and `libibverbs`. Instead, these libraries are only loaded via `dlopen` when the `--rdma` flag is explicitly invoked by the user. - **Dynamic Symbol Loader**: Implemented a symbol loader in libvalkey using dlopen() and dlsym(), here: valkey-io/libvalkey#284. That was merged and libvalkey was updated in valkey to include this change. - **Build System Propagation**: - **Makefile**: When building as a module, pass `USE_DLOPEN_RDMA` flag to libvalkey's makefile. - **CMake**: When building as a module, pass `ENABLE_DLOPEN_RDMA` flag to libvalkey's CMake build. Fixes #3070 Signed-off-by: Ada-Church-Closure <nunotabashinobu066@gmail.com>
hpatro
pushed a commit
to hpatro/valkey
that referenced
this pull request
Mar 5, 2026
…alkey-io#3072) This PR decouples the mandatory RDMA library dependency from `valkey-cli` and `valkey-benchmark` by implementing a **runtime dynamic loading (lazy loading)** mechanism. When `BUILD_RDMA=module` is used, the CLI tools are no longer hard-linked to `librdmacm` and `libibverbs`. Instead, these libraries are only loaded via `dlopen` when the `--rdma` flag is explicitly invoked by the user. - **Dynamic Symbol Loader**: Implemented a symbol loader in libvalkey using dlopen() and dlsym(), here: valkey-io/libvalkey#284. That was merged and libvalkey was updated in valkey to include this change. - **Build System Propagation**: - **Makefile**: When building as a module, pass `USE_DLOPEN_RDMA` flag to libvalkey's makefile. - **CMake**: When building as a module, pass `ENABLE_DLOPEN_RDMA` flag to libvalkey's CMake build. Fixes valkey-io#3070 Signed-off-by: Ada-Church-Closure <nunotabashinobu066@gmail.com> Signed-off-by: Harkrishn Patro <bunty.hari@gmail.com>
hanzo-dev
pushed a commit
to hanzoai/kv
that referenced
this pull request
Jun 10, 2026
…3072) This PR decouples the mandatory RDMA library dependency from `valkey-cli` and `valkey-benchmark` by implementing a **runtime dynamic loading (lazy loading)** mechanism. When `BUILD_RDMA=module` is used, the CLI tools are no longer hard-linked to `librdmacm` and `libibverbs`. Instead, these libraries are only loaded via `dlopen` when the `--rdma` flag is explicitly invoked by the user. - **Dynamic Symbol Loader**: Implemented a symbol loader in libvalkey using dlopen() and dlsym(), here: valkey-io/libvalkey#284. That was merged and libvalkey was updated in valkey to include this change. - **Build System Propagation**: - **Makefile**: When building as a module, pass `USE_DLOPEN_RDMA` flag to libvalkey's makefile. - **CMake**: When building as a module, pass `ENABLE_DLOPEN_RDMA` flag to libvalkey's CMake build. Fixes #3070 Signed-off-by: Ada-Church-Closure <nunotabashinobu066@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements runtime dynamic loading (lazy loading) for RDMA libraries (
librdmacmandlibibverbs).This is the upstream port of the changes discussed and approved in the main Valkey repository (see valkey-io/valkey#3072).
Why this is needed
Currently, enabling RDMA support forces a hard compile-time dependency on RDMA libraries. This creates significant packaging overhead for Linux distributions that want to ship
valkey-cliandvalkey-benchmarkwithout forcing users to install RDMA drivers if they only use TCP/UNIX sockets.Implementation Details
struct rdma_dyn_syms): Replaced direct hard-linked function calls with a symbol table.#definemacros after including<rdma/rdma_cma.h>and<infiniband/verbs.h>. This avoids GCC redeclaration errors/namespace conflicts with the native prototypes while keeping all original call sites completely untouched.static inlinefunctions are intentionally excluded fromdlsymresolution to maintain performance and avoid missing-symbol errors on newerrdma-coreversions.CC: @zuiderkwast @pizhenwei @bjosv @michael-grunder
(As discussed in valkey#3072, porting these vendored changes back to the root
libvalkeyrepo).