Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bcc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
bcc
Commits
4ac63076
Commit
4ac63076
authored
Jul 02, 2018
by
Brendan Gregg
Committed by
GitHub
Jul 02, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1863 from pchaigno/remove-unnecessary-bpf-probe-reads
tools: remove unnecessary calls to bpf_probe_read
parents
44c28bf9
8d78edd8
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
27 deletions
+13
-27
tools/runqlat.py
tools/runqlat.py
+1
-3
tools/runqslower.py
tools/runqslower.py
+1
-5
tools/tcpaccept.py
tools/tcpaccept.py
+4
-4
tools/tcptracer.py
tools/tcptracer.py
+7
-15
No files found.
tools/runqlat.py
View file @
4ac63076
...
@@ -168,11 +168,9 @@ RAW_TRACEPOINT_PROBE(sched_switch)
...
@@ -168,11 +168,9 @@ RAW_TRACEPOINT_PROBE(sched_switch)
struct task_struct *prev = (struct task_struct *)ctx->args[1];
struct task_struct *prev = (struct task_struct *)ctx->args[1];
struct task_struct *next = (struct task_struct *)ctx->args[2];
struct task_struct *next = (struct task_struct *)ctx->args[2];
u32 pid, tgid;
u32 pid, tgid;
long state;
// ivcsw: treat like an enqueue event and store timestamp
// ivcsw: treat like an enqueue event and store timestamp
bpf_probe_read(&state, sizeof(long), &prev->state);
if (prev->state == TASK_RUNNING) {
if (state == TASK_RUNNING) {
tgid = prev->tgid;
tgid = prev->tgid;
pid = prev->pid;
pid = prev->pid;
if (!(FILTER || pid == 0)) {
if (!(FILTER || pid == 0)) {
...
...
tools/runqslower.py
View file @
4ac63076
...
@@ -145,11 +145,7 @@ RAW_TRACEPOINT_PROBE(sched_wakeup)
...
@@ -145,11 +145,7 @@ RAW_TRACEPOINT_PROBE(sched_wakeup)
{
{
// TP_PROTO(struct task_struct *p)
// TP_PROTO(struct task_struct *p)
struct task_struct *p = (struct task_struct *)ctx->args[0];
struct task_struct *p = (struct task_struct *)ctx->args[0];
u32 tgid, pid;
return trace_enqueue(p->tgid, p->pid);
bpf_probe_read(&tgid, sizeof(tgid), &p->tgid);
bpf_probe_read(&pid, sizeof(pid), &p->pid);
return trace_enqueue(tgid, pid);
}
}
RAW_TRACEPOINT_PROBE(sched_wakeup_new)
RAW_TRACEPOINT_PROBE(sched_wakeup_new)
...
...
tools/tcpaccept.py
View file @
4ac63076
...
@@ -107,16 +107,16 @@ int kretprobe__inet_csk_accept(struct pt_regs *ctx)
...
@@ -107,16 +107,16 @@ int kretprobe__inet_csk_accept(struct pt_regs *ctx)
if (sk_lingertime_offset - gso_max_segs_offset == 4)
if (sk_lingertime_offset - gso_max_segs_offset == 4)
// 4.10+ with little endian
// 4.10+ with little endian
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
bpf_probe_read(&protocol, 1, (void *)((u64)&newsk->sk_gso_max_segs)
- 3);
protocol = *(u8 *)((u64)&newsk->sk_gso_max_segs
- 3);
else
else
// pre-4.10 with little endian
// pre-4.10 with little endian
bpf_probe_read(&protocol, 1, (void *)((u64)&newsk->sk_wmem_queued)
- 3);
protocol = *(u8 *)((u64)&newsk->sk_wmem_queued
- 3);
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
// 4.10+ with big endian
// 4.10+ with big endian
bpf_probe_read(&protocol, 1, (void *)((u64)&newsk->sk_gso_max_segs)
- 1);
protocol = *(u8 *)((u64)&newsk->sk_gso_max_segs
- 1);
else
else
// pre-4.10 with big endian
// pre-4.10 with big endian
bpf_probe_read(&protocol, 1, (void *)((u64)&newsk->sk_wmem_queued)
- 1);
protocol = *(u8 *)((u64)&newsk->sk_wmem_queued
- 1);
#else
#else
# error "Fix your compiler's __BYTE_ORDER__?!"
# error "Fix your compiler's __BYTE_ORDER__?!"
#endif
#endif
...
...
tools/tcptracer.py
View file @
4ac63076
...
@@ -116,8 +116,7 @@ static int read_ipv4_tuple(struct ipv4_tuple_t *tuple, struct sock *skp)
...
@@ -116,8 +116,7 @@ static int read_ipv4_tuple(struct ipv4_tuple_t *tuple, struct sock *skp)
u16 sport = sockp->inet_sport;
u16 sport = sockp->inet_sport;
u16 dport = skp->__sk_common.skc_dport;
u16 dport = skp->__sk_common.skc_dport;
#ifdef CONFIG_NET_NS
#ifdef CONFIG_NET_NS
possible_net_t skc_net = skp->__sk_common.skc_net;
net_ns_inum = skp->__sk_common.skc_net.net->ns.inum;
bpf_probe_read(&net_ns_inum, sizeof(net_ns_inum), &skc_net.net->ns.inum);
#endif
#endif
##FILTER_NETNS##
##FILTER_NETNS##
...
@@ -144,8 +143,7 @@ static int read_ipv6_tuple(struct ipv6_tuple_t *tuple, struct sock *skp)
...
@@ -144,8 +143,7 @@ static int read_ipv6_tuple(struct ipv6_tuple_t *tuple, struct sock *skp)
u16 sport = sockp->inet_sport;
u16 sport = sockp->inet_sport;
u16 dport = skp->__sk_common.skc_dport;
u16 dport = skp->__sk_common.skc_dport;
#ifdef CONFIG_NET_NS
#ifdef CONFIG_NET_NS
possible_net_t skc_net = skp->__sk_common.skc_net;
net_ns_inum = skp->__sk_common.skc_net.net->ns.inum;
bpf_probe_read(&net_ns_inum, sizeof(net_ns_inum), &skc_net.net->ns.inum);
#endif
#endif
bpf_probe_read(&saddr, sizeof(saddr),
bpf_probe_read(&saddr, sizeof(saddr),
skp->__sk_common.skc_v6_rcv_saddr.in6_u.u6_addr32);
skp->__sk_common.skc_v6_rcv_saddr.in6_u.u6_addr32);
...
@@ -430,16 +428,12 @@ int trace_accept_return(struct pt_regs *ctx)
...
@@ -430,16 +428,12 @@ int trace_accept_return(struct pt_regs *ctx)
u32 net_ns_inum = 0;
u32 net_ns_inum = 0;
u8 ipver = 0;
u8 ipver = 0;
bpf_probe_read(&dport, sizeof(dport), &newsk->__sk_common.skc_dport)
;
dport = newsk->__sk_common.skc_dport
;
bpf_probe_read(&lport, sizeof(lport), &newsk->__sk_common.skc_num)
;
lport = newsk->__sk_common.skc_num
;
// Get network namespace id, if kernel supports it
// Get network namespace id, if kernel supports it
#ifdef CONFIG_NET_NS
#ifdef CONFIG_NET_NS
possible_net_t skc_net = { };
net_ns_inum = newsk->__sk_common.skc_net.net->ns.inum;
bpf_probe_read(&skc_net, sizeof(skc_net), &newsk->__sk_common.skc_net);
bpf_probe_read(&net_ns_inum, sizeof(net_ns_inum), &skc_net.net->ns.inum);
#else
net_ns_inum = 0;
#endif
#endif
##FILTER_NETNS##
##FILTER_NETNS##
...
@@ -455,10 +449,8 @@ int trace_accept_return(struct pt_regs *ctx)
...
@@ -455,10 +449,8 @@ int trace_accept_return(struct pt_regs *ctx)
evt4.pid = pid >> 32;
evt4.pid = pid >> 32;
evt4.ip = ipver;
evt4.ip = ipver;
bpf_probe_read(&evt4.saddr, sizeof(evt4.saddr),
evt4.saddr = newsk->__sk_common.skc_rcv_saddr;
&newsk->__sk_common.skc_rcv_saddr);
evt4.daddr = newsk->__sk_common.skc_daddr;
bpf_probe_read(&evt4.daddr, sizeof(evt4.daddr),
&newsk->__sk_common.skc_daddr);
evt4.sport = lport;
evt4.sport = lport;
evt4.dport = ntohs(dport);
evt4.dport = ntohs(dport);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment