Skip to content

fix(ebpf): start profiling after attaching perf reader #2812

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 1 commit into from
Dec 7, 2023

Conversation

korniltsev
Copy link
Collaborator

There was a tiny time window when we already attach ebpf program to perf event (start profiling) and not yet attached a reader for pid info requests.

So this line some times return 2 (ENOENT) instead of 0, causing userspace program miss some processes to profile.

bpf_perf_event_output(ctx, &events, BPF_F_CURRENT_CPU, &event, sizeof(event));

This PR changes order of enabling profiling - start reading events first, then start profiling

Copy link
Collaborator

@kolesnikovae kolesnikovae left a comment

Choose a reason for hiding this comment

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

LGTM

@korniltsev korniltsev merged commit 9826831 into main Dec 7, 2023
@korniltsev korniltsev deleted the ebpf-race-fix branch December 7, 2023 06:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants