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

Add perf_submit_skb #670

Merged
merged 1 commit into from
Aug 24, 2016
Merged

Add perf_submit_skb #670

merged 1 commit into from
Aug 24, 2016

Conversation

iamkafai
Copy link
Contributor

For BPF_PROG_TYPE_SCHED_CLS/ACT, the upstream kernel has recently added a
feature to efficiently output skb + meta data:
commit 555c8a8623a3 ("bpf: avoid stack copy and use skb ctx for event output")

This patch adds perf_submit_skb to BPF_PERF_OUTPUT macro. It takes
an extra u32 argument. perf_submit_skb will then be expanded to
bpf_perf_event_output properly to consider the newly added
u32 argument as the skb's len.

Other than the above described changes, perf_submit_skb is almost
a carbon copy of the perf_submit except the removal of the 'string name'
variable since I cannot find a specific use of it.

Note that the 3rd param type of bpf_perf_event_output has also been
changed from u32 to u64.

@drzaeus77
Copy link
Collaborator

ok to test

@drzaeus77
Copy link
Collaborator

A test case showing the sample usage, perhaps?

For BPF_PROG_TYPE_SCHED_CLS/ACT, the upstream kernel has recently added a
feature to efficiently output skb + meta data:
commit 555c8a8623a3 ("bpf: avoid stack copy and use skb ctx for event output")

This patch adds perf_submit_skb to BPF_PERF_OUTPUT macro.  It takes
an extra u32 argument.  perf_submit_skb will then be expanded to
bpf_perf_event_output properly to consider the newly added
u32 argument as the skb's len.

Other than the above described changes, perf_submit_skb is almost
a carbon copy of the perf_submit except the removal of the 'string name'
variable since I cannot find a specific use of it.

Note that the 3rd param type of bpf_perf_event_output has also been
changed from u32 to u64.

Added a sample program tc_perf_event.py.  Here is how the output
looks like:
[root@arch-fb-vm1 networking]# ./tc_perf_event.py
Try: "ping -6 ff02::1%me"

CPU SRC IP                           DST IP       Magic
0   fe80::982f:5dff:fec1:e52b        ff02::1      0xfaceb00c
0   fe80::982f:5dff:fec1:e52b        ff02::1      0xfaceb00c
0   fe80::982f:5dff:fec1:e52b        ff02::1      0xfaceb00c
1   fe80::982f:5dff:fec1:e52b        ff02::1      0xfaceb00c
1   fe80::982f:5dff:fec1:e52b        ff02::1      0xfaceb00c
1   fe80::982f:5dff:fec1:e52b        ff02::1      0xfaceb00c
@iamkafai
Copy link
Contributor Author

Test failures seems to be unrelated?

19: .perf_event_open(/sys/kernel/debug/tracing/events/uprobes/p__lib_x86_64_linux_gnu_libc_so_6_0x86560/id): Cannot allocate memory
25: perf_event_open(/sys/kernel/debug/tracing/events/uprobes/p__lib_x86_64_linux_gnu_libc_so_6_0x86560/id): Cannot allocate memory

The following tests FAILED:
19 - py_uprobes (Failed)
25 - lua_test_uprobes (Failed)

@drzaeus77
Copy link
Collaborator

Yes, this is a known bug, actually I submitted a report and the fix should
show up in stable shortly. I'll reboot and retest in a few hours.

On Aug 23, 2016 8:27 PM, "Martin KaFai Lau" [email protected]
wrote:

Test failures seems to be unrelated?

19: .perf_event_open(/sys/kernel/debug/tracing/events/uprobes/
p__lib_x86_64_linux_gnu_libc_so_6_0x86560/id): Cannot allocate memory
25: perf_event_open(/sys/kernel/debug/tracing/events/uprobes/
p__lib_x86_64_linux_gnu_libc_so_6_0x86560/id): Cannot allocate memory

The following tests FAILED:
19 - py_uprobes (Failed)
25 - lua_test_uprobes (Failed)


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#670 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/ADmIvB4MwWlYhpxN4oUm4t_Xn_vfEc8fks5qi5AEgaJpZM4Jo_e-
.

@4ast
Copy link
Member

4ast commented Aug 24, 2016

LGTM. Thanks for the test!

@drzaeus77
Copy link
Collaborator

retest this please

@drzaeus77 drzaeus77 merged commit 96483d4 into iovisor:master Aug 24, 2016
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.

None yet

3 participants