aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2009-08-26 19:32:37 -0400
committerDavid S. Miller <davem@davemloft.net>2009-08-26 19:32:37 -0400
commit31ffe249e5426d2648d68568fa00a7b66666a5db (patch)
tree286d67e6dafb2a2df088df8f05d8f11781344a75 /kernel
parentf656f39801b00c3c2aa26cefbdee2775d6706d45 (diff)
net: Temporarily backout SKB sources tracer.
Steven Rostedt has suggested that Neil work with the tracing folks, trying to use TRACE_EVENT as the mechanism for implementation. And if that doesn't workout we can investigate other solutions such as that one which was tried here. This reverts the following 2 commits: 5a165657bef7c47e5ff4cd138f7758ef6278e87b ("net: skb ftracer - Add config option to enable new ftracer (v3)") 9ec04da7489d2c9ae01ea6e9b5fa313ccf3d35fb ("net: skb ftracer - Add actual ftrace code to kernel (v3)") Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/trace/Kconfig11
-rw-r--r--kernel/trace/Makefile1
-rw-r--r--kernel/trace/trace.h19
-rw-r--r--kernel/trace/trace_skb_sources.c154
4 files changed, 0 insertions, 185 deletions
diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
index 9a2f19bf0512..019f380fd764 100644
--- a/kernel/trace/Kconfig
+++ b/kernel/trace/Kconfig
@@ -234,17 +234,6 @@ config BOOT_TRACER
234 You must pass in initcall_debug and ftrace=initcall to the kernel 234 You must pass in initcall_debug and ftrace=initcall to the kernel
235 command line to enable this on bootup. 235 command line to enable this on bootup.
236 236
237config SKB_SOURCES_TRACER
238 bool "Trace skb source information"
239 depends on NET
240 select GENERIC_TRACER
241 help
242 This tracer helps developers/sysadmins correlate skb allocation and
243 consumption. The idea being that some processes will primarily consume data
244 that was allocated on certain numa nodes. By being able to visualize which
245 nodes the data was allocated on, a sysadmin or developer can optimize the
246 scheduling of those processes to cut back on cross node chatter.
247
248config TRACE_BRANCH_PROFILING 237config TRACE_BRANCH_PROFILING
249 bool 238 bool
250 select GENERIC_TRACER 239 select GENERIC_TRACER
diff --git a/kernel/trace/Makefile b/kernel/trace/Makefile
index ee5e5b1b9282..844164dca90a 100644
--- a/kernel/trace/Makefile
+++ b/kernel/trace/Makefile
@@ -49,7 +49,6 @@ obj-$(CONFIG_BLK_DEV_IO_TRACE) += blktrace.o
49ifeq ($(CONFIG_BLOCK),y) 49ifeq ($(CONFIG_BLOCK),y)
50obj-$(CONFIG_EVENT_TRACING) += blktrace.o 50obj-$(CONFIG_EVENT_TRACING) += blktrace.o
51endif 51endif
52obj-$(CONFIG_SKB_SOURCES_TRACER) += trace_skb_sources.o
53obj-$(CONFIG_EVENT_TRACING) += trace_events.o 52obj-$(CONFIG_EVENT_TRACING) += trace_events.o
54obj-$(CONFIG_EVENT_TRACING) += trace_export.o 53obj-$(CONFIG_EVENT_TRACING) += trace_export.o
55obj-$(CONFIG_FTRACE_SYSCALLS) += trace_syscalls.o 54obj-$(CONFIG_FTRACE_SYSCALLS) += trace_syscalls.o
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index 8a6281b2330b..8b9f4f6e9559 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -11,7 +11,6 @@
11#include <trace/boot.h> 11#include <trace/boot.h>
12#include <linux/kmemtrace.h> 12#include <linux/kmemtrace.h>
13#include <trace/power.h> 13#include <trace/power.h>
14#include <trace/events/skb.h>
15 14
16#include <linux/trace_seq.h> 15#include <linux/trace_seq.h>
17#include <linux/ftrace_event.h> 16#include <linux/ftrace_event.h>
@@ -41,7 +40,6 @@ enum trace_type {
41 TRACE_KMEM_FREE, 40 TRACE_KMEM_FREE,
42 TRACE_POWER, 41 TRACE_POWER,
43 TRACE_BLK, 42 TRACE_BLK,
44 TRACE_SKB_SOURCE,
45 43
46 __TRACE_LAST_TYPE, 44 __TRACE_LAST_TYPE,
47}; 45};
@@ -173,21 +171,6 @@ struct trace_power {
173 struct power_trace state_data; 171 struct power_trace state_data;
174}; 172};
175 173
176struct skb_record {
177 pid_t pid; /* pid of the copying process */
178 int anid; /* node where skb was allocated */
179 int cnid; /* node to which skb was copied in userspace */
180 char ifname[IFNAMSIZ]; /* Name of the receiving interface */
181 int rx_queue; /* The rx queue the skb was received on */
182 int ccpu; /* Cpu the application got this frame from */
183 int len; /* length of the data copied */
184};
185
186struct trace_skb_event {
187 struct trace_entry ent;
188 struct skb_record event_data;
189};
190
191enum kmemtrace_type_id { 174enum kmemtrace_type_id {
192 KMEMTRACE_TYPE_KMALLOC = 0, /* kmalloc() or kfree(). */ 175 KMEMTRACE_TYPE_KMALLOC = 0, /* kmalloc() or kfree(). */
193 KMEMTRACE_TYPE_CACHE, /* kmem_cache_*(). */ 176 KMEMTRACE_TYPE_CACHE, /* kmem_cache_*(). */
@@ -340,8 +323,6 @@ extern void __ftrace_bad_type(void);
340 TRACE_SYSCALL_ENTER); \ 323 TRACE_SYSCALL_ENTER); \
341 IF_ASSIGN(var, ent, struct syscall_trace_exit, \ 324 IF_ASSIGN(var, ent, struct syscall_trace_exit, \
342 TRACE_SYSCALL_EXIT); \ 325 TRACE_SYSCALL_EXIT); \
343 IF_ASSIGN(var, ent, struct trace_skb_event, \
344 TRACE_SKB_SOURCE); \
345 __ftrace_bad_type(); \ 326 __ftrace_bad_type(); \
346 } while (0) 327 } while (0)
347 328
diff --git a/kernel/trace/trace_skb_sources.c b/kernel/trace/trace_skb_sources.c
deleted file mode 100644
index 40eb071afdb4..000000000000
--- a/kernel/trace/trace_skb_sources.c
+++ /dev/null
@@ -1,154 +0,0 @@
1/*
2 * ring buffer based tracer for analyzing per-socket skb sources
3 *
4 * Neil Horman <nhorman@tuxdriver.com>
5 * Copyright (C) 2009
6 *
7 *
8 */
9
10#include <linux/init.h>
11#include <linux/debugfs.h>
12#include <trace/events/skb.h>
13#include <linux/kallsyms.h>
14#include <linux/module.h>
15#include <linux/hardirq.h>
16#include <linux/netdevice.h>
17#include <net/sock.h>
18
19#include "trace.h"
20#include "trace_output.h"
21
22EXPORT_TRACEPOINT_SYMBOL_GPL(skb_copy_datagram_iovec);
23
24static struct trace_array *skb_trace;
25static int __read_mostly trace_skb_source_enabled;
26
27static void probe_skb_dequeue(const struct sk_buff *skb, int len)
28{
29 struct ring_buffer_event *event;
30 struct trace_skb_event *entry;
31 struct trace_array *tr = skb_trace;
32 struct net_device *dev;
33
34 if (!trace_skb_source_enabled)
35 return;
36
37 if (in_interrupt())
38 return;
39
40 event = trace_buffer_lock_reserve(tr, TRACE_SKB_SOURCE,
41 sizeof(*entry), 0, 0);
42 if (!event)
43 return;
44 entry = ring_buffer_event_data(event);
45
46 entry->event_data.pid = current->pid;
47 entry->event_data.anid = page_to_nid(virt_to_page(skb->data));
48 entry->event_data.cnid = cpu_to_node(smp_processor_id());
49 entry->event_data.len = len;
50 entry->event_data.rx_queue = skb->queue_mapping;
51 entry->event_data.ccpu = smp_processor_id();
52
53 dev = dev_get_by_index(sock_net(skb->sk), skb->iif);
54 if (dev) {
55 memcpy(entry->event_data.ifname, dev->name, IFNAMSIZ);
56 dev_put(dev);
57 } else {
58 strcpy(entry->event_data.ifname, "Unknown");
59 }
60
61 trace_buffer_unlock_commit(tr, event, 0, 0);
62}
63
64static int tracing_skb_source_register(void)
65{
66 int ret;
67
68 ret = register_trace_skb_copy_datagram_iovec(probe_skb_dequeue);
69 if (ret)
70 pr_info("skb source trace: Couldn't activate dequeue tracepoint");
71
72 return ret;
73}
74
75static void start_skb_source_trace(struct trace_array *tr)
76{
77 trace_skb_source_enabled = 1;
78}
79
80static void stop_skb_source_trace(struct trace_array *tr)
81{
82 trace_skb_source_enabled = 0;
83}
84
85static void skb_source_trace_reset(struct trace_array *tr)
86{
87 trace_skb_source_enabled = 0;
88 unregister_trace_skb_copy_datagram_iovec(probe_skb_dequeue);
89}
90
91
92static int skb_source_trace_init(struct trace_array *tr)
93{
94 int cpu;
95 skb_trace = tr;
96
97 trace_skb_source_enabled = 1;
98 tracing_skb_source_register();
99
100 for_each_cpu(cpu, cpu_possible_mask)
101 tracing_reset(tr, cpu);
102 return 0;
103}
104
105static enum print_line_t skb_source_print_line(struct trace_iterator *iter)
106{
107 int ret = 0;
108 struct trace_entry *entry = iter->ent;
109 struct trace_skb_event *event;
110 struct skb_record *record;
111 struct trace_seq *s = &iter->seq;
112
113 trace_assign_type(event, entry);
114 record = &event->event_data;
115 if (entry->type != TRACE_SKB_SOURCE)
116 return TRACE_TYPE_UNHANDLED;
117
118 ret = trace_seq_printf(s, " %d %d %d %s %d %d %d\n",
119 record->pid,
120 record->anid,
121 record->cnid,
122 record->ifname,
123 record->rx_queue,
124 record->ccpu,
125 record->len);
126
127 if (!ret)
128 return TRACE_TYPE_PARTIAL_LINE;
129
130 return TRACE_TYPE_HANDLED;
131}
132
133static void skb_source_print_header(struct seq_file *s)
134{
135 seq_puts(s, "# PID ANID CNID IFC RXQ CCPU LEN\n");
136 seq_puts(s, "# | | | | | | |\n");
137}
138
139static struct tracer skb_source_tracer __read_mostly =
140{
141 .name = "skb_sources",
142 .init = skb_source_trace_init,
143 .start = start_skb_source_trace,
144 .stop = stop_skb_source_trace,
145 .reset = skb_source_trace_reset,
146 .print_line = skb_source_print_line,
147 .print_header = skb_source_print_header,
148};
149
150static int init_skb_source_trace(void)
151{
152 return register_tracer(&skb_source_tracer);
153}
154device_initcall(init_skb_source_trace);