]>
Commit | Line | Data |
---|---|---|
2cb7cef9 BS |
1 | From: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> |
2 | Subject: LTTng instrumentation - net | |
3 | ||
4 | Original patch header: | |
5 | LTTng instrumentation - net | |
6 | ||
7 | Network device activity instrumentation (xmit/receive). Allows to detect when a | |
8 | packet had arrived on the network card or when it is going to be sent. This is | |
9 | the instrumentation point outside of the drivers that is the closest to the | |
10 | hardware. It allows to detect the amount of time taken by a packet to go through | |
11 | the kernel between the system call and the actual delivery to the network card | |
12 | (given that system calls are instrumented). | |
13 | ||
14 | Those tracepoints are used by LTTng. | |
15 | ||
16 | About the performance impact of tracepoints (which is comparable to markers), | |
17 | even without immediate values optimizations, tests done by Hideo Aoki on ia64 | |
18 | show no regression. His test case was using hackbench on a kernel where | |
19 | scheduler instrumentation (about 5 events in code scheduler code) was added. | |
20 | See the "Tracepoints" patch header for performance result detail. | |
21 | ||
22 | Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> | |
23 | CC: Andrew Morton <akpm@linux-foundation.org> | |
24 | CC: netdev@vger.kernel.org | |
25 | CC: Jeff Garzik <jgarzik@pobox.com> | |
26 | CC: Masami Hiramatsu <mhiramat@redhat.com> | |
27 | CC: 'Peter Zijlstra' <peterz@infradead.org> | |
28 | CC: "Frank Ch. Eigler" <fche@redhat.com> | |
29 | CC: 'Ingo Molnar' <mingo@elte.hu> | |
30 | CC: 'Hideo AOKI' <haoki@redhat.com> | |
31 | CC: Takashi Nishiie <t-nishiie@np.css.fujitsu.com> | |
32 | CC: 'Steven Rostedt' <rostedt@goodmis.org> | |
33 | CC: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro> | |
34 | ||
35 | Acked-by: Jan Blunck <jblunck@suse.de> | |
36 | --- | |
37 | --- | |
38 | include/trace/net.h | 14 ++++++++++++++ | |
39 | net/core/dev.c | 3 +++ | |
40 | 2 files changed, 17 insertions(+) | |
41 | ||
42 | --- /dev/null | |
43 | +++ b/include/trace/net.h | |
44 | @@ -0,0 +1,14 @@ | |
45 | +#ifndef _TRACE_NET_H | |
46 | +#define _TRACE_NET_H | |
47 | + | |
48 | +#include <net/sock.h> | |
49 | +#include <linux/tracepoint.h> | |
50 | + | |
51 | +DEFINE_TRACE(net_dev_xmit, | |
52 | + TPPROTO(struct sk_buff *skb), | |
53 | + TPARGS(skb)); | |
54 | +DEFINE_TRACE(net_dev_receive, | |
55 | + TPPROTO(struct sk_buff *skb), | |
56 | + TPARGS(skb)); | |
57 | + | |
58 | +#endif | |
59 | --- a/net/core/dev.c | |
60 | +++ b/net/core/dev.c | |
61 | @@ -127,6 +127,7 @@ | |
62 | #include <linux/in.h> | |
63 | #include <linux/jhash.h> | |
64 | #include <linux/random.h> | |
65 | +#include <trace/net.h> | |
66 | ||
67 | #include "net-sysfs.h" | |
68 | ||
69 | @@ -1794,6 +1795,7 @@ int dev_queue_xmit(struct sk_buff *skb) | |
70 | } | |
71 | ||
72 | gso: | |
73 | + trace_net_dev_xmit(skb); | |
74 | /* Disable soft irqs for various locks below. Also | |
75 | * stops preemption for RCU. | |
76 | */ | |
77 | @@ -2215,6 +2217,7 @@ int netif_receive_skb(struct sk_buff *sk | |
78 | ||
79 | __get_cpu_var(netdev_rx_stat).total++; | |
80 | ||
81 | + trace_net_dev_receive(skb); | |
82 | skb_reset_network_header(skb); | |
83 | skb_reset_transport_header(skb); | |
84 | skb->mac_len = skb->network_header - skb->mac_header; |