Skip to content

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

Merged
merged 2 commits into from
Apr 22, 2025
Merged

Conversation

hginjgerx
Copy link

Add support for LTTng tracing. For now it is used for post_send, post_recv and poll_cq.

/*
* Copyright (c) 2025 Hisilicon Limited.
*
* This software is available to you under a choice of one of two
Copy link
Member

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

Copy link
Author

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)
Copy link
Member

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?

Copy link
Author

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.

Copy link
Member

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.

@@ -0,0 +1,5 @@
/* Export symbols should be added below according to
Copy link
Member

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.

@@ -1,3 +1,10 @@
if (ENABLE_LTTNG AND LTTNGUST_FOUND)
rdma_shared_provider(hns_trace libhns_trace.map
Copy link
Member

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.

Copy link
Author

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:

  1. libhns can still be built with -DENABLE_LTTNG even if lttng is not installed.
  2. Applications directly relying on libhns (e.g., perftest) won't inherit the lttng dependency.
  3. 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

Copy link
Member

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.

@@ -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,
Copy link
Member

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.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, fixed.

wenglianfa added 2 commits April 22, 2025 16:34
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>
@hginjgerx
Copy link
Author

hginjgerx commented Apr 22, 2025

@rleon
Comments above are fixed, thanks.

@rleon rleon merged commit 324c42e into linux-rdma:master Apr 22, 2025
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants