providers: Fix static compilation error of lttng traceing

From: wenglianfa <wenglianfa@huawei.com> Currently static compilation with lttng tracing enabled fails with the following errors: In file included from /home/rdma-core/providers/rxe/rxe_trace.c:9: /rdma-core/providers/rxe/rxe_trace.h:12:38: fatal error: rxe_trace.h: No such file or directory 12 | #define LTTNG_UST_TRACEPOINT_INCLUDE "rxe_trace.h" | ^~~~~~~~~~~~~ compilation terminated. make[2]: *** [providers/rxe/CMakeFiles/rxe.dir/build.make:76: providers/rxe/CMakeFiles/rxe.dir/rxe_trace.c.o] Error 1 make[2]: *** Waiting for unfinished jobs.... In file included from /home/rdma-core/providers/efa/efa_trace.c:9: /home/rdma-core/providers/efa/efa_trace.h:12:38: fatal error: efa_trace.h: No such file or directory 12 | #define LTTNG_UST_TRACEPOINT_INCLUDE "efa_trace.h" | ^~~~~~~~~~~~~ compilation terminated. make[2]: *** [providers/efa/CMakeFiles/efa-static.dir/build.make:76: providers/efa/CMakeFiles/efa-static.dir/efa_trace.c.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:3085: providers/efa/CMakeFiles/efa-static.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs.... In file included from /home/rdma-core/providers/mlx5/mlx5_trace.c:9: /home/rdma-core/providers/mlx5/mlx5_trace.h:12:38: fatal error: mlx5_trace.h: No such file or directory 12 | #define LTTNG_UST_TRACEPOINT_INCLUDE "mlx5_trace.h" | ^~~~~~~~~~~~~~ compilation terminated. make[2]: *** [providers/mlx5/CMakeFiles/mlx5-static.dir/build.make:76: providers/mlx5/CMakeFiles/mlx5-static.dir/mlx5_trace.c.o] Error 1 make[2]: *** Waiting for unfinished jobs.... In file included from /home/rdma-core/providers/hns/hns_roce_u_trace.c:9: /home/rdma-core/providers/hns/hns_roce_u_trace.h:12:38: fatal error: hns_roce_u_trace.h: No such file or directory 12 | #define LTTNG_UST_TRACEPOINT_INCLUDE "hns_roce_u_trace.h" | ^~~~~~~~~~~~~~~~~~~~ compilation terminated. Fix it by linking the library and including drivers' directories for static compilation. Fixes: 382b359d990c ("efa: Add support for LTTng tracing") Signed-off-by: wenglianfa <wenglianfa@huawei.com> Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com> --- providers/efa/CMakeLists.txt | 4 ++++ providers/hns/CMakeLists.txt | 4 ++++ providers/mlx5/CMakeLists.txt | 4 ++++ providers/rxe/CMakeLists.txt | 4 ++++ 4 files changed, 16 insertions(+) diff --git a/providers/efa/CMakeLists.txt b/providers/efa/CMakeLists.txt index e999f3b77..865317446 100644 --- a/providers/efa/CMakeLists.txt +++ b/providers/efa/CMakeLists.txt @@ -18,4 +18,8 @@ rdma_pkg_config("efa" "libibverbs" "${CMAKE_THREAD_LIBS_INIT}") if (ENABLE_LTTNG AND LTTNGUST_FOUND) target_include_directories(efa PUBLIC ".") target_link_libraries(efa LINK_PRIVATE LTTng::UST) + if (ENABLE_STATIC) + target_include_directories(efa-static PUBLIC ".") + target_link_libraries(efa-static LINK_PRIVATE LTTng::UST) + endif() endif() diff --git a/providers/hns/CMakeLists.txt b/providers/hns/CMakeLists.txt index 36ebfacfb..7277cd65f 100644 --- a/providers/hns/CMakeLists.txt +++ b/providers/hns/CMakeLists.txt @@ -21,4 +21,8 @@ rdma_pkg_config("hns" "libibverbs" "${CMAKE_THREAD_LIBS_INIT}") if (ENABLE_LTTNG AND LTTNGUST_FOUND) target_include_directories(hns PUBLIC ".") target_link_libraries(hns LINK_PRIVATE LTTng::UST) + if (ENABLE_STATIC) + target_include_directories(hns-static PUBLIC ".") + target_link_libraries(hns-static LINK_PRIVATE LTTng::UST) + endif() endif() diff --git a/providers/mlx5/CMakeLists.txt b/providers/mlx5/CMakeLists.txt index 4a438d911..92f4e1b18 100644 --- a/providers/mlx5/CMakeLists.txt +++ b/providers/mlx5/CMakeLists.txt @@ -57,4 +57,8 @@ rdma_pkg_config("mlx5" "libibverbs" "${CMAKE_THREAD_LIBS_INIT}") if (ENABLE_LTTNG AND LTTNGUST_FOUND) target_include_directories(mlx5 PUBLIC ".") target_link_libraries(mlx5 LINK_PRIVATE LTTng::UST) + if (ENABLE_STATIC) + target_include_directories(mlx5-static PUBLIC ".") + target_link_libraries(mlx5-static LINK_PRIVATE LTTng::UST) + endif() endif() diff --git a/providers/rxe/CMakeLists.txt b/providers/rxe/CMakeLists.txt index 0fdc1cb3e..8a0a16842 100644 --- a/providers/rxe/CMakeLists.txt +++ b/providers/rxe/CMakeLists.txt @@ -10,4 +10,8 @@ rdma_provider(rxe if (ENABLE_LTTNG AND LTTNGUST_FOUND) target_include_directories("rxe-rdmav${IBVERBS_PABI_VERSION}" PUBLIC ".") target_link_libraries("rxe-rdmav${IBVERBS_PABI_VERSION}" LINK_PRIVATE LTTng::UST) + if (ENABLE_STATIC) + target_include_directories(rxe PUBLIC ".") + target_link_libraries(rxe LINK_PRIVATE LTTng::UST) + endif() endif() -- 2.33.0

From: wenglianfa <wenglianfa@huawei.com> Create extra provider libraries for tracing so that the regular libraries does not need to have a dependency on LTTng. For example, there will be a new libhns_trace-rdmav*.so for hns tracing. Usage example: $ lttng create my_session $ lttng enable-event -u rdma_core_hns:post_send $ lttng start $ LD_PRELOAD=/usr/lib64/libibverbs/libhns_trace-rdmav*.so ib_send_bw -d hns_0 $ LD_PRELOAD=/usr/lib64/libibverbs/libhns_trace-rdmav*.so ib_send_bw -d hns_0 10.10.10.10 $ lttng stop $ lttng view No additional dependencies or performance penalty will be introduced if users don't load the tracing library explicitly as shown above. This change involves all providers that support LTTng tracing, including efa, hns, mlx5 and rxe. Signed-off-by: wenglianfa <wenglianfa@huawei.com> Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com> --- libibverbs/verbs.h | 4 ++++ providers/efa/CMakeLists.txt | 11 +++++++---- providers/efa/efa_trace.c | 1 - providers/efa/verbs.c | 3 +++ providers/hns/CMakeLists.txt | 11 +++++++---- providers/hns/hns_roce_u_hw_v2.c | 3 +++ providers/hns/hns_roce_u_trace.c | 1 - providers/mlx5/CMakeLists.txt | 11 +++++++---- providers/mlx5/mlx5_trace.c | 1 - providers/mlx5/qp.c | 3 +++ providers/rxe/CMakeLists.txt | 11 +++++++---- providers/rxe/rxe.c | 3 +++ providers/rxe/rxe_trace.c | 1 - 13 files changed, 44 insertions(+), 20 deletions(-) diff --git a/libibverbs/verbs.h b/libibverbs/verbs.h index 47cdc067e..b8ed26470 100644 --- a/libibverbs/verbs.h +++ b/libibverbs/verbs.h @@ -2284,6 +2284,10 @@ extern const struct verbs_device_ops verbs_provider_qedr; extern const struct verbs_device_ops verbs_provider_rxe; extern const struct verbs_device_ops verbs_provider_siw; extern const struct verbs_device_ops verbs_provider_vmw_pvrdma; +extern const struct verbs_device_ops verbs_provider_efa_trace; +extern const struct verbs_device_ops verbs_provider_hns_trace; +extern const struct verbs_device_ops verbs_provider_mlx5_trace; +extern const struct verbs_device_ops verbs_provider_rxe_trace; extern const struct verbs_device_ops verbs_provider_all; extern const struct verbs_device_ops verbs_provider_none; void ibv_static_providers(void *unused, ...); diff --git a/providers/efa/CMakeLists.txt b/providers/efa/CMakeLists.txt index 865317446..12bac46ba 100644 --- a/providers/efa/CMakeLists.txt +++ b/providers/efa/CMakeLists.txt @@ -1,10 +1,11 @@ if (ENABLE_LTTNG AND LTTNGUST_FOUND) - set(TRACE_FILE efa_trace.c) + rdma_provider(efa_trace + efa_trace.c + ) endif() rdma_shared_provider(efa libefa.map 1 1.3.${PACKAGE_VERSION} - ${TRACE_FILE} efa.c verbs.c ) @@ -16,10 +17,12 @@ publish_headers(infiniband rdma_pkg_config("efa" "libibverbs" "${CMAKE_THREAD_LIBS_INIT}") if (ENABLE_LTTNG AND LTTNGUST_FOUND) - target_include_directories(efa PUBLIC ".") target_link_libraries(efa LINK_PRIVATE LTTng::UST) + target_include_directories(efa_trace-rdmav${IBVERBS_PABI_VERSION} PUBLIC ".") + target_link_libraries(efa_trace-rdmav${IBVERBS_PABI_VERSION} LINK_PRIVATE LTTng::UST) if (ENABLE_STATIC) - target_include_directories(efa-static PUBLIC ".") target_link_libraries(efa-static LINK_PRIVATE LTTng::UST) + target_include_directories(efa_trace PUBLIC ".") + target_link_libraries(efa_trace LINK_PRIVATE LTTng::UST) endif() endif() diff --git a/providers/efa/efa_trace.c b/providers/efa/efa_trace.c index 95178e4ba..4dbf91a74 100644 --- a/providers/efa/efa_trace.c +++ b/providers/efa/efa_trace.c @@ -4,6 +4,5 @@ */ #define LTTNG_UST_TRACEPOINT_CREATE_PROBES -#define LTTNG_UST_TRACEPOINT_DEFINE #include "efa_trace.h" diff --git a/providers/efa/verbs.c b/providers/efa/verbs.c index ddb1af989..ea1096e91 100644 --- a/providers/efa/verbs.c +++ b/providers/efa/verbs.c @@ -22,6 +22,9 @@ #include "efa_io_regs_defs.h" #include "efadv.h" #include "verbs.h" + +#define LTTNG_UST_TRACEPOINT_DEFINE +#define LTTNG_UST_TRACEPOINT_PROBE_DYNAMIC_LINKAGE #include "efa_trace.h" #define EFA_DEV_CAP(ctx, cap) \ diff --git a/providers/hns/CMakeLists.txt b/providers/hns/CMakeLists.txt index 7277cd65f..c06611a57 100644 --- a/providers/hns/CMakeLists.txt +++ b/providers/hns/CMakeLists.txt @@ -1,10 +1,11 @@ if (ENABLE_LTTNG AND LTTNGUST_FOUND) - set(TRACE_FILE hns_roce_u_trace.c) + rdma_provider(hns_trace + hns_roce_u_trace.c + ) endif() rdma_shared_provider(hns libhns.map 1 1.0.${PACKAGE_VERSION} - ${TRACE_FILE} hns_roce_u.c hns_roce_u_buf.c hns_roce_u_db.c @@ -19,10 +20,12 @@ publish_headers(infiniband rdma_pkg_config("hns" "libibverbs" "${CMAKE_THREAD_LIBS_INIT}") if (ENABLE_LTTNG AND LTTNGUST_FOUND) - target_include_directories(hns PUBLIC ".") target_link_libraries(hns LINK_PRIVATE LTTng::UST) + target_include_directories(hns_trace-rdmav${IBVERBS_PABI_VERSION} PUBLIC ".") + target_link_libraries(hns_trace-rdmav${IBVERBS_PABI_VERSION} LINK_PRIVATE LTTng::UST) if (ENABLE_STATIC) - target_include_directories(hns-static PUBLIC ".") target_link_libraries(hns-static LINK_PRIVATE LTTng::UST) + target_include_directories(hns_trace PUBLIC ".") + target_link_libraries(hns_trace LINK_PRIVATE LTTng::UST) endif() endif() diff --git a/providers/hns/hns_roce_u_hw_v2.c b/providers/hns/hns_roce_u_hw_v2.c index 784841f43..9a12183d8 100644 --- a/providers/hns/hns_roce_u_hw_v2.c +++ b/providers/hns/hns_roce_u_hw_v2.c @@ -38,6 +38,9 @@ #include "hns_roce_u.h" #include "hns_roce_u_db.h" #include "hns_roce_u_hw_v2.h" + +#define LTTNG_UST_TRACEPOINT_DEFINE +#define LTTNG_UST_TRACEPOINT_PROBE_DYNAMIC_LINKAGE #include "hns_roce_u_trace.h" #define HR_IBV_OPC_MAP(ib_key, hr_key) \ diff --git a/providers/hns/hns_roce_u_trace.c b/providers/hns/hns_roce_u_trace.c index 812f54cfe..aa66d3856 100644 --- a/providers/hns/hns_roce_u_trace.c +++ b/providers/hns/hns_roce_u_trace.c @@ -4,6 +4,5 @@ */ #define LTTNG_UST_TRACEPOINT_CREATE_PROBES -#define LTTNG_UST_TRACEPOINT_DEFINE #include "hns_roce_u_trace.h" diff --git a/providers/mlx5/CMakeLists.txt b/providers/mlx5/CMakeLists.txt index 92f4e1b18..47e0f601a 100644 --- a/providers/mlx5/CMakeLists.txt +++ b/providers/mlx5/CMakeLists.txt @@ -11,12 +11,13 @@ if (MLX5_MW_DEBUG) endif() if (ENABLE_LTTNG AND LTTNGUST_FOUND) - set(TRACE_FILE mlx5_trace.c) + rdma_provider(mlx5_trace + mlx5_trace.c +) endif() rdma_shared_provider(mlx5 libmlx5.map 1 1.25.${PACKAGE_VERSION} - ${TRACE_FILE} buf.c cq.c dbrec.c @@ -55,10 +56,12 @@ publish_headers(infiniband rdma_pkg_config("mlx5" "libibverbs" "${CMAKE_THREAD_LIBS_INIT}") if (ENABLE_LTTNG AND LTTNGUST_FOUND) - target_include_directories(mlx5 PUBLIC ".") target_link_libraries(mlx5 LINK_PRIVATE LTTng::UST) + target_include_directories(mlx5_trace-rdmav${IBVERBS_PABI_VERSION} PUBLIC ".") + target_link_libraries(mlx5_trace-rdmav${IBVERBS_PABI_VERSION} LINK_PRIVATE LTTng::UST) if (ENABLE_STATIC) - target_include_directories(mlx5-static PUBLIC ".") target_link_libraries(mlx5-static LINK_PRIVATE LTTng::UST) + target_include_directories(mlx5_trace PUBLIC ".") + target_link_libraries(mlx5_trace LINK_PRIVATE LTTng::UST) endif() endif() diff --git a/providers/mlx5/mlx5_trace.c b/providers/mlx5/mlx5_trace.c index 07917f620..3b6e88929 100644 --- a/providers/mlx5/mlx5_trace.c +++ b/providers/mlx5/mlx5_trace.c @@ -4,6 +4,5 @@ */ #define LTTNG_UST_TRACEPOINT_CREATE_PROBES -#define LTTNG_UST_TRACEPOINT_DEFINE #include "mlx5_trace.h" diff --git a/providers/mlx5/qp.c b/providers/mlx5/qp.c index 76e1a428b..c38e6f26d 100644 --- a/providers/mlx5/qp.c +++ b/providers/mlx5/qp.c @@ -42,6 +42,9 @@ #include "mlx5.h" #include "mlx5_ifc.h" + +#define LTTNG_UST_TRACEPOINT_DEFINE +#define LTTNG_UST_TRACEPOINT_PROBE_DYNAMIC_LINKAGE #include "mlx5_trace.h" #include "wqe.h" diff --git a/providers/rxe/CMakeLists.txt b/providers/rxe/CMakeLists.txt index 8a0a16842..77e82b21c 100644 --- a/providers/rxe/CMakeLists.txt +++ b/providers/rxe/CMakeLists.txt @@ -1,17 +1,20 @@ if (ENABLE_LTTNG AND LTTNGUST_FOUND) - set(TRACE_FILE rxe_trace.c) + rdma_provider(rxe_trace + rxe_trace.c + ) endif() rdma_provider(rxe - ${TRACE_FILE} rxe.c ) if (ENABLE_LTTNG AND LTTNGUST_FOUND) - target_include_directories("rxe-rdmav${IBVERBS_PABI_VERSION}" PUBLIC ".") target_link_libraries("rxe-rdmav${IBVERBS_PABI_VERSION}" LINK_PRIVATE LTTng::UST) + target_include_directories("rxe_trace-rdmav${IBVERBS_PABI_VERSION}" PUBLIC ".") + target_link_libraries("rxe_trace-rdmav${IBVERBS_PABI_VERSION}" LINK_PRIVATE LTTng::UST) if (ENABLE_STATIC) - target_include_directories(rxe PUBLIC ".") target_link_libraries(rxe LINK_PRIVATE LTTng::UST) + target_include_directories("rxe_trace" PUBLIC ".") + target_link_libraries("rxe_trace" LINK_PRIVATE LTTng::UST) endif() endif() diff --git a/providers/rxe/rxe.c b/providers/rxe/rxe.c index 306c7796d..e2b825085 100644 --- a/providers/rxe/rxe.c +++ b/providers/rxe/rxe.c @@ -55,6 +55,9 @@ #include "rxe_queue.h" #include "rxe-abi.h" #include "rxe.h" + +#define LTTNG_UST_TRACEPOINT_DEFINE +#define LTTNG_UST_TRACEPOINT_PROBE_DYNAMIC_LINKAGE #include "rxe_trace.h" static void rxe_free_context(struct ibv_context *ibctx); diff --git a/providers/rxe/rxe_trace.c b/providers/rxe/rxe_trace.c index a2f9fab2f..71cefc54e 100644 --- a/providers/rxe/rxe_trace.c +++ b/providers/rxe/rxe_trace.c @@ -4,6 +4,5 @@ */ #define LTTNG_UST_TRACEPOINT_CREATE_PROBES -#define LTTNG_UST_TRACEPOINT_DEFINE #include "rxe_trace.h" -- 2.33.0

From: wenglianfa <wenglianfa@huawei.com> Define rdma_tracepoint() in the common trace.h to remove duplicate definition in drivers. Signed-off-by: wenglianfa <wenglianfa@huawei.com> Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com> --- libibverbs/CMakeLists.txt | 1 + libibverbs/trace.h | 22 ++++++++++++++++++++++ providers/efa/efa_trace.h | 4 ---- providers/efa/verbs.c | 1 + providers/hns/hns_roce_u_hw_v2.c | 1 + providers/hns/hns_roce_u_trace.h | 4 ---- providers/mlx5/mlx5_trace.h | 4 ---- providers/mlx5/qp.c | 1 + providers/rxe/rxe.c | 1 + providers/rxe/rxe_trace.h | 4 ---- 10 files changed, 27 insertions(+), 16 deletions(-) create mode 100644 libibverbs/trace.h diff --git a/libibverbs/CMakeLists.txt b/libibverbs/CMakeLists.txt index 3c486b9ae..2b7be5e13 100644 --- a/libibverbs/CMakeLists.txt +++ b/libibverbs/CMakeLists.txt @@ -14,6 +14,7 @@ publish_internal_headers(infiniband driver.h kern-abi.h marshall.h + trace.h ) configure_file("libibverbs.map.in" diff --git a/libibverbs/trace.h b/libibverbs/trace.h new file mode 100644 index 000000000..db10661fd --- /dev/null +++ b/libibverbs/trace.h @@ -0,0 +1,22 @@ +/* SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause */ +/* + * Copyright (c) 2025 Hisilicon Limited. + */ + +#ifndef _TRACE_H +#define _TRACE_H + +#if defined(LTTNG_ENABLED) + +#include <lttng/tracepoint.h> + +#define rdma_tracepoint(arg...) lttng_ust_tracepoint(arg) + +#else + +#define rdma_tracepoint(arg...) + +#endif /* defined(LTTNG_ENABLED) */ + +#endif /* _TRACE_H */ + diff --git a/providers/efa/efa_trace.h b/providers/efa/efa_trace.h index 061848c64..0dc89c82a 100644 --- a/providers/efa/efa_trace.h +++ b/providers/efa/efa_trace.h @@ -103,8 +103,6 @@ LTTNG_UST_TRACEPOINT_EVENT( ) ) -#define rdma_tracepoint(arg...) lttng_ust_tracepoint(arg) - #endif /* __EFA_TRACE_H__*/ #include <lttng/tracepoint-event.h> @@ -114,8 +112,6 @@ LTTNG_UST_TRACEPOINT_EVENT( #ifndef __EFA_TRACE_H__ #define __EFA_TRACE_H__ -#define rdma_tracepoint(arg...) - #endif /* __EFA_TRACE_H__*/ #endif /* defined(LTTNG_ENABLED) */ diff --git a/providers/efa/verbs.c b/providers/efa/verbs.c index ea1096e91..d7605c8ad 100644 --- a/providers/efa/verbs.c +++ b/providers/efa/verbs.c @@ -26,6 +26,7 @@ #define LTTNG_UST_TRACEPOINT_DEFINE #define LTTNG_UST_TRACEPOINT_PROBE_DYNAMIC_LINKAGE #include "efa_trace.h" +#include <infiniband/trace.h> #define EFA_DEV_CAP(ctx, cap) \ ((ctx)->device_caps & EFA_QUERY_DEVICE_CAPS_##cap) diff --git a/providers/hns/hns_roce_u_hw_v2.c b/providers/hns/hns_roce_u_hw_v2.c index 9a12183d8..da8451534 100644 --- a/providers/hns/hns_roce_u_hw_v2.c +++ b/providers/hns/hns_roce_u_hw_v2.c @@ -42,6 +42,7 @@ #define LTTNG_UST_TRACEPOINT_DEFINE #define LTTNG_UST_TRACEPOINT_PROBE_DYNAMIC_LINKAGE #include "hns_roce_u_trace.h" +#include <infiniband/trace.h> #define HR_IBV_OPC_MAP(ib_key, hr_key) \ [IBV_WR_ ## ib_key] = HNS_ROCE_WQE_OP_ ## hr_key diff --git a/providers/hns/hns_roce_u_trace.h b/providers/hns/hns_roce_u_trace.h index 465498548..cd961f1cb 100644 --- a/providers/hns/hns_roce_u_trace.h +++ b/providers/hns/hns_roce_u_trace.h @@ -115,8 +115,6 @@ LTTNG_UST_TRACEPOINT_EVENT( ) ) -#define rdma_tracepoint(arg...) lttng_ust_tracepoint(arg) - #endif /* __HNS_TRACE_H__*/ #include <lttng/tracepoint-event.h> @@ -126,8 +124,6 @@ LTTNG_UST_TRACEPOINT_EVENT( #ifndef __HNS_TRACE_H__ #define __HNS_TRACE_H__ -#define rdma_tracepoint(arg...) - #endif /* __HNS_TRACE_H__*/ #endif /* defined(LTTNG_ENABLED) */ diff --git a/providers/mlx5/mlx5_trace.h b/providers/mlx5/mlx5_trace.h index 1397f2b21..e0899a62e 100644 --- a/providers/mlx5/mlx5_trace.h +++ b/providers/mlx5/mlx5_trace.h @@ -41,8 +41,6 @@ LTTNG_UST_TRACEPOINT_EVENT( ) ) -#define rdma_tracepoint(arg...) lttng_ust_tracepoint(arg) - #endif /* __MLX5_TRACE_H__*/ #include <lttng/tracepoint-event.h> @@ -52,8 +50,6 @@ LTTNG_UST_TRACEPOINT_EVENT( #ifndef __MLX5_TRACE_H__ #define __MLX5_TRACE_H__ -#define rdma_tracepoint(arg...) - #endif /* __MLX5_TRACE_H__*/ #endif /* defined(LTTNG_ENABLED) */ diff --git a/providers/mlx5/qp.c b/providers/mlx5/qp.c index c38e6f26d..aac9c867c 100644 --- a/providers/mlx5/qp.c +++ b/providers/mlx5/qp.c @@ -46,6 +46,7 @@ #define LTTNG_UST_TRACEPOINT_DEFINE #define LTTNG_UST_TRACEPOINT_PROBE_DYNAMIC_LINKAGE #include "mlx5_trace.h" +#include <infiniband/trace.h> #include "wqe.h" #define MLX5_ATOMIC_SIZE 8 diff --git a/providers/rxe/rxe.c b/providers/rxe/rxe.c index e2b825085..a0e97c7e8 100644 --- a/providers/rxe/rxe.c +++ b/providers/rxe/rxe.c @@ -59,6 +59,7 @@ #define LTTNG_UST_TRACEPOINT_DEFINE #define LTTNG_UST_TRACEPOINT_PROBE_DYNAMIC_LINKAGE #include "rxe_trace.h" +#include <infiniband/trace.h> static void rxe_free_context(struct ibv_context *ibctx); diff --git a/providers/rxe/rxe_trace.h b/providers/rxe/rxe_trace.h index 7568c1561..61d3be437 100644 --- a/providers/rxe/rxe_trace.h +++ b/providers/rxe/rxe_trace.h @@ -41,8 +41,6 @@ LTTNG_UST_TRACEPOINT_EVENT( ) ) -#define rdma_tracepoint(arg...) lttng_ust_tracepoint(arg) - #endif /* __RXE_TRACE_H__*/ #include <lttng/tracepoint-event.h> @@ -52,8 +50,6 @@ LTTNG_UST_TRACEPOINT_EVENT( #ifndef __RXE_TRACE_H__ #define __RXE_TRACE_H__ -#define rdma_tracepoint(arg...) - #endif /* __RXE_TRACE_H__*/ #endif /* defined(LTTNG_ENABLED) */ -- 2.33.0

From: wenglianfa <wenglianfa@huawei.com> Now that tracing libraries has been separated from regular providers libraries, enabling LTTng tracing by default has become feasible for release version rdma-core. Users can customize the installation of the tracing libraries according to their needs, improving the usability. Signed-off-by: wenglianfa <wenglianfa@huawei.com> Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com> --- debian/control | 20 ++++++++++++++++++++ debian/ibverbs-providers.install | 18 +++++++++++++++++- debian/ibverbs-trace.install | 1 + debian/rules | 2 +- redhat/rdma-core.spec | 15 +++++++++++++++ suse/rdma-core.spec | 16 ++++++++++++++++ 6 files changed, 70 insertions(+), 2 deletions(-) create mode 100644 debian/ibverbs-trace.install diff --git a/debian/control b/debian/control index e074c0ca5..90c77c25b 100644 --- a/debian/control +++ b/debian/control @@ -18,6 +18,7 @@ Build-Depends: cmake (>= 2.8.11), pkg-config, python3-dev, python3-docutils, + liblttng-ust-dev (>= 2.13.0), valgrind [amd64 arm64 armhf i386 mips mips64el mipsel powerpc ppc64 ppc64el s390x] Rules-Requires-Root: no Standards-Version: 4.7.0 @@ -116,6 +117,25 @@ Description: Examples for the libibverbs library This package contains useful libibverbs1 example programs such as ibv_devinfo, which displays information about InfiniBand devices. +Package: ibverbs-trace +Section: libs +Architecture: linux-any +Multi-Arch: same +Depends: liblttng-ust1 (>= 2.13.0) + ${misc:Depends}, + ${shlibs:Depends} +Description: Trace for the libibverbs library + libibverbs is a library that allows userspace processes to use RDMA + "verbs" as described in the InfiniBand Architecture Specification and + the RDMA Protocol Verbs Specification. iWARP ethernet NICs support + RDMA over hardware-offloaded TCP/IP, while InfiniBand is a + high-throughput, low-latency networking technology. InfiniBand host + channel adapters (HCAs) and iWARP NICs commonly support direct + hardware access from userspace (kernel bypass), and libibverbs + supports this when available. + . + This package contains trace libraries for libibverbs1. + Package: libibverbs-dev Section: libdevel Architecture: linux-any diff --git a/debian/ibverbs-providers.install b/debian/ibverbs-providers.install index 42e939aed..1d9cf1616 100644 --- a/debian/ibverbs-providers.install +++ b/debian/ibverbs-providers.install @@ -1,7 +1,23 @@ etc/libibverbs.d/ usr/lib/*/libefa.so.* usr/lib/*/libhns.so.* -usr/lib/*/libibverbs/lib*-rdmav*.so usr/lib/*/libmana.so.* usr/lib/*/libmlx4.so.* usr/lib/*/libmlx5.so.* +usr/lib/*/libibverbs/libbnxt_re-rdmav*.so +usr/lib/*/libibverbs/libcxgb4-rdmav*.so +usr/lib/*/libibverbs/libefa-rdmav*.so +usr/lib/*/libibverbs/liberdma-rdmav*.so +usr/lib/*/libibverbs/libhfi1verbs-rdmav*.so +usr/lib/*/libibverbs/libhns-rdmav*.so +usr/lib/*/libibverbs/libipathverbs-rdmav*.so +usr/lib/*/libibverbs/libirdma-rdmav*.so +usr/lib/*/libibverbs/libmana-rdmav*.so +usr/lib/*/libibverbs/libmlx4-rdmav*.so +usr/lib/*/libibverbs/libmlx5-rdmav*.so +usr/lib/*/libibverbs/libmthca-rdmav*.so +usr/lib/*/libibverbs/libocrdma-rdmav*.so +usr/lib/*/libibverbs/libqedr-rdmav*.so +usr/lib/*/libibverbs/librxe-rdmav*.so +usr/lib/*/libibverbs/libsiw-rdmav*.so +usr/lib/*/libibverbs/libvmw_pvrdma-rdmav*.so diff --git a/debian/ibverbs-trace.install b/debian/ibverbs-trace.install new file mode 100644 index 000000000..b1231279f --- /dev/null +++ b/debian/ibverbs-trace.install @@ -0,0 +1 @@ +usr/lib/*/libibverbs/lib*trace-rdmav*.so diff --git a/debian/rules b/debian/rules index 628f64923..57215945a 100755 --- a/debian/rules +++ b/debian/rules @@ -37,6 +37,7 @@ DH_AUTO_CONFIGURE := "--" \ "-DCMAKE_INSTALL_UDEV_RULESDIR:PATH=/lib/udev/rules.d" \ "-DCMAKE_INSTALL_PERLDIR:PATH=/usr/share/perl5" \ "-DENABLE_STATIC=1" \ + "-DENABLE_LTTNG=1" \ $(EXTRA_CMAKE_FLAGS) override_dh_auto_configure: @@ -49,7 +50,6 @@ override_dh_auto_configure: -DNO_PYVERBS=1; \ fi - override_dh_auto_build: ninja -C build-deb -v diff --git a/redhat/rdma-core.spec b/redhat/rdma-core.spec index aa9defae6..d2a752884 100644 --- a/redhat/rdma-core.spec +++ b/redhat/rdma-core.spec @@ -87,6 +87,8 @@ BuildRequires: make BuildRequires: pandoc %endif +BuildRequires: lttng-ust-devel >= 2.13.0 + %description RDMA core userspace infrastructure and documentation, including initialization scripts, kernel driver-specific modprobe override configs, IPoIB network @@ -211,6 +213,14 @@ Requires: libibverbs%{?_isa} = %{version}-%{release} Useful libibverbs example programs such as ibv_devinfo, which displays information about RDMA devices. +%package -n libibverbs-trace +Summary: libibverbs tracing library +Requires: libibverbs%{?_isa} = %{version}-%{release} +Requires: lttng-ust >= 2.13.0 + +%description -n libibverbs-trace +Library for IO path tracing. + %package -n ibacm Summary: InfiniBand Communication Manager Assistant Requires(post): systemd-units @@ -322,6 +332,7 @@ easy, object-oriented access to IB verbs. -DPYTHON_EXECUTABLE:PATH=%{__python3} \ -DCMAKE_INSTALL_PYTHON_ARCH_LIB:PATH=%{python3_sitearch} \ %endif + -DENABLE_LTTNG=1 \ %if %{with_pyverbs} -DNO_PYVERBS=0 %else @@ -599,11 +610,15 @@ fi %{_libdir}/libmlx4.so.* %config(noreplace) %{_sysconfdir}/libibverbs.d/*.driver %doc %{_docdir}/%{name}/libibverbs.md +%exclude %{_libdir}/libibverbs/*trace*.so %files -n libibverbs-utils %{_bindir}/ibv_* %{_mandir}/man1/ibv_* +%files -n libibverbs-trace +%{_libdir}/libibverbs/*trace*.so + %files -n ibacm %config(noreplace) %{_sysconfdir}/rdma/ibacm_opts.cfg %{_bindir}/ib_acme diff --git a/suse/rdma-core.spec b/suse/rdma-core.spec index 8c125ab54..043fb3fdc 100644 --- a/suse/rdma-core.spec +++ b/suse/rdma-core.spec @@ -146,6 +146,8 @@ BuildRequires: make %define cmake_install DESTDIR=%{buildroot} make install %endif +BuildRequires: lttng-ust-devel >= 2.13.0 + %description RDMA core userspace infrastructure and documentation, including initialization scripts, kernel driver-specific modprobe override configs, IPoIB network @@ -306,6 +308,15 @@ Requires: libibverbs%{?_isa} = %{version} Useful libibverbs example programs such as ibv_devinfo, which displays information about RDMA devices. +%package -n libibverbs-trace +Summary: libibverbs tracing library +Group: Productivity/Networking/Diagnostic +Requires: libibverbs%{?_isa} = %{version}-%{release} +Requires: lttng-ust >= 2.13.0 + +%description -n libibverbs-trace +Library for IO path tracing. + %package -n ibacm Summary: InfiniBand Communication Manager Assistant Group: Productivity/Networking/Other @@ -467,6 +478,7 @@ easy, object-oriented access to IB verbs. -DPYTHON_EXECUTABLE:PATH=%{__python3} \ -DCMAKE_INSTALL_PYTHON_ARCH_LIB:PATH=%{python3_sitearch} \ %endif + -DENABLE_LTTNG=1 \ %if %{with_pyverbs} -DNO_PYVERBS=0 %else @@ -707,6 +719,7 @@ done %doc %{_docdir}/%{name}-%{version}/rxe.md %doc %{_docdir}/%{name}-%{version}/tag_matching.md %{_mandir}/man7/rxe* +%exclude %{_libdir}/libibverbs/*trace*.so %files -n libibnetdisc%{ibnetdisc_major} %{_libdir}/libibnetdisc.so.* @@ -739,6 +752,9 @@ done %{_bindir}/ibv_* %{_mandir}/man1/ibv_* +%files -n libibverbs-trace +%{_libdir}/libibverbs/*trace*.so + %files -n ibacm %config(noreplace) %{_sysconfdir}/rdma/ibacm_opts.cfg %{_bindir}/ib_acme -- 2.33.0
participants (1)
-
Junxian Huang