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

libbpf-tools/offcputime: Use CO-RE operation to read kernel data #4471

Closed
wants to merge 1 commit into from

Conversation

ekyooo
Copy link
Contributor

@ekyooo ekyooo commented Feb 9, 2023

Use CO-RE API to read the value of a field from task_struct.

Signed-off-by: Eunseon Lee [email protected]

Use CO-RE API to read the value of a field from task_struct.

Signed-off-by: Eunseon Lee <[email protected]>
@@ -66,15 +66,15 @@ int BPF_PROG(sched_switch, bool preempt, struct task_struct *prev, struct task_s
u32 pid;

if (allow_record(prev)) {
pid = prev->pid;
pid = BPF_CORE_READ(prev, pid);
Copy link
Collaborator

Choose a reason for hiding this comment

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

tp_btf is BTF-awared, pointer chasing should work, right ?

Copy link
Contributor Author

@ekyooo ekyooo Feb 9, 2023

Choose a reason for hiding this comment

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

Oh... I didn't know that. Thank you for the information. Does tp_btf support depend on kernel version?
A segfault occurred when running the default version of offfcputime on my Linux v5.4 kernel environment. So I switched tp_btf to tracepoint as below. So this patch was needed.

-SEC("tp_btf/sched_switch")
+SEC("tracepoint/sched/sched_switch")

Could you please tell me if tp_btf is supported in Linux v5.4 as well?
Thank you in advance.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok. I got information from another engineer that tp_btf is not supported in Linux v5.4. I abandon this patch. Thank you.

Copy link
Collaborator

Choose a reason for hiding this comment

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

See #4231.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh..!! Thank you. I'll read it carefully.

@ekyooo ekyooo closed this Feb 9, 2023
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.

2 participants