-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
How to ensure perf buffer memory alignment? #2432
Comments
Note: If that's the case, then submitting aligned memory chunk should always result into read at aligned address, right? But we do saw unaligned pointer. :( |
A little bit more details: actual struct got written to the Perf Buffer is a
|
From @palmtenor explanation in the above, the |
Thanks All! 1 quick clarification: |
Hi All,
We have a struct used in C code, some thing like:
struct event {
u64 data;
} attribute((packed, aligned(8));
BPF_PERF_OUTPUT(events);
events.perf_submit(..., sizeof(event));
In the user space C++ code, we open the perf buffer with 8 pages:
BPF bpf;
bpf.open_perf_buffer(events, output_fn, loss_fn, cookie, 8);
When we read the data from perf buffer, we sometimes get unaligned pointers.
Because the submitted memory is 8 bytes, that means that the perf buffer's own memory is not aligned on 8 bytes.
Is there anyway we can ensure perf buffer's own memory alignment?
The text was updated successfully, but these errors were encountered: