staging: usbip: README: we need to document the protocol
[zen-stable.git] / tools / perf / util / event.c
blob0fe9adf76379ecc02895cfbb46f35dcc8666dcbd
1 #include <linux/types.h>
2 #include "event.h"
3 #include "debug.h"
4 #include "session.h"
5 #include "sort.h"
6 #include "string.h"
7 #include "strlist.h"
8 #include "thread.h"
9 #include "thread_map.h"
11 static const char *perf_event__names[] = {
12 [0] = "TOTAL",
13 [PERF_RECORD_MMAP] = "MMAP",
14 [PERF_RECORD_LOST] = "LOST",
15 [PERF_RECORD_COMM] = "COMM",
16 [PERF_RECORD_EXIT] = "EXIT",
17 [PERF_RECORD_THROTTLE] = "THROTTLE",
18 [PERF_RECORD_UNTHROTTLE] = "UNTHROTTLE",
19 [PERF_RECORD_FORK] = "FORK",
20 [PERF_RECORD_READ] = "READ",
21 [PERF_RECORD_SAMPLE] = "SAMPLE",
22 [PERF_RECORD_HEADER_ATTR] = "ATTR",
23 [PERF_RECORD_HEADER_EVENT_TYPE] = "EVENT_TYPE",
24 [PERF_RECORD_HEADER_TRACING_DATA] = "TRACING_DATA",
25 [PERF_RECORD_HEADER_BUILD_ID] = "BUILD_ID",
26 [PERF_RECORD_FINISHED_ROUND] = "FINISHED_ROUND",
29 const char *perf_event__name(unsigned int id)
31 if (id >= ARRAY_SIZE(perf_event__names))
32 return "INVALID";
33 if (!perf_event__names[id])
34 return "UNKNOWN";
35 return perf_event__names[id];
38 int perf_sample_size(u64 sample_type)
40 u64 mask = sample_type & PERF_SAMPLE_MASK;
41 int size = 0;
42 int i;
44 for (i = 0; i < 64; i++) {
45 if (mask & (1ULL << i))
46 size++;
49 size *= sizeof(u64);
51 return size;
54 static struct perf_sample synth_sample = {
55 .pid = -1,
56 .tid = -1,
57 .time = -1,
58 .stream_id = -1,
59 .cpu = -1,
60 .period = 1,
63 static pid_t perf_event__synthesize_comm(union perf_event *event, pid_t pid,
64 int full, perf_event__handler_t process,
65 struct perf_session *session)
67 char filename[PATH_MAX];
68 char bf[BUFSIZ];
69 FILE *fp;
70 size_t size = 0;
71 DIR *tasks;
72 struct dirent dirent, *next;
73 pid_t tgid = 0;
75 snprintf(filename, sizeof(filename), "/proc/%d/status", pid);
77 fp = fopen(filename, "r");
78 if (fp == NULL) {
79 out_race:
81 * We raced with a task exiting - just return:
83 pr_debug("couldn't open %s\n", filename);
84 return 0;
87 memset(&event->comm, 0, sizeof(event->comm));
89 while (!event->comm.comm[0] || !event->comm.pid) {
90 if (fgets(bf, sizeof(bf), fp) == NULL) {
91 pr_warning("couldn't get COMM and pgid, malformed %s\n", filename);
92 goto out;
95 if (memcmp(bf, "Name:", 5) == 0) {
96 char *name = bf + 5;
97 while (*name && isspace(*name))
98 ++name;
99 size = strlen(name) - 1;
100 memcpy(event->comm.comm, name, size++);
101 } else if (memcmp(bf, "Tgid:", 5) == 0) {
102 char *tgids = bf + 5;
103 while (*tgids && isspace(*tgids))
104 ++tgids;
105 tgid = event->comm.pid = atoi(tgids);
109 event->comm.header.type = PERF_RECORD_COMM;
110 size = ALIGN(size, sizeof(u64));
111 memset(event->comm.comm + size, 0, session->id_hdr_size);
112 event->comm.header.size = (sizeof(event->comm) -
113 (sizeof(event->comm.comm) - size) +
114 session->id_hdr_size);
115 if (!full) {
116 event->comm.tid = pid;
118 process(event, &synth_sample, session);
119 goto out;
122 snprintf(filename, sizeof(filename), "/proc/%d/task", pid);
124 tasks = opendir(filename);
125 if (tasks == NULL)
126 goto out_race;
128 while (!readdir_r(tasks, &dirent, &next) && next) {
129 char *end;
130 pid = strtol(dirent.d_name, &end, 10);
131 if (*end)
132 continue;
134 event->comm.tid = pid;
136 process(event, &synth_sample, session);
139 closedir(tasks);
140 out:
141 fclose(fp);
143 return tgid;
146 static int perf_event__synthesize_mmap_events(union perf_event *event,
147 pid_t pid, pid_t tgid,
148 perf_event__handler_t process,
149 struct perf_session *session)
151 char filename[PATH_MAX];
152 FILE *fp;
154 snprintf(filename, sizeof(filename), "/proc/%d/maps", pid);
156 fp = fopen(filename, "r");
157 if (fp == NULL) {
159 * We raced with a task exiting - just return:
161 pr_debug("couldn't open %s\n", filename);
162 return -1;
165 event->header.type = PERF_RECORD_MMAP;
167 * Just like the kernel, see __perf_event_mmap in kernel/perf_event.c
169 event->header.misc = PERF_RECORD_MISC_USER;
171 while (1) {
172 char bf[BUFSIZ], *pbf = bf;
173 int n;
174 size_t size;
175 if (fgets(bf, sizeof(bf), fp) == NULL)
176 break;
178 /* 00400000-0040c000 r-xp 00000000 fd:01 41038 /bin/cat */
179 n = hex2u64(pbf, &event->mmap.start);
180 if (n < 0)
181 continue;
182 pbf += n + 1;
183 n = hex2u64(pbf, &event->mmap.len);
184 if (n < 0)
185 continue;
186 pbf += n + 3;
187 if (*pbf == 'x') { /* vm_exec */
188 char *execname = strchr(bf, '/');
190 /* Catch VDSO */
191 if (execname == NULL)
192 execname = strstr(bf, "[vdso]");
194 if (execname == NULL)
195 continue;
197 pbf += 3;
198 n = hex2u64(pbf, &event->mmap.pgoff);
200 size = strlen(execname);
201 execname[size - 1] = '\0'; /* Remove \n */
202 memcpy(event->mmap.filename, execname, size);
203 size = ALIGN(size, sizeof(u64));
204 event->mmap.len -= event->mmap.start;
205 event->mmap.header.size = (sizeof(event->mmap) -
206 (sizeof(event->mmap.filename) - size));
207 memset(event->mmap.filename + size, 0, session->id_hdr_size);
208 event->mmap.header.size += session->id_hdr_size;
209 event->mmap.pid = tgid;
210 event->mmap.tid = pid;
212 process(event, &synth_sample, session);
216 fclose(fp);
217 return 0;
220 int perf_event__synthesize_modules(perf_event__handler_t process,
221 struct perf_session *session,
222 struct machine *machine)
224 struct rb_node *nd;
225 struct map_groups *kmaps = &machine->kmaps;
226 union perf_event *event = zalloc((sizeof(event->mmap) +
227 session->id_hdr_size));
228 if (event == NULL) {
229 pr_debug("Not enough memory synthesizing mmap event "
230 "for kernel modules\n");
231 return -1;
234 event->header.type = PERF_RECORD_MMAP;
237 * kernel uses 0 for user space maps, see kernel/perf_event.c
238 * __perf_event_mmap
240 if (machine__is_host(machine))
241 event->header.misc = PERF_RECORD_MISC_KERNEL;
242 else
243 event->header.misc = PERF_RECORD_MISC_GUEST_KERNEL;
245 for (nd = rb_first(&kmaps->maps[MAP__FUNCTION]);
246 nd; nd = rb_next(nd)) {
247 size_t size;
248 struct map *pos = rb_entry(nd, struct map, rb_node);
250 if (pos->dso->kernel)
251 continue;
253 size = ALIGN(pos->dso->long_name_len + 1, sizeof(u64));
254 event->mmap.header.type = PERF_RECORD_MMAP;
255 event->mmap.header.size = (sizeof(event->mmap) -
256 (sizeof(event->mmap.filename) - size));
257 memset(event->mmap.filename + size, 0, session->id_hdr_size);
258 event->mmap.header.size += session->id_hdr_size;
259 event->mmap.start = pos->start;
260 event->mmap.len = pos->end - pos->start;
261 event->mmap.pid = machine->pid;
263 memcpy(event->mmap.filename, pos->dso->long_name,
264 pos->dso->long_name_len + 1);
265 process(event, &synth_sample, session);
268 free(event);
269 return 0;
272 static int __event__synthesize_thread(union perf_event *comm_event,
273 union perf_event *mmap_event,
274 pid_t pid, perf_event__handler_t process,
275 struct perf_session *session)
277 pid_t tgid = perf_event__synthesize_comm(comm_event, pid, 1, process,
278 session);
279 if (tgid == -1)
280 return -1;
281 return perf_event__synthesize_mmap_events(mmap_event, pid, tgid,
282 process, session);
285 int perf_event__synthesize_thread_map(struct thread_map *threads,
286 perf_event__handler_t process,
287 struct perf_session *session)
289 union perf_event *comm_event, *mmap_event;
290 int err = -1, thread;
292 comm_event = malloc(sizeof(comm_event->comm) + session->id_hdr_size);
293 if (comm_event == NULL)
294 goto out;
296 mmap_event = malloc(sizeof(mmap_event->mmap) + session->id_hdr_size);
297 if (mmap_event == NULL)
298 goto out_free_comm;
300 err = 0;
301 for (thread = 0; thread < threads->nr; ++thread) {
302 if (__event__synthesize_thread(comm_event, mmap_event,
303 threads->map[thread],
304 process, session)) {
305 err = -1;
306 break;
309 free(mmap_event);
310 out_free_comm:
311 free(comm_event);
312 out:
313 return err;
316 int perf_event__synthesize_threads(perf_event__handler_t process,
317 struct perf_session *session)
319 DIR *proc;
320 struct dirent dirent, *next;
321 union perf_event *comm_event, *mmap_event;
322 int err = -1;
324 comm_event = malloc(sizeof(comm_event->comm) + session->id_hdr_size);
325 if (comm_event == NULL)
326 goto out;
328 mmap_event = malloc(sizeof(mmap_event->mmap) + session->id_hdr_size);
329 if (mmap_event == NULL)
330 goto out_free_comm;
332 proc = opendir("/proc");
333 if (proc == NULL)
334 goto out_free_mmap;
336 while (!readdir_r(proc, &dirent, &next) && next) {
337 char *end;
338 pid_t pid = strtol(dirent.d_name, &end, 10);
340 if (*end) /* only interested in proper numerical dirents */
341 continue;
343 __event__synthesize_thread(comm_event, mmap_event, pid,
344 process, session);
347 closedir(proc);
348 err = 0;
349 out_free_mmap:
350 free(mmap_event);
351 out_free_comm:
352 free(comm_event);
353 out:
354 return err;
357 struct process_symbol_args {
358 const char *name;
359 u64 start;
362 static int find_symbol_cb(void *arg, const char *name, char type,
363 u64 start, u64 end __used)
365 struct process_symbol_args *args = arg;
368 * Must be a function or at least an alias, as in PARISC64, where "_text" is
369 * an 'A' to the same address as "_stext".
371 if (!(symbol_type__is_a(type, MAP__FUNCTION) ||
372 type == 'A') || strcmp(name, args->name))
373 return 0;
375 args->start = start;
376 return 1;
379 int perf_event__synthesize_kernel_mmap(perf_event__handler_t process,
380 struct perf_session *session,
381 struct machine *machine,
382 const char *symbol_name)
384 size_t size;
385 const char *filename, *mmap_name;
386 char path[PATH_MAX];
387 char name_buff[PATH_MAX];
388 struct map *map;
389 int err;
391 * We should get this from /sys/kernel/sections/.text, but till that is
392 * available use this, and after it is use this as a fallback for older
393 * kernels.
395 struct process_symbol_args args = { .name = symbol_name, };
396 union perf_event *event = zalloc((sizeof(event->mmap) +
397 session->id_hdr_size));
398 if (event == NULL) {
399 pr_debug("Not enough memory synthesizing mmap event "
400 "for kernel modules\n");
401 return -1;
404 mmap_name = machine__mmap_name(machine, name_buff, sizeof(name_buff));
405 if (machine__is_host(machine)) {
407 * kernel uses PERF_RECORD_MISC_USER for user space maps,
408 * see kernel/perf_event.c __perf_event_mmap
410 event->header.misc = PERF_RECORD_MISC_KERNEL;
411 filename = "/proc/kallsyms";
412 } else {
413 event->header.misc = PERF_RECORD_MISC_GUEST_KERNEL;
414 if (machine__is_default_guest(machine))
415 filename = (char *) symbol_conf.default_guest_kallsyms;
416 else {
417 sprintf(path, "%s/proc/kallsyms", machine->root_dir);
418 filename = path;
422 if (kallsyms__parse(filename, &args, find_symbol_cb) <= 0)
423 return -ENOENT;
425 map = machine->vmlinux_maps[MAP__FUNCTION];
426 size = snprintf(event->mmap.filename, sizeof(event->mmap.filename),
427 "%s%s", mmap_name, symbol_name) + 1;
428 size = ALIGN(size, sizeof(u64));
429 event->mmap.header.type = PERF_RECORD_MMAP;
430 event->mmap.header.size = (sizeof(event->mmap) -
431 (sizeof(event->mmap.filename) - size) + session->id_hdr_size);
432 event->mmap.pgoff = args.start;
433 event->mmap.start = map->start;
434 event->mmap.len = map->end - event->mmap.start;
435 event->mmap.pid = machine->pid;
437 err = process(event, &synth_sample, session);
438 free(event);
440 return err;
443 int perf_event__process_comm(union perf_event *event,
444 struct perf_sample *sample __used,
445 struct perf_session *session)
447 struct thread *thread = perf_session__findnew(session, event->comm.tid);
449 dump_printf(": %s:%d\n", event->comm.comm, event->comm.tid);
451 if (thread == NULL || thread__set_comm(thread, event->comm.comm)) {
452 dump_printf("problem processing PERF_RECORD_COMM, skipping event.\n");
453 return -1;
456 return 0;
459 int perf_event__process_lost(union perf_event *event,
460 struct perf_sample *sample __used,
461 struct perf_session *session)
463 dump_printf(": id:%" PRIu64 ": lost:%" PRIu64 "\n",
464 event->lost.id, event->lost.lost);
465 session->hists.stats.total_lost += event->lost.lost;
466 return 0;
469 static void perf_event__set_kernel_mmap_len(union perf_event *event,
470 struct map **maps)
472 maps[MAP__FUNCTION]->start = event->mmap.start;
473 maps[MAP__FUNCTION]->end = event->mmap.start + event->mmap.len;
475 * Be a bit paranoid here, some perf.data file came with
476 * a zero sized synthesized MMAP event for the kernel.
478 if (maps[MAP__FUNCTION]->end == 0)
479 maps[MAP__FUNCTION]->end = ~0ULL;
482 static int perf_event__process_kernel_mmap(union perf_event *event,
483 struct perf_session *session)
485 struct map *map;
486 char kmmap_prefix[PATH_MAX];
487 struct machine *machine;
488 enum dso_kernel_type kernel_type;
489 bool is_kernel_mmap;
491 machine = perf_session__findnew_machine(session, event->mmap.pid);
492 if (!machine) {
493 pr_err("Can't find id %d's machine\n", event->mmap.pid);
494 goto out_problem;
497 machine__mmap_name(machine, kmmap_prefix, sizeof(kmmap_prefix));
498 if (machine__is_host(machine))
499 kernel_type = DSO_TYPE_KERNEL;
500 else
501 kernel_type = DSO_TYPE_GUEST_KERNEL;
503 is_kernel_mmap = memcmp(event->mmap.filename,
504 kmmap_prefix,
505 strlen(kmmap_prefix)) == 0;
506 if (event->mmap.filename[0] == '/' ||
507 (!is_kernel_mmap && event->mmap.filename[0] == '[')) {
509 char short_module_name[1024];
510 char *name, *dot;
512 if (event->mmap.filename[0] == '/') {
513 name = strrchr(event->mmap.filename, '/');
514 if (name == NULL)
515 goto out_problem;
517 ++name; /* skip / */
518 dot = strrchr(name, '.');
519 if (dot == NULL)
520 goto out_problem;
521 snprintf(short_module_name, sizeof(short_module_name),
522 "[%.*s]", (int)(dot - name), name);
523 strxfrchar(short_module_name, '-', '_');
524 } else
525 strcpy(short_module_name, event->mmap.filename);
527 map = machine__new_module(machine, event->mmap.start,
528 event->mmap.filename);
529 if (map == NULL)
530 goto out_problem;
532 name = strdup(short_module_name);
533 if (name == NULL)
534 goto out_problem;
536 map->dso->short_name = name;
537 map->dso->sname_alloc = 1;
538 map->end = map->start + event->mmap.len;
539 } else if (is_kernel_mmap) {
540 const char *symbol_name = (event->mmap.filename +
541 strlen(kmmap_prefix));
543 * Should be there already, from the build-id table in
544 * the header.
546 struct dso *kernel = __dsos__findnew(&machine->kernel_dsos,
547 kmmap_prefix);
548 if (kernel == NULL)
549 goto out_problem;
551 kernel->kernel = kernel_type;
552 if (__machine__create_kernel_maps(machine, kernel) < 0)
553 goto out_problem;
555 perf_event__set_kernel_mmap_len(event, machine->vmlinux_maps);
558 * Avoid using a zero address (kptr_restrict) for the ref reloc
559 * symbol. Effectively having zero here means that at record
560 * time /proc/sys/kernel/kptr_restrict was non zero.
562 if (event->mmap.pgoff != 0) {
563 perf_session__set_kallsyms_ref_reloc_sym(machine->vmlinux_maps,
564 symbol_name,
565 event->mmap.pgoff);
568 if (machine__is_default_guest(machine)) {
570 * preload dso of guest kernel and modules
572 dso__load(kernel, machine->vmlinux_maps[MAP__FUNCTION],
573 NULL);
576 return 0;
577 out_problem:
578 return -1;
581 int perf_event__process_mmap(union perf_event *event,
582 struct perf_sample *sample __used,
583 struct perf_session *session)
585 struct machine *machine;
586 struct thread *thread;
587 struct map *map;
588 u8 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK;
589 int ret = 0;
591 dump_printf(" %d/%d: [%#" PRIx64 "(%#" PRIx64 ") @ %#" PRIx64 "]: %s\n",
592 event->mmap.pid, event->mmap.tid, event->mmap.start,
593 event->mmap.len, event->mmap.pgoff, event->mmap.filename);
595 if (cpumode == PERF_RECORD_MISC_GUEST_KERNEL ||
596 cpumode == PERF_RECORD_MISC_KERNEL) {
597 ret = perf_event__process_kernel_mmap(event, session);
598 if (ret < 0)
599 goto out_problem;
600 return 0;
603 machine = perf_session__find_host_machine(session);
604 if (machine == NULL)
605 goto out_problem;
606 thread = perf_session__findnew(session, event->mmap.pid);
607 if (thread == NULL)
608 goto out_problem;
609 map = map__new(&machine->user_dsos, event->mmap.start,
610 event->mmap.len, event->mmap.pgoff,
611 event->mmap.pid, event->mmap.filename,
612 MAP__FUNCTION);
613 if (map == NULL)
614 goto out_problem;
616 thread__insert_map(thread, map);
617 return 0;
619 out_problem:
620 dump_printf("problem processing PERF_RECORD_MMAP, skipping event.\n");
621 return 0;
624 int perf_event__process_task(union perf_event *event,
625 struct perf_sample *sample __used,
626 struct perf_session *session)
628 struct thread *thread = perf_session__findnew(session, event->fork.tid);
629 struct thread *parent = perf_session__findnew(session, event->fork.ptid);
631 dump_printf("(%d:%d):(%d:%d)\n", event->fork.pid, event->fork.tid,
632 event->fork.ppid, event->fork.ptid);
634 if (event->header.type == PERF_RECORD_EXIT) {
635 perf_session__remove_thread(session, thread);
636 return 0;
639 if (thread == NULL || parent == NULL ||
640 thread__fork(thread, parent) < 0) {
641 dump_printf("problem processing PERF_RECORD_FORK, skipping event.\n");
642 return -1;
645 return 0;
648 int perf_event__process(union perf_event *event, struct perf_sample *sample,
649 struct perf_session *session)
651 switch (event->header.type) {
652 case PERF_RECORD_COMM:
653 perf_event__process_comm(event, sample, session);
654 break;
655 case PERF_RECORD_MMAP:
656 perf_event__process_mmap(event, sample, session);
657 break;
658 case PERF_RECORD_FORK:
659 case PERF_RECORD_EXIT:
660 perf_event__process_task(event, sample, session);
661 break;
662 case PERF_RECORD_LOST:
663 perf_event__process_lost(event, sample, session);
664 default:
665 break;
668 return 0;
671 void thread__find_addr_map(struct thread *self,
672 struct perf_session *session, u8 cpumode,
673 enum map_type type, pid_t pid, u64 addr,
674 struct addr_location *al)
676 struct map_groups *mg = &self->mg;
677 struct machine *machine = NULL;
679 al->thread = self;
680 al->addr = addr;
681 al->cpumode = cpumode;
682 al->filtered = false;
684 if (cpumode == PERF_RECORD_MISC_KERNEL && perf_host) {
685 al->level = 'k';
686 machine = perf_session__find_host_machine(session);
687 if (machine == NULL) {
688 al->map = NULL;
689 return;
691 mg = &machine->kmaps;
692 } else if (cpumode == PERF_RECORD_MISC_USER && perf_host) {
693 al->level = '.';
694 machine = perf_session__find_host_machine(session);
695 } else if (cpumode == PERF_RECORD_MISC_GUEST_KERNEL && perf_guest) {
696 al->level = 'g';
697 machine = perf_session__find_machine(session, pid);
698 if (machine == NULL) {
699 al->map = NULL;
700 return;
702 mg = &machine->kmaps;
703 } else {
705 * 'u' means guest os user space.
706 * TODO: We don't support guest user space. Might support late.
708 if (cpumode == PERF_RECORD_MISC_GUEST_USER && perf_guest)
709 al->level = 'u';
710 else
711 al->level = 'H';
712 al->map = NULL;
714 if ((cpumode == PERF_RECORD_MISC_GUEST_USER ||
715 cpumode == PERF_RECORD_MISC_GUEST_KERNEL) &&
716 !perf_guest)
717 al->filtered = true;
718 if ((cpumode == PERF_RECORD_MISC_USER ||
719 cpumode == PERF_RECORD_MISC_KERNEL) &&
720 !perf_host)
721 al->filtered = true;
723 return;
725 try_again:
726 al->map = map_groups__find(mg, type, al->addr);
727 if (al->map == NULL) {
729 * If this is outside of all known maps, and is a negative
730 * address, try to look it up in the kernel dso, as it might be
731 * a vsyscall or vdso (which executes in user-mode).
733 * XXX This is nasty, we should have a symbol list in the
734 * "[vdso]" dso, but for now lets use the old trick of looking
735 * in the whole kernel symbol list.
737 if ((long long)al->addr < 0 &&
738 cpumode == PERF_RECORD_MISC_USER &&
739 machine && mg != &machine->kmaps) {
740 mg = &machine->kmaps;
741 goto try_again;
743 } else
744 al->addr = al->map->map_ip(al->map, al->addr);
747 void thread__find_addr_location(struct thread *self,
748 struct perf_session *session, u8 cpumode,
749 enum map_type type, pid_t pid, u64 addr,
750 struct addr_location *al,
751 symbol_filter_t filter)
753 thread__find_addr_map(self, session, cpumode, type, pid, addr, al);
754 if (al->map != NULL)
755 al->sym = map__find_symbol(al->map, al->addr, filter);
756 else
757 al->sym = NULL;
760 int perf_event__preprocess_sample(const union perf_event *event,
761 struct perf_session *session,
762 struct addr_location *al,
763 struct perf_sample *sample,
764 symbol_filter_t filter)
766 u8 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK;
767 struct thread *thread = perf_session__findnew(session, event->ip.pid);
769 if (thread == NULL)
770 return -1;
772 if (symbol_conf.comm_list &&
773 !strlist__has_entry(symbol_conf.comm_list, thread->comm))
774 goto out_filtered;
776 dump_printf(" ... thread: %s:%d\n", thread->comm, thread->pid);
778 * Have we already created the kernel maps for the host machine?
780 * This should have happened earlier, when we processed the kernel MMAP
781 * events, but for older perf.data files there was no such thing, so do
782 * it now.
784 if (cpumode == PERF_RECORD_MISC_KERNEL &&
785 session->host_machine.vmlinux_maps[MAP__FUNCTION] == NULL)
786 machine__create_kernel_maps(&session->host_machine);
788 thread__find_addr_map(thread, session, cpumode, MAP__FUNCTION,
789 event->ip.pid, event->ip.ip, al);
790 dump_printf(" ...... dso: %s\n",
791 al->map ? al->map->dso->long_name :
792 al->level == 'H' ? "[hypervisor]" : "<not found>");
793 al->sym = NULL;
794 al->cpu = sample->cpu;
796 if (al->map) {
797 if (symbol_conf.dso_list &&
798 (!al->map || !al->map->dso ||
799 !(strlist__has_entry(symbol_conf.dso_list,
800 al->map->dso->short_name) ||
801 (al->map->dso->short_name != al->map->dso->long_name &&
802 strlist__has_entry(symbol_conf.dso_list,
803 al->map->dso->long_name)))))
804 goto out_filtered;
806 al->sym = map__find_symbol(al->map, al->addr, filter);
809 if (symbol_conf.sym_list && al->sym &&
810 !strlist__has_entry(symbol_conf.sym_list, al->sym->name))
811 goto out_filtered;
813 return 0;
815 out_filtered:
816 al->filtered = true;
817 return 0;