Skip to content
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

Accelerate attaching/detaching kprobes #277

Merged
merged 3 commits into from
Feb 26, 2024

Conversation

Asphaltt
Copy link
Contributor

@Asphaltt Asphaltt commented Oct 25, 2023

Fix #274

In order to accelerate attaching/detaching kprobes, do attach/detach kprobes concurrently. By concurrent way, it's a little faster than original way.

On my 6 CPU cores VM,

run by concurrent way:

2023/10/25 14:16:03 Attaching kprobes (via kprobe)...
1462 / 1462 [----------------------------------------------------------------------------------------------------] 100.00% 342 p/s
2023/10/25 14:16:07 Attached (ignored 0)
2023/10/25 14:16:07 Listening for events..
               SKB    CPU          PROCESS                     FUNC
^C2023/10/25 14:16:08 Received signal, exiting program..
2023/10/25 14:16:08 Detaching kprobes...
1462 / 1462 [-----------------------------------------------------------------------------------------------------] 100.00% 35 p/s

run by original way:

2023/10/25 14:17:27 Attaching kprobes (via kprobe)...
1462 / 1462 [----------------------------------------------------------------------------------------------------] 100.00% 282 p/s
2023/10/25 14:17:32 Attached (ignored 0)
2023/10/25 14:17:32 Listening for events..
               SKB    CPU          PROCESS                     FUNC
^C2023/10/25 14:17:33 Received signal, exiting program..
2023/10/25 14:17:33 Detaching kprobes...
1462 / 1462 [-----------------------------------------------------------------------------------------------------] 100.00% 21 p/s

@Asphaltt Asphaltt changed the title Accelerate attaching/detaching kprobes process Accelerate attaching/detaching kprobes Oct 25, 2023
@Asphaltt Asphaltt force-pushed the feature/accelerate_kprobe branch from 5e0a536 to 7db659a Compare October 25, 2023 15:08
@Asphaltt
Copy link
Contributor Author

Hi @jschwinger233 , could you give me a hand to check why it failed to run --filter-ifname case?

@brb
Copy link
Member

brb commented Oct 27, 2023

@Asphaltt Thanks for the PR! Could you rebase your PR against the latest origin/main? It should include Gray's ifname fixes.

@Asphaltt Asphaltt force-pushed the feature/accelerate_kprobe branch 2 times, most recently from 3c02b29 to 299fc47 Compare October 27, 2023 16:41
Copy link
Member

@brb brb left a comment

Choose a reason for hiding this comment

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

Thanks!

internal/pwru/kprobe.go Outdated Show resolved Hide resolved
main.go Show resolved Hide resolved
@Asphaltt Asphaltt force-pushed the feature/accelerate_kprobe branch 4 times, most recently from b388da2 to dc1371d Compare October 31, 2023 10:51
@Asphaltt
Copy link
Contributor Author

Asphaltt commented Nov 1, 2023

Hi, brb, I'll continue on this PR after my PTO. Thanks.

@brb
Copy link
Member

brb commented Nov 1, 2023

Hey @Asphaltt , sorry, I was lagging w/ reviews (ETOOBUSYATWORK). The bpf-next CI failure should be unrelated to your changes, as I am seeing the same failure on other branches. So, something got broken in the bpf-next kernel.

@brb
Copy link
Member

brb commented Nov 1, 2023

bpf-next failure - #284.

@Asphaltt Asphaltt force-pushed the feature/accelerate_kprobe branch from dc1371d to e06b603 Compare November 13, 2023 12:48
@jschwinger233
Copy link
Member

bpf-next-main failure looks like a lvh problem, I hit the same at another project. Using the latest version like bpf-next-20231030.012704 fixes it.

@brb
Copy link
Member

brb commented Dec 5, 2023

Yep, bpf-next is failing due to #284 (I haven't found time to fix it yet 😞 )

bpf-next-20231030.012704

Interesting. Could you grep calipso_skbuff_delattr /proc/kallsyms?

@brb
Copy link
Member

brb commented Feb 14, 2024

@Asphaltt Could you rebase?

@brb
Copy link
Member

brb commented Feb 16, 2024

@Asphaltt 👋 Could you rebase?

@Asphaltt
Copy link
Contributor Author

I will rebase it later, thx.

@Asphaltt Asphaltt force-pushed the feature/accelerate_kprobe branch from e06b603 to 0c12b8f Compare February 18, 2024 06:07
internal/pwru/kprobe.go Outdated Show resolved Hide resolved
In order to accelerate attaching/detaching kprobes, do attach/detach
kprobes concurrently. By concurrent way, it is a little faster than
original way.

On my 6 CPU cores VM,

run by concurrent way:

```
2023/10/25 14:16:03 Attaching kprobes (via kprobe)...
1462 / 1462 [----------------------------------------------------------------------------------------------------] 100.00% 342 p/s
2023/10/25 14:16:07 Attached (ignored 0)
2023/10/25 14:16:07 Listening for events..
               SKB    CPU          PROCESS                     FUNC
^C2023/10/25 14:16:08 Received signal, exiting program..
2023/10/25 14:16:08 Detaching kprobes...
1462 / 1462 [-----------------------------------------------------------------------------------------------------] 100.00% 35 p/s
```

run by original way:

```
2023/10/25 14:17:27 Attaching kprobes (via kprobe)...
1462 / 1462 [----------------------------------------------------------------------------------------------------] 100.00% 282 p/s
2023/10/25 14:17:32 Attached (ignored 0)
2023/10/25 14:17:32 Listening for events..
               SKB    CPU          PROCESS                     FUNC
^C2023/10/25 14:17:33 Received signal, exiting program..
2023/10/25 14:17:33 Detaching kprobes...
1462 / 1462 [-----------------------------------------------------------------------------------------------------] 100.00% 21 p/s
```

Signed-off-by: Leon Hwang <hffilwlqm@gmail.com>
Flush output file before closing it.

Signed-off-by: Leon Hwang <hffilwlqm@gmail.com>
Signed-off-by: Leon Hwang <hffilwlqm@gmail.com>
@Asphaltt Asphaltt force-pushed the feature/accelerate_kprobe branch from b7c00e3 to 4ebecc7 Compare February 23, 2024 14:45
@Asphaltt Asphaltt requested a review from a team as a code owner February 23, 2024 14:45
@Asphaltt Asphaltt requested review from jschwinger233 and removed request for a team February 23, 2024 14:45
Copy link
Member

@brb brb left a comment

Choose a reason for hiding this comment

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

Thanks!

@brb brb merged commit b47cfab into cilium:main Feb 26, 2024
6 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.

Would be nice if probe unloading was faster
3 participants