-
Notifications
You must be signed in to change notification settings - Fork 94
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
feat: AddRingBuf() using ring_buffer__add #430
Conversation
26b1112
to
f4f8407
Compare
@mighty1231 tks for this PR. There's a formatting issue https://github.com/aquasecurity/libbpfgo/pull/430/checks. As it is solved I'll stash it for later review. Tks again. |
f4f8407
to
2501f75
Compare
@geyslan I ran EDIT: with new amended commit, |
14e07f1
to
6b6b706
Compare
Failed test |
@mighty1231, I suspect that self-test/iter sometimes fails due to ping usage and internal network malfunction. Well, it seems like a flaky test. |
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.
@mighty1231 I tested it and it works nice. That's awesome.
I would just ask you to make the selftest more robust, since you have touched the logic of the slot (index) inside RingBuffer that's used by rwArray
which .
Would you mind to improve the the respective selftest to submit a greater volume of data through a greater number of slots (ringbuffers) not reusing the same data holder? I mean, try using more than one program to submit the data.
libbpfgo.c
Outdated
fprintf(stderr, "Failed to add ring buffer: %s\n", strerror(-ret)); | ||
return ret; |
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 use the same pattern of cgo_init_ring_buf regarding saving and restoring errno.
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 changed it.
libbpf provides ring_buffer__add to handle multiple ringbuf event callbacks - single RingBuffer object now handles multiple slots - implements AddRingBuf() for ring_buffer__add wrapper - updates ringbuffers selftest to show how to handle it Reference - https://github.com/torvalds/linux/blob/eb6a9339efeb6f3d2b5c86fdf2382cdc293eca2c/tools/testing/selftests/bpf/progs/test_ringbuf_multi.c - https://github.com/torvalds/linux/blob/eb6a9339efeb6f3d2b5c86fdf2382cdc293eca2c/tools/testing/selftests/bpf/prog_tests/ringbuf_multi.c#41
6b6b706
to
c0b5034
Compare
I am confused. Which of the following did you mean?
1 may be resolved with notifying the limitation for users. If it doesn't seem right, I would appreciate any feedback you may have. |
It would be awesome to have a huge amount of tests like ringbuf_multi. Anyway, I think it would take longer. I meant:
|
I don't know how to split the for-select loop, since I don't know golang much. And I didn't understand what is improved with new test. |
@NDStrahilevitz do you mind reviewing this? |
@mighty1231 I'm merging this. Thanks again for your contrib. |
libbpf provides ring_buffer__add to handle multiple ringbuf event callbacks
Reference