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

Do not create instance for kprobe #1336

Merged
merged 1 commit into from
Sep 7, 2017
Merged

Conversation

palmtenor
Copy link
Member

@palmtenor palmtenor commented Sep 4, 2017

Logic to create instances when attach kprobes was introduced in #918 to address #872. However it is not necessary to do so, as creating separated kprobe events with different names would already allow multiple programs attached to same Kernel function.

On the other hand, creating instances leads to additional overhead on kprobe tracing, such as each instance would consume tens of megabytes of memories, and more complicated logic as we tried to address in #1262.

Therefore this commit removes instance logic from BCC. Also made a minor variable name change (new_name -> event_alias) to make the code more readable.

Tested by running multiple opensnoop and make sure they all work simoutanously.

Copy link
Collaborator

@yonghong-song yonghong-song left a comment

Choose a reason for hiding this comment

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

The change looks good to me. Tested both uprobe and kprobe with two different processes to the same kprobe and uprobe attachment point, it works fine.

Based on my understanding, the introduction of "instances" most for multiple "trace_pipe" so that tracing result does not need to cluster into the single top "trace_pipe". In our case, since we are using perf_event_open and rings for each event file descriptor. Looks like "instance" is not needed indeed.

cc @derek0883, the original author adding "instances". could you take a look as well?

@goldshtn
Copy link
Collaborator

goldshtn commented Sep 5, 2017

@yonghong-song We still have direct access to the trace pipe from BCC, but it was never a really great idea because other ftrace users could clobber the global trace pipe anyway. Perhaps we should even deprecate that API or get rid of it entirely.

@yonghong-song
Copy link
Collaborator

Right. Look at the "trace_pipe" usage from bcc. They are all from /sys/kernel/debug/tracing/trace_pipe, mostly probably for bpf_trace_printk purpose. Therefore, this should not interfere
with this patch.

I do agree that trace_print API is probably only for debugging purpose...

Copy link
Collaborator

@yonghong-song yonghong-song left a comment

Choose a reason for hiding this comment

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

LGTM

@4ast 4ast merged commit 6aec309 into iovisor:master Sep 7, 2017
@palmtenor palmtenor deleted the noinstance branch September 10, 2017 23:56
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

4 participants