Lines Matching full:machine

14 #include "machine.h"
46 static void __machine__remove_thread(struct machine *machine, struct thread *th, bool lock);
48 static struct dso *machine__kernel_dso(struct machine *machine) in machine__kernel_dso() argument
50 return machine->vmlinux_map->dso; in machine__kernel_dso()
60 static void machine__threads_init(struct machine *machine) in machine__threads_init() argument
65 struct threads *threads = &machine->threads[i]; in machine__threads_init()
74 static int machine__set_mmap_name(struct machine *machine) in machine__set_mmap_name() argument
76 if (machine__is_host(machine)) in machine__set_mmap_name()
77 machine->mmap_name = strdup("[kernel.kallsyms]"); in machine__set_mmap_name()
78 else if (machine__is_default_guest(machine)) in machine__set_mmap_name()
79 machine->mmap_name = strdup("[guest.kernel.kallsyms]"); in machine__set_mmap_name()
80 else if (asprintf(&machine->mmap_name, "[guest.kernel.kallsyms.%d]", in machine__set_mmap_name()
81 machine->pid) < 0) in machine__set_mmap_name()
82 machine->mmap_name = NULL; in machine__set_mmap_name()
84 return machine->mmap_name ? 0 : -ENOMEM; in machine__set_mmap_name()
95 int machine__init(struct machine *machine, const char *root_dir, pid_t pid) in machine__init() argument
99 memset(machine, 0, sizeof(*machine)); in machine__init()
100 machine->kmaps = maps__new(machine); in machine__init()
101 if (machine->kmaps == NULL) in machine__init()
104 RB_CLEAR_NODE(&machine->rb_node); in machine__init()
105 dsos__init(&machine->dsos); in machine__init()
107 machine__threads_init(machine); in machine__init()
109 machine->vdso_info = NULL; in machine__init()
110 machine->env = NULL; in machine__init()
112 machine->pid = pid; in machine__init()
114 machine->id_hdr_size = 0; in machine__init()
115 machine->kptr_restrict_warned = false; in machine__init()
116 machine->comm_exec = false; in machine__init()
117 machine->kernel_start = 0; in machine__init()
118 machine->vmlinux_map = NULL; in machine__init()
120 machine->root_dir = strdup(root_dir); in machine__init()
121 if (machine->root_dir == NULL) in machine__init()
124 if (machine__set_mmap_name(machine)) in machine__init()
128 struct thread *thread = machine__findnew_thread(machine, -1, in machine__init()
138 machine->current_tid = NULL; in machine__init()
143 zfree(&machine->kmaps); in machine__init()
144 zfree(&machine->root_dir); in machine__init()
145 zfree(&machine->mmap_name); in machine__init()
150 struct machine *machine__new_host(void) in machine__new_host()
152 struct machine *machine = malloc(sizeof(*machine)); in machine__new_host() local
154 if (machine != NULL) { in machine__new_host()
155 machine__init(machine, "", HOST_KERNEL_ID); in machine__new_host()
157 if (machine__create_kernel_maps(machine) < 0) in machine__new_host()
161 return machine; in machine__new_host()
163 free(machine); in machine__new_host()
167 struct machine *machine__new_kallsyms(void) in machine__new_kallsyms()
169 struct machine *machine = machine__new_host(); in machine__new_kallsyms() local
176 if (machine && machine__load_kallsyms(machine, "/proc/kallsyms") <= 0) { in machine__new_kallsyms()
177 machine__delete(machine); in machine__new_kallsyms()
178 machine = NULL; in machine__new_kallsyms()
181 return machine; in machine__new_kallsyms()
206 void machine__delete_threads(struct machine *machine) in machine__delete_threads() argument
212 struct threads *threads = &machine->threads[i]; in machine__delete_threads()
219 __machine__remove_thread(machine, t, false); in machine__delete_threads()
225 void machine__exit(struct machine *machine) in machine__exit() argument
229 if (machine == NULL) in machine__exit()
232 machine__destroy_kernel_maps(machine); in machine__exit()
233 maps__delete(machine->kmaps); in machine__exit()
234 dsos__exit(&machine->dsos); in machine__exit()
235 machine__exit_vdso(machine); in machine__exit()
236 zfree(&machine->root_dir); in machine__exit()
237 zfree(&machine->mmap_name); in machine__exit()
238 zfree(&machine->current_tid); in machine__exit()
239 zfree(&machine->kallsyms_filename); in machine__exit()
242 struct threads *threads = &machine->threads[i]; in machine__exit()
259 void machine__delete(struct machine *machine) in machine__delete() argument
261 if (machine) { in machine__delete()
262 machine__exit(machine); in machine__delete()
263 free(machine); in machine__delete()
279 struct machine *machines__add(struct machines *machines, pid_t pid, in machines__add()
284 struct machine *pos, *machine = malloc(sizeof(*machine)); in machines__add() local
287 if (machine == NULL) in machines__add()
290 if (machine__init(machine, root_dir, pid) != 0) { in machines__add()
291 free(machine); in machines__add()
297 pos = rb_entry(parent, struct machine, rb_node); in machines__add()
306 rb_link_node(&machine->rb_node, parent, p); in machines__add()
307 rb_insert_color_cached(&machine->rb_node, &machines->guests, leftmost); in machines__add()
309 machine->machines = machines; in machines__add()
311 return machine; in machines__add()
321 struct machine *machine = rb_entry(nd, struct machine, rb_node); in machines__set_comm_exec() local
323 machine->comm_exec = comm_exec; in machines__set_comm_exec()
327 struct machine *machines__find(struct machines *machines, pid_t pid) in machines__find()
331 struct machine *machine; in machines__find() local
332 struct machine *default_machine = NULL; in machines__find()
339 machine = rb_entry(parent, struct machine, rb_node); in machines__find()
340 if (pid < machine->pid) in machines__find()
342 else if (pid > machine->pid) in machines__find()
345 return machine; in machines__find()
346 if (!machine->pid) in machines__find()
347 default_machine = machine; in machines__find()
353 struct machine *machines__findnew(struct machines *machines, pid_t pid) in machines__findnew()
357 struct machine *machine = machines__find(machines, pid); in machines__findnew() local
359 if (machine && (machine->pid == pid)) in machines__findnew()
376 machine = NULL; in machines__findnew()
382 machine = machines__add(machines, pid, root_dir); in machines__findnew()
384 return machine; in machines__findnew()
387 struct machine *machines__find_guest(struct machines *machines, pid_t pid) in machines__find_guest()
389 struct machine *machine = machines__find(machines, pid); in machines__find_guest() local
391 if (!machine) in machines__find_guest()
392 machine = machines__findnew(machines, DEFAULT_GUEST_KERNEL_ID); in machines__find_guest()
393 return machine; in machines__find_guest()
398 * hypervisor, creating, running and destroying the virtual machine, and
417 * structures sane, using a thread belonging to the guest machine, instead
421 static struct thread *findnew_guest_code(struct machine *machine, in findnew_guest_code() argument
422 struct machine *host_machine, in findnew_guest_code()
429 if (!machine) in findnew_guest_code()
432 thread = machine__findnew_thread(machine, -1, pid); in findnew_guest_code()
464 struct machine *host_machine = machines__find(machines, HOST_KERNEL_ID); in machines__findnew_guest_code()
465 struct machine *machine = machines__findnew(machines, pid); in machines__findnew_guest_code() local
467 return findnew_guest_code(machine, host_machine, pid); in machines__findnew_guest_code()
470 struct thread *machine__findnew_guest_code(struct machine *machine, pid_t pid) in machine__findnew_guest_code() argument
472 struct machines *machines = machine->machines; in machine__findnew_guest_code()
473 struct machine *host_machine; in machine__findnew_guest_code()
480 return findnew_guest_code(machine, host_machine, pid); in machine__findnew_guest_code()
489 struct machine *pos = rb_entry(nd, struct machine, rb_node); in machines__process_guests()
497 struct machine *machine; in machines__set_id_hdr_size() local
503 machine = rb_entry(node, struct machine, rb_node); in machines__set_id_hdr_size()
504 machine->id_hdr_size = id_hdr_size; in machines__set_id_hdr_size()
510 static void machine__update_thread_pid(struct machine *machine, in machine__update_thread_pid() argument
523 leader = __machine__findnew_thread(machine, th->pid_, th->pid_); in machine__update_thread_pid()
528 leader->maps = maps__new(machine); in machine__update_thread_pid()
563 __threads__get_last_match(struct threads *threads, struct machine *machine, in __threads__get_last_match() argument
571 machine__update_thread_pid(machine, th, pid); in __threads__get_last_match()
582 threads__get_last_match(struct threads *threads, struct machine *machine, in threads__get_last_match() argument
588 th = __threads__get_last_match(threads, machine, pid, tid); in threads__get_last_match()
610 static struct thread *____machine__findnew_thread(struct machine *machine, in ____machine__findnew_thread() argument
620 th = threads__get_last_match(threads, machine, pid, tid); in ____machine__findnew_thread()
630 machine__update_thread_pid(machine, th, pid); in ____machine__findnew_thread()
657 if (thread__init_maps(th, machine)) { in ____machine__findnew_thread()
674 struct thread *__machine__findnew_thread(struct machine *machine, pid_t pid, pid_t tid) in __machine__findnew_thread() argument
676 return ____machine__findnew_thread(machine, machine__threads(machine, tid), pid, tid, true); in __machine__findnew_thread()
679 struct thread *machine__findnew_thread(struct machine *machine, pid_t pid, in machine__findnew_thread() argument
682 struct threads *threads = machine__threads(machine, tid); in machine__findnew_thread()
686 th = __machine__findnew_thread(machine, pid, tid); in machine__findnew_thread()
691 struct thread *machine__find_thread(struct machine *machine, pid_t pid, in machine__find_thread() argument
694 struct threads *threads = machine__threads(machine, tid); in machine__find_thread()
698 th = ____machine__findnew_thread(machine, threads, pid, tid, false); in machine__find_thread()
710 struct thread *machine__idle_thread(struct machine *machine) in machine__idle_thread() argument
712 struct thread *thread = machine__findnew_thread(machine, 0, 0); in machine__idle_thread()
716 pr_err("problem inserting idle task for machine pid %d\n", machine->pid); in machine__idle_thread()
721 struct comm *machine__thread_exec_comm(struct machine *machine, in machine__thread_exec_comm() argument
724 if (machine->comm_exec) in machine__thread_exec_comm()
730 int machine__process_comm_event(struct machine *machine, union perf_event *event, in machine__process_comm_event() argument
733 struct thread *thread = machine__findnew_thread(machine, in machine__process_comm_event()
740 machine->comm_exec = true; in machine__process_comm_event()
756 int machine__process_namespaces_event(struct machine *machine __maybe_unused, in machine__process_namespaces_event()
760 struct thread *thread = machine__findnew_thread(machine, in machine__process_namespaces_event()
787 int machine__process_cgroup_event(struct machine *machine, in machine__process_cgroup_event() argument
796 cgrp = cgroup__findnew(machine->env, event->cgroup.id, event->cgroup.path); in machine__process_cgroup_event()
803 int machine__process_lost_event(struct machine *machine __maybe_unused, in machine__process_lost_event()
811 int machine__process_lost_samples_event(struct machine *machine __maybe_unused, in machine__process_lost_samples_event()
819 static struct dso *machine__findnew_module_dso(struct machine *machine, in machine__findnew_module_dso() argument
825 down_write(&machine->dsos.lock); in machine__findnew_module_dso()
827 dso = __dsos__find(&machine->dsos, m->name, true); in machine__findnew_module_dso()
829 dso = __dsos__addnew(&machine->dsos, m->name); in machine__findnew_module_dso()
833 dso__set_module_info(dso, m, machine); in machine__findnew_module_dso()
840 up_write(&machine->dsos.lock); in machine__findnew_module_dso()
844 int machine__process_aux_event(struct machine *machine __maybe_unused, in machine__process_aux_event()
852 int machine__process_itrace_start_event(struct machine *machine __maybe_unused, in machine__process_itrace_start_event()
860 int machine__process_aux_output_hw_id_event(struct machine *machine __maybe_unused, in machine__process_aux_output_hw_id_event()
868 int machine__process_switch_event(struct machine *machine __maybe_unused, in machine__process_switch_event()
876 static int machine__process_ksymbol_register(struct machine *machine, in machine__process_ksymbol_register() argument
881 struct map *map = maps__find(machine__kernel_maps(machine), event->ksymbol.addr); in machine__process_ksymbol_register()
904 maps__insert(machine__kernel_maps(machine), map); in machine__process_ksymbol_register()
923 static int machine__process_ksymbol_unregister(struct machine *machine, in machine__process_ksymbol_unregister() argument
930 map = maps__find(machine__kernel_maps(machine), event->ksymbol.addr); in machine__process_ksymbol_unregister()
934 if (map != machine->vmlinux_map) in machine__process_ksymbol_unregister()
935 maps__remove(machine__kernel_maps(machine), map); in machine__process_ksymbol_unregister()
945 int machine__process_ksymbol(struct machine *machine __maybe_unused, in machine__process_ksymbol()
953 return machine__process_ksymbol_unregister(machine, event, in machine__process_ksymbol()
955 return machine__process_ksymbol_register(machine, event, sample); in machine__process_ksymbol()
958 int machine__process_text_poke(struct machine *machine, union perf_event *event, in machine__process_text_poke() argument
961 struct map *map = maps__find(machine__kernel_maps(machine), event->text_poke.addr); in machine__process_text_poke()
965 perf_event__fprintf_text_poke(event, machine, stdout); in machine__process_text_poke()
984 ret = dso__data_write_cache_addr(map->dso, map, machine, in machine__process_text_poke()
999 static struct map *machine__addnew_module_map(struct machine *machine, u64 start, in machine__addnew_module_map() argument
1009 dso = machine__findnew_module_dso(machine, &m, filename); in machine__addnew_module_map()
1017 maps__insert(machine__kernel_maps(machine), map); in machine__addnew_module_map()
1034 struct machine *pos = rb_entry(nd, struct machine, rb_node); in machines__fprintf_dsos()
1041 size_t machine__fprintf_dsos_buildid(struct machine *m, FILE *fp, in machine__fprintf_dsos_buildid()
1054 struct machine *pos = rb_entry(nd, struct machine, rb_node); in machines__fprintf_dsos_buildid()
1060 size_t machine__fprintf_vmlinux_path(struct machine *machine, FILE *fp) in machine__fprintf_vmlinux_path() argument
1064 struct dso *kdso = machine__kernel_dso(machine); in machine__fprintf_vmlinux_path()
1080 size_t machine__fprintf(struct machine *machine, FILE *fp) in machine__fprintf() argument
1087 struct threads *threads = &machine->threads[i]; in machine__fprintf()
1105 static struct dso *machine__get_kernel(struct machine *machine) in machine__get_kernel() argument
1107 const char *vmlinux_name = machine->mmap_name; in machine__get_kernel()
1110 if (machine__is_host(machine)) { in machine__get_kernel()
1114 kernel = machine__findnew_kernel(machine, vmlinux_name, in machine__get_kernel()
1120 kernel = machine__findnew_kernel(machine, vmlinux_name, in machine__get_kernel()
1126 dso__read_running_kernel_build_id(kernel, machine); in machine__get_kernel()
1131 void machine__get_kallsyms_filename(struct machine *machine, char *buf, in machine__get_kallsyms_filename() argument
1134 if (machine__is_default_guest(machine)) in machine__get_kallsyms_filename()
1137 scnprintf(buf, bufsz, "%s/proc/kallsyms", machine->root_dir); in machine__get_kallsyms_filename()
1146 static int machine__get_running_kernel_start(struct machine *machine, in machine__get_running_kernel_start() argument
1155 machine__get_kallsyms_filename(machine, filename, PATH_MAX); in machine__get_running_kernel_start()
1181 int machine__create_extra_kernel_map(struct machine *machine, in machine__create_extra_kernel_map() argument
1199 maps__insert(machine__kernel_maps(machine), map); in machine__create_extra_kernel_map()
1241 int machine__map_x86_64_entry_trampolines(struct machine *machine, in machine__map_x86_64_entry_trampolines() argument
1244 struct maps *kmaps = machine__kernel_maps(machine); in machine__map_x86_64_entry_trampolines()
1266 if (found || machine->trampolines_mapped) in machine__map_x86_64_entry_trampolines()
1273 nr_cpus_avail = machine__nr_cpus_avail(machine); in machine__map_x86_64_entry_trampolines()
1288 if (machine__create_extra_kernel_map(machine, kernel, &xm) < 0) in machine__map_x86_64_entry_trampolines()
1292 machine->trampolines_mapped = nr_cpus_avail; in machine__map_x86_64_entry_trampolines()
1297 int __weak machine__create_extra_kernel_maps(struct machine *machine __maybe_unused, in machine__create_extra_kernel_maps()
1304 __machine__create_kernel_maps(struct machine *machine, struct dso *kernel) in __machine__create_kernel_maps() argument
1307 machine__destroy_kernel_maps(machine); in __machine__create_kernel_maps()
1309 machine->vmlinux_map = map__new2(0, kernel); in __machine__create_kernel_maps()
1310 if (machine->vmlinux_map == NULL) in __machine__create_kernel_maps()
1313 machine->vmlinux_map->map_ip = machine->vmlinux_map->unmap_ip = identity__map_ip; in __machine__create_kernel_maps()
1314 maps__insert(machine__kernel_maps(machine), machine->vmlinux_map); in __machine__create_kernel_maps()
1318 void machine__destroy_kernel_maps(struct machine *machine) in machine__destroy_kernel_maps() argument
1321 struct map *map = machine__kernel_map(machine); in machine__destroy_kernel_maps()
1327 maps__remove(machine__kernel_maps(machine), map); in machine__destroy_kernel_maps()
1333 map__zput(machine->vmlinux_map); in machine__destroy_kernel_maps()
1392 struct machine *pos = rb_entry(next, struct machine, rb_node); in machines__destroy_kernel_maps()
1402 struct machine *machine = machines__findnew(machines, pid); in machines__create_kernel_maps() local
1404 if (machine == NULL) in machines__create_kernel_maps()
1407 return machine__create_kernel_maps(machine); in machines__create_kernel_maps()
1410 int machine__load_kallsyms(struct machine *machine, const char *filename) in machine__load_kallsyms() argument
1412 struct map *map = machine__kernel_map(machine); in machine__load_kallsyms()
1422 maps__fixup_end(machine__kernel_maps(machine)); in machine__load_kallsyms()
1428 int machine__load_vmlinux_path(struct machine *machine) in machine__load_vmlinux_path() argument
1430 struct map *map = machine__kernel_map(machine); in machine__load_vmlinux_path()
1557 static int machine__set_modules_path(struct machine *machine) in machine__set_modules_path() argument
1562 version = get_kernel_version(machine->root_dir); in machine__set_modules_path()
1567 machine->root_dir, version); in machine__set_modules_path()
1570 return maps__set_modules_path_dir(machine__kernel_maps(machine), modules_path, 0); in machine__set_modules_path()
1582 struct machine *machine = arg; in machine__create_module() local
1588 map = machine__addnew_module_map(machine, start, name); in machine__create_module()
1593 dso__kernel_module_get_build_id(map->dso, machine->root_dir); in machine__create_module()
1598 static int machine__create_modules(struct machine *machine) in machine__create_modules() argument
1603 if (machine__is_default_guest(machine)) { in machine__create_modules()
1606 snprintf(path, PATH_MAX, "%s/proc/modules", machine->root_dir); in machine__create_modules()
1613 if (modules__parse(modules, machine, machine__create_module)) in machine__create_modules()
1616 if (!machine__set_modules_path(machine)) in machine__create_modules()
1624 static void machine__set_kernel_mmap(struct machine *machine, in machine__set_kernel_mmap() argument
1627 machine->vmlinux_map->start = start; in machine__set_kernel_mmap()
1628 machine->vmlinux_map->end = end; in machine__set_kernel_mmap()
1634 machine->vmlinux_map->end = ~0ULL; in machine__set_kernel_mmap()
1637 static void machine__update_kernel_mmap(struct machine *machine, in machine__update_kernel_mmap() argument
1640 struct map *map = machine__kernel_map(machine); in machine__update_kernel_mmap()
1643 maps__remove(machine__kernel_maps(machine), map); in machine__update_kernel_mmap()
1645 machine__set_kernel_mmap(machine, start, end); in machine__update_kernel_mmap()
1647 maps__insert(machine__kernel_maps(machine), map); in machine__update_kernel_mmap()
1651 int machine__create_kernel_maps(struct machine *machine) in machine__create_kernel_maps() argument
1653 struct dso *kernel = machine__get_kernel(machine); in machine__create_kernel_maps()
1662 ret = __machine__create_kernel_maps(machine, kernel); in machine__create_kernel_maps()
1666 if (symbol_conf.use_modules && machine__create_modules(machine) < 0) { in machine__create_kernel_maps()
1667 if (machine__is_host(machine)) in machine__create_kernel_maps()
1672 "continuing anyway...\n", machine->pid); in machine__create_kernel_maps()
1675 if (!machine__get_running_kernel_start(machine, &name, &start, &end)) { in machine__create_kernel_maps()
1677 map__set_kallsyms_ref_reloc_sym(machine->vmlinux_map, name, start)) { in machine__create_kernel_maps()
1678 machine__destroy_kernel_maps(machine); in machine__create_kernel_maps()
1687 machine__update_kernel_mmap(machine, start, end); in machine__create_kernel_maps()
1690 if (machine__create_extra_kernel_maps(machine, kernel)) in machine__create_kernel_maps()
1695 map = map__next(machine__kernel_map(machine)); in machine__create_kernel_maps()
1697 machine__set_kernel_mmap(machine, start, map->start); in machine__create_kernel_maps()
1705 static bool machine__uses_kcore(struct machine *machine) in machine__uses_kcore() argument
1709 list_for_each_entry(dso, &machine->dsos.head, node) { in machine__uses_kcore()
1717 static bool perf_event__is_extra_kernel_mmap(struct machine *machine, in perf_event__is_extra_kernel_mmap() argument
1720 return machine__is(machine, "x86_64") && in perf_event__is_extra_kernel_mmap()
1724 static int machine__process_extra_kernel_map(struct machine *machine, in machine__process_extra_kernel_map() argument
1727 struct dso *kernel = machine__kernel_dso(machine); in machine__process_extra_kernel_map()
1732 return machine__create_extra_kernel_map(machine, kernel, xm); in machine__process_extra_kernel_map()
1735 static int machine__process_kernel_mmap_event(struct machine *machine, in machine__process_kernel_mmap_event() argument
1742 const char *mmap_name = machine->mmap_name; in machine__process_kernel_mmap_event()
1745 if (machine__uses_kcore(machine)) in machine__process_kernel_mmap_event()
1748 if (machine__is_host(machine)) in machine__process_kernel_mmap_event()
1754 if (!is_kernel_mmap && !machine__is_host(machine)) { in machine__process_kernel_mmap_event()
1765 map = machine__addnew_module_map(machine, xm->start, in machine__process_kernel_mmap_event()
1784 down_read(&machine->dsos.lock); in machine__process_kernel_mmap_event()
1786 list_for_each_entry(dso, &machine->dsos.head, node) { in machine__process_kernel_mmap_event()
1814 up_read(&machine->dsos.lock); in machine__process_kernel_mmap_event()
1817 kernel = machine__findnew_dso(machine, machine->mmap_name); in machine__process_kernel_mmap_event()
1822 if (__machine__create_kernel_maps(machine, kernel) < 0) { in machine__process_kernel_mmap_event()
1830 machine__update_kernel_mmap(machine, xm->start, xm->end); in machine__process_kernel_mmap_event()
1841 map__set_kallsyms_ref_reloc_sym(machine->vmlinux_map, in machine__process_kernel_mmap_event()
1846 if (machine__is_default_guest(machine)) { in machine__process_kernel_mmap_event()
1850 dso__load(kernel, machine__kernel_map(machine)); in machine__process_kernel_mmap_event()
1852 } else if (perf_event__is_extra_kernel_mmap(machine, xm)) { in machine__process_kernel_mmap_event()
1853 return machine__process_extra_kernel_map(machine, xm); in machine__process_kernel_mmap_event()
1860 int machine__process_mmap2_event(struct machine *machine, in machine__process_mmap2_event() argument
1892 ret = machine__process_kernel_mmap_event(machine, &xm, bid); in machine__process_mmap2_event()
1898 thread = machine__findnew_thread(machine, event->mmap2.pid, in machine__process_mmap2_event()
1903 map = map__new(machine, event->mmap2.start, in machine__process_mmap2_event()
1929 int machine__process_mmap_event(struct machine *machine, union perf_event *event, in machine__process_mmap_event() argument
1949 ret = machine__process_kernel_mmap_event(machine, &xm, NULL); in machine__process_mmap_event()
1955 thread = machine__findnew_thread(machine, event->mmap.pid, in machine__process_mmap_event()
1963 map = map__new(machine, event->mmap.start, in machine__process_mmap_event()
1987 static void __machine__remove_thread(struct machine *machine, struct thread *th, bool lock) in __machine__remove_thread() argument
1989 struct threads *threads = machine__threads(machine, th->tid); in __machine__remove_thread()
2020 void machine__remove_thread(struct machine *machine, struct thread *th) in machine__remove_thread() argument
2022 return __machine__remove_thread(machine, th, true); in machine__remove_thread()
2025 int machine__process_fork_event(struct machine *machine, union perf_event *event, in machine__process_fork_event() argument
2028 struct thread *thread = machine__find_thread(machine, in machine__process_fork_event()
2031 struct thread *parent = machine__findnew_thread(machine, in machine__process_fork_event()
2049 machine__remove_thread(machine, parent); in machine__process_fork_event()
2051 parent = machine__findnew_thread(machine, event->fork.ppid, in machine__process_fork_event()
2057 machine__remove_thread(machine, thread); in machine__process_fork_event()
2061 thread = machine__findnew_thread(machine, event->fork.pid, in machine__process_fork_event()
2065 * objects for the already running tasks on the machine. in machine__process_fork_event()
2091 int machine__process_exit_event(struct machine *machine, union perf_event *event, in machine__process_exit_event() argument
2094 struct thread *thread = machine__find_thread(machine, in machine__process_exit_event()
2109 int machine__process_event(struct machine *machine, union perf_event *event, in machine__process_event() argument
2116 ret = machine__process_comm_event(machine, event, sample); break; in machine__process_event()
2118 ret = machine__process_mmap_event(machine, event, sample); break; in machine__process_event()
2120 ret = machine__process_namespaces_event(machine, event, sample); break; in machine__process_event()
2122 ret = machine__process_cgroup_event(machine, event, sample); break; in machine__process_event()
2124 ret = machine__process_mmap2_event(machine, event, sample); break; in machine__process_event()
2126 ret = machine__process_fork_event(machine, event, sample); break; in machine__process_event()
2128 ret = machine__process_exit_event(machine, event, sample); break; in machine__process_event()
2130 ret = machine__process_lost_event(machine, event, sample); break; in machine__process_event()
2132 ret = machine__process_aux_event(machine, event); break; in machine__process_event()
2134 ret = machine__process_itrace_start_event(machine, event); break; in machine__process_event()
2136 ret = machine__process_lost_samples_event(machine, event, sample); break; in machine__process_event()
2139 ret = machine__process_switch_event(machine, event); break; in machine__process_event()
2141 ret = machine__process_ksymbol(machine, event, sample); break; in machine__process_event()
2143 ret = machine__process_bpf(machine, event, sample); break; in machine__process_event()
2145 ret = machine__process_text_poke(machine, event, sample); break; in machine__process_event()
2147 ret = machine__process_aux_output_hw_id_event(machine, event); break; in machine__process_event()
2825 if (machine__normalized_is(thread->maps->machine, "arm64")) in get_leaf_frame_caller()
3131 int machine__for_each_thread(struct machine *machine, in machine__for_each_thread() argument
3142 threads = &machine->threads[i]; in machine__for_each_thread()
3172 struct machine *machine = rb_entry(nd, struct machine, rb_node); in machines__for_each_thread() local
3174 rc = machine__for_each_thread(machine, fn, priv); in machines__for_each_thread()
3181 pid_t machine__get_current_tid(struct machine *machine, int cpu) in machine__get_current_tid() argument
3183 if (cpu < 0 || (size_t)cpu >= machine->current_tid_sz) in machine__get_current_tid()
3186 return machine->current_tid[cpu]; in machine__get_current_tid()
3189 int machine__set_current_tid(struct machine *machine, int cpu, pid_t pid, in machine__set_current_tid() argument
3198 if (realloc_array_as_needed(machine->current_tid, in machine__set_current_tid()
3199 machine->current_tid_sz, in machine__set_current_tid()
3204 machine->current_tid[cpu] = tid; in machine__set_current_tid()
3206 thread = machine__findnew_thread(machine, pid, tid); in machine__set_current_tid()
3220 bool machine__is(struct machine *machine, const char *arch) in machine__is() argument
3222 return machine && !strcmp(perf_env__raw_arch(machine->env), arch); in machine__is()
3225 bool machine__normalized_is(struct machine *machine, const char *arch) in machine__normalized_is() argument
3227 return machine && !strcmp(perf_env__arch(machine->env), arch); in machine__normalized_is()
3230 int machine__nr_cpus_avail(struct machine *machine) in machine__nr_cpus_avail() argument
3232 return machine ? perf_env__nr_cpus_avail(machine->env) : 0; in machine__nr_cpus_avail()
3235 int machine__get_kernel_start(struct machine *machine) in machine__get_kernel_start() argument
3237 struct map *map = machine__kernel_map(machine); in machine__get_kernel_start()
3248 machine->kernel_start = 1ULL << 63; in machine__get_kernel_start()
3256 if (!err && !machine__is(machine, "x86_64")) in machine__get_kernel_start()
3257 machine->kernel_start = map->start; in machine__get_kernel_start()
3262 u8 machine__addr_cpumode(struct machine *machine, u8 cpumode, u64 addr) in machine__addr_cpumode() argument
3267 if (!machine->single_address_space) in machine__addr_cpumode()
3270 kernel_ip = machine__kernel_ip(machine, addr); in machine__addr_cpumode()
3289 struct dso *machine__findnew_dso_id(struct machine *machine, const char *filename, struct dso_id *i… in machine__findnew_dso_id() argument
3291 return dsos__findnew_id(&machine->dsos, filename, id); in machine__findnew_dso_id()
3294 struct dso *machine__findnew_dso(struct machine *machine, const char *filename) in machine__findnew_dso() argument
3296 return machine__findnew_dso_id(machine, filename, NULL); in machine__findnew_dso()
3301 struct machine *machine = vmachine; in machine__resolve_kernel_addr() local
3303 struct symbol *sym = machine__find_kernel_symbol(machine, *addrp, &map); in machine__resolve_kernel_addr()
3313 int machine__for_each_dso(struct machine *machine, machine__dso_t fn, void *priv) in machine__for_each_dso() argument
3318 list_for_each_entry(pos, &machine->dsos.head, node) { in machine__for_each_dso()
3319 if (fn(pos, machine, priv)) in machine__for_each_dso()
3325 int machine__for_each_kernel_map(struct machine *machine, machine__map_t fn, void *priv) in machine__for_each_kernel_map() argument
3327 struct maps *maps = machine__kernel_maps(machine); in machine__for_each_kernel_map()