Skip to content

Commit

Permalink
bcc/libbpf-tools: Replace bpf_probe_read with bpf_probe_read_kernel.
Browse files Browse the repository at this point in the history
As kernel commit b8ebce86ffe6 ("libbpf: Provide CO-RE variants of
PT_REGS macros") is introduced after bpf_probe_read_kernel changes, it
is safe to use bpf_probe_read_kernel directly

Signed-off-by: Sumanth Korikkar <[email protected]>
Acked-by: Ilya Leoshkevich <[email protected]>
  • Loading branch information
sumanthkorikkar authored and yonghong-song committed May 25, 2020
1 parent 747e0dd commit d958381
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion libbpf-tools/drsnoop.bpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ int handle__mm_vmscan_direct_reclaim_begin(u64 *ctx)

piddata.ts = bpf_ktime_get_ns();
if (vm_zone_stat_kaddrp) {
bpf_probe_read(&piddata.nr_free_pages,
bpf_probe_read_kernel(&piddata.nr_free_pages,
sizeof(*vm_zone_stat_kaddrp),
&vm_zone_stat_kaddrp[NR_FREE_PAGES]);
}
Expand Down
2 changes: 1 addition & 1 deletion libbpf-tools/filelife.bpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ int BPF_KPROBE(kprobe__vfs_unlink, struct inode *dir, struct dentry *dentry)

qs_name_ptr = BPF_CORE_READ(dentry, d_name.name);
qs_len = BPF_CORE_READ(dentry, d_name.len);
bpf_probe_read_str(&event.file, sizeof(event.file), qs_name_ptr);
bpf_probe_read_kernel_str(&event.file, sizeof(event.file), qs_name_ptr);
bpf_get_current_comm(&event.task, sizeof(event.task));
event.delta_ns = delta_ns;
event.tgid = tgid;
Expand Down
2 changes: 1 addition & 1 deletion libbpf-tools/runqslower.bpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ int handle__sched_switch(u64 *ctx)

event.pid = pid;
event.delta_us = delta_us;
bpf_probe_read_str(&event.task, sizeof(event.task), next->comm);
bpf_probe_read_kernel_str(&event.task, sizeof(event.task), next->comm);

/* output */
bpf_perf_event_output(ctx, &events, BPF_F_CURRENT_CPU,
Expand Down
2 changes: 1 addition & 1 deletion libbpf-tools/xfsslower.bpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ probe_exit(struct pt_regs *ctx, char type, ssize_t size)
dentry = BPF_CORE_READ(fp, f_path.dentry);
qs_len = BPF_CORE_READ(dentry, d_name.len);
qs_name_ptr = BPF_CORE_READ(dentry, d_name.name);
bpf_probe_read_str(&event.file, sizeof(event.file), qs_name_ptr);
bpf_probe_read_kernel_str(&event.file, sizeof(event.file), qs_name_ptr);
bpf_get_current_comm(&event.task, sizeof(event.task));
event.delta_us = delta_us;
event.end_ns = end_ns;
Expand Down

0 comments on commit d958381

Please sign in to comment.