-
Notifications
You must be signed in to change notification settings - Fork 745
libhns: Add support for LTTng tracing #1587
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
providers/hns/hns_roce_u_trace.c
Outdated
/* | ||
* Copyright (c) 2025 Hisilicon Limited. | ||
* | ||
* This software is available to you under a choice of one of two |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't add license text to new files. SPDX tag should be enough
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, fixed.
#include <lttng/tracepoint.h> | ||
#include <infiniband/verbs.h> | ||
|
||
#define rdma_tracepoint(arg...) lttng_ust_tracepoint(arg) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just asking, I see same line in many other drivers. Shouldn't it be placed in some common place?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, but not many drivers are supporting tracing for now though. We can do this if you want.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's do it as a followup patches, after we merge it.
providers/hns/libhns_trace.map
Outdated
@@ -0,0 +1,5 @@ | |||
/* Export symbols should be added below according to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
traces aren't exported symbols, they don't need map file.
providers/hns/CMakeLists.txt
Outdated
@@ -1,3 +1,10 @@ | |||
if (ENABLE_LTTNG AND LTTNGUST_FOUND) | |||
rdma_shared_provider(hns_trace libhns_trace.map |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regular libhns won't have dependency unless you build with -DENABLE_LTTNG, which is by default "false".
There is no need to create extra library just for tracing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Separating libhns_trace have some benefits:
- libhns can still be built with -DENABLE_LTTNG even if lttng is not installed.
- Applications directly relying on libhns (e.g., perftest) won't inherit the lttng dependency.
- Consistently separating trace libraries across all providers may allow enabling lttng in the release version of rdma-core, as regular libraries like libhns or libmlx5 won't introduce extra dependencies or performance impact. Users not needing traces can install rdma-core and run applications as usual, while trace users can simply install lttng and preload lib*_trace without rebuilding rdma-core
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see tracing as integral part of library. It is controlled through ENABLE_LTTNG.
Let's implement libhns tracing as any other providers and continue this discussion separately if you want.
providers/hns/hns_roce_u_hw_v2.c
Outdated
@@ -683,6 +684,65 @@ static int parse_cqe_for_cq(struct hns_roce_context *ctx, struct hns_roce_cq *cq | |||
return 0; | |||
} | |||
|
|||
static UNNEEDED uint8_t read_wc_sl(struct hns_roce_qp *hr_qp, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm aware that UNNEEDED keyword exist in our compiler.h file, but I still prefer to rely on LTTNG_ENABLED here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, fixed.
Add initial support for HNS LTTng tracing. Signed-off-by: wenglianfa <wenglianfa@huawei.com> Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com>
Add tracepoint for HNS RoCE I/O, including post_send, post_recv and poll_cq. Signed-off-by: wenglianfa <wenglianfa@huawei.com> Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com>
@rleon |
Add support for LTTng tracing. For now it is used for post_send, post_recv and poll_cq.