aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-top.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2010-03-15 10:46:58 -0400
committerIngo Molnar <mingo@elte.hu>2010-03-15 11:08:42 -0400
commitb0a9ab62ab96e258a0ddd81d7fe2719c3db36006 (patch)
treef86b57423ac24262533a11fae4c5dc72f7b912bd /tools/perf/builtin-top.c
parentbedbfdea31daf3880745001d56450c683959ee7e (diff)
perf top: Properly notify the user that vmlinux is missing
Before this patch this message would very briefly appear on the screen and then the screen would get updates only on the top, for number of interrupts received, etc, but no annotation would be performed: [root@doppio linux-2.6-tip]# perf top -s n_tty_write > /tmp/bla objdump: '[kernel.kallsyms]': No such file Now this is what the user gets: [root@doppio linux-2.6-tip]# perf top -s n_tty_write Can't annotate n_tty_write: No vmlinux file was found in the path: [0] vmlinux [1] /boot/vmlinux [2] /boot/vmlinux-2.6.33-rc5 [3] /lib/modules/2.6.33-rc5/build/vmlinux [4] /usr/lib/debug/lib/modules/2.6.33-rc5/vmlinux [root@doppio linux-2.6-tip]# This bug was introduced when we added automatic search for vmlinux, before that time the user had to specify a vmlinux file. Reported-by: David S. Miller <davem@davemloft.net> Reported-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Frédéric Weisbecker <fweisbec@gmail.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Paul Mackerras <paulus@samba.org> Cc: <stable@kernel.org> LKML-Reference: <1268664418-28328-2-git-send-email-acme@infradead.org> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/builtin-top.c')
-rw-r--r--tools/perf/builtin-top.c33
1 files changed, 25 insertions, 8 deletions
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 57e232f13bc1..c968bd3391e0 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -169,7 +169,7 @@ static void sig_winch_handler(int sig __used)
169 update_print_entries(&winsize); 169 update_print_entries(&winsize);
170} 170}
171 171
172static void parse_source(struct sym_entry *syme) 172static int parse_source(struct sym_entry *syme)
173{ 173{
174 struct symbol *sym; 174 struct symbol *sym;
175 struct sym_entry_source *source; 175 struct sym_entry_source *source;
@@ -180,12 +180,21 @@ static void parse_source(struct sym_entry *syme)
180 u64 len; 180 u64 len;
181 181
182 if (!syme) 182 if (!syme)
183 return; 183 return -1;
184
185 sym = sym_entry__symbol(syme);
186 map = syme->map;
187
188 /*
189 * We can't annotate with just /proc/kallsyms
190 */
191 if (map->dso->origin == DSO__ORIG_KERNEL)
192 return -1;
184 193
185 if (syme->src == NULL) { 194 if (syme->src == NULL) {
186 syme->src = zalloc(sizeof(*source)); 195 syme->src = zalloc(sizeof(*source));
187 if (syme->src == NULL) 196 if (syme->src == NULL)
188 return; 197 return -1;
189 pthread_mutex_init(&syme->src->lock, NULL); 198 pthread_mutex_init(&syme->src->lock, NULL);
190 } 199 }
191 200
@@ -195,9 +204,6 @@ static void parse_source(struct sym_entry *syme)
195 pthread_mutex_lock(&source->lock); 204 pthread_mutex_lock(&source->lock);
196 goto out_assign; 205 goto out_assign;
197 } 206 }
198
199 sym = sym_entry__symbol(syme);
200 map = syme->map;
201 path = map->dso->long_name; 207 path = map->dso->long_name;
202 208
203 len = sym->end - sym->start; 209 len = sym->end - sym->start;
@@ -209,7 +215,7 @@ static void parse_source(struct sym_entry *syme)
209 215
210 file = popen(command, "r"); 216 file = popen(command, "r");
211 if (!file) 217 if (!file)
212 return; 218 return -1;
213 219
214 pthread_mutex_lock(&source->lock); 220 pthread_mutex_lock(&source->lock);
215 source->lines_tail = &source->lines; 221 source->lines_tail = &source->lines;
@@ -245,6 +251,7 @@ static void parse_source(struct sym_entry *syme)
245out_assign: 251out_assign:
246 sym_filter_entry = syme; 252 sym_filter_entry = syme;
247 pthread_mutex_unlock(&source->lock); 253 pthread_mutex_unlock(&source->lock);
254 return 0;
248} 255}
249 256
250static void __zero_source_counters(struct sym_entry *syme) 257static void __zero_source_counters(struct sym_entry *syme)
@@ -991,7 +998,17 @@ static void event__process_sample(const event_t *self,
991 if (sym_filter_entry_sched) { 998 if (sym_filter_entry_sched) {
992 sym_filter_entry = sym_filter_entry_sched; 999 sym_filter_entry = sym_filter_entry_sched;
993 sym_filter_entry_sched = NULL; 1000 sym_filter_entry_sched = NULL;
994 parse_source(sym_filter_entry); 1001 if (parse_source(sym_filter_entry) < 0) {
1002 struct symbol *sym = sym_entry__symbol(sym_filter_entry);
1003
1004 pr_err("Can't annotate %s", sym->name);
1005 if (sym_filter_entry->map->dso->origin == DSO__ORIG_KERNEL) {
1006 pr_err(": No vmlinux file was found in the path:\n");
1007 vmlinux_path__fprintf(stderr);
1008 } else
1009 pr_err(".\n");
1010 exit(1);
1011 }
995 } 1012 }
996 1013
997 syme = symbol__priv(al.sym); 1014 syme = symbol__priv(al.sym);