18 #include <sys/types.h> 22 #include "linux/hash.h" 26 #include <symbol/kallsyms.h> 27 #include <linux/mman.h> 33 INIT_LIST_HEAD(&dsos->
head);
47 INIT_LIST_HEAD(&threads->
dead);
55 machine->
mmap_name = strdup(
"[kernel.kallsyms]");
57 machine->
mmap_name = strdup(
"[guest.kernel.kallsyms]");
58 else if (asprintf(&machine->
mmap_name,
"[guest.kernel.kallsyms.%d]",
69 memset(machine, 0,
sizeof(*machine));
71 RB_CLEAR_NODE(&machine->
rb_node);
87 machine->
root_dir = strdup(root_dir);
102 snprintf(comm,
sizeof(comm),
"[guest/%d]", pid);
122 if (machine != NULL) {
158 list_for_each_entry_safe(pos, n, &dsos->
head,
node) {
161 list_del_init(&pos->
node);
182 nd = rb_first(&threads->
entries);
225 machines->
guests = RB_ROOT;
237 struct rb_node **p = &machines->
guests.rb_node;
238 struct rb_node *parent = NULL;
251 pos = rb_entry(parent,
struct machine,
rb_node);
258 rb_link_node(&machine->
rb_node, parent, p);
270 for (nd = rb_first(&machines->
guests); nd; nd = rb_next(nd)) {
279 struct rb_node **p = &machines->
guests.rb_node;
280 struct rb_node *parent = NULL;
282 struct machine *default_machine = NULL;
285 return &machines->
host;
289 machine = rb_entry(parent,
struct machine,
rb_node);
290 if (pid < machine->pid)
292 else if (pid > machine->
pid)
297 default_machine = machine;
300 return default_machine;
309 if (machine && (machine->
pid == pid))
316 if (access(path, R_OK)) {
323 pr_err(
"Can't access file %s\n", path);
342 for (nd = rb_first(&machines->
guests); nd; nd = rb_next(nd)) {
350 struct rb_node *
node;
355 for (node = rb_first(&machines->
guests); node; node = rb_next(node)) {
356 machine = rb_entry(node,
struct machine,
rb_node);
368 if (pid == th->
pid_ || pid == -1 || th->
pid_ != -1)
386 if (th->
mg == leader->
mg)
396 pr_err(
"Discarding thread maps for %d:%d\n",
406 pr_err(
"Failed to join map groups for %d:%d\n", th->
pid_, th->
tid);
419 struct rb_node **p = &threads->
entries.rb_node;
420 struct rb_node *parent = NULL;
430 if (th->
tid == tid) {
442 if (th->
tid == tid) {
459 rb_link_node(&th->
rb_node, parent, p);
531 bool exec =
event->header.misc & PERF_RECORD_MISC_COMM_EXEC;
540 if (thread == NULL ||
542 dump_printf(
"problem processing PERF_RECORD_COMM, skipping event.\n");
561 "\nWARNING: kernel seems to support more namespaces than perf" 562 " tool.\nTry updating the perf tool..\n\n");
565 "\nWARNING: perf tool seems to support more namespaces than" 566 " the kernel.\nTry updating the kernel..\n\n");
571 if (thread == NULL ||
573 dump_printf(
"problem processing PERF_RECORD_NAMESPACES, skipping event.\n");
585 dump_printf(
": id:%" PRIu64
": lost:%" PRIu64
"\n",
593 dump_printf(
": id:%" PRIu64
": lost samples :%" PRIu64
"\n",
648 const char *dup_filename;
650 if (!filename || !dso || !dso->
long_name)
654 if (!strchr(filename,
'/'))
657 dup_filename = strdup(filename);
709 for (nd = rb_first(&machines->
guests); nd; nd = rb_next(nd)) {
718 bool (
skip)(
struct dso *
dso,
int parm),
int parm)
724 bool (
skip)(
struct dso *
dso,
int parm),
int parm)
729 for (nd = rb_first(&machines->
guests); nd; nd = rb_next(nd)) {
746 printed += fprintf(fp,
"[0] %s\n", filename);
750 printed += fprintf(fp,
"[%d] %s\n",
767 ret = fprintf(fp,
"Threads: %u\n", threads->
nr);
769 for (nd = rb_first(&threads->
entries); nd; nd = rb_next(nd)) {
782 const char *vmlinux_name = machine->
mmap_name;
816 scnprintf(buf, bufsz,
"%s/proc/kallsyms", machine->
root_dir);
826 const char **symbol_name, u64 *
start)
838 for (i = 0; (name = ref_reloc_sym_names[i]) != NULL; i++) {
875 pr_debug2(
"Added extra kernel map %s %" PRIx64
"-%" PRIx64
"\n",
886 const char *
syms[] = {
888 "__entry_trampoline_start",
889 "entry_SYSCALL_64_trampoline",
895 if (sym->
binding != STB_GLOBAL)
897 for (i = 0; i < ARRAY_SIZE(syms); i++) {
898 if (!strcmp(sym->
name, syms[i]))
910 #define X86_64_CPU_ENTRY_AREA_PER_CPU 0xfffffe0000000000ULL 911 #define X86_64_CPU_ENTRY_AREA_SIZE 0x2c000 912 #define X86_64_ENTRY_TRAMPOLINE 0x6000 920 int nr_cpus_avail, cpu;
931 struct map *dest_map;
951 for (cpu = 0; cpu < nr_cpus_avail; cpu++) {
973 struct dso *kernel __maybe_unused)
1024 struct dirent **namelist = NULL;
1040 for (i = 0; i < items; i++) {
1041 if (!
isdigit(namelist[i]->d_name[0])) {
1045 pid = (pid_t)strtol(namelist[i]->d_name, &endp, 10);
1046 if ((*endp !=
'\0') ||
1047 (endp == namelist[i]->d_name) ||
1048 (errno == ERANGE)) {
1049 pr_debug(
"invalid directory (%s). Skipping.\n",
1050 namelist[i]->d_name);
1053 sprintf(path,
"%s/%s/proc/kallsyms",
1055 namelist[i]->d_name);
1056 ret = access(path, R_OK);
1058 pr_debug(
"Can't access file %s\n", path);
1072 struct rb_node *next = rb_first(&machines->
guests);
1079 next = rb_next(&pos->
rb_node);
1089 if (machine == NULL)
1129 const char *prefix =
"Linux version ";
1131 sprintf(version,
"%s/proc/version", root_dir);
1132 file = fopen(version,
"r");
1137 tmp = fgets(version,
sizeof(version), file);
1140 name = strstr(version, prefix);
1143 name += strlen(prefix);
1144 tmp = strchr(name,
' ');
1148 return strdup(name);
1166 long_name = strdup(path);
1167 if (long_name == NULL)
1184 const char *dir_name,
int depth)
1186 struct dirent *dent;
1187 DIR *
dir = opendir(dir_name);
1191 pr_debug(
"%s: cannot open %s dir\n", __func__, dir_name);
1195 while ((dent = readdir(dir)) != NULL) {
1200 snprintf(path,
sizeof(path),
"%s/%s", dir_name, dent->d_name);
1201 if (stat(path, &st))
1204 if (S_ISDIR(st.st_mode)) {
1205 if (!strcmp(dent->d_name,
".") ||
1206 !strcmp(dent->d_name,
".."))
1211 if (!strcmp(dent->d_name,
"source") ||
1212 !strcmp(dent->d_name,
"build"))
1251 snprintf(modules_path,
sizeof(modules_path),
"%s/lib/modules/%s",
1258 const char *
name __maybe_unused)
1284 const char *modules;
1303 pr_debug(
"Problems setting modules path maps, continuing anyway...\n");
1317 if (start == 0 && end == 0)
1324 const char *
name = NULL;
1338 pr_debug(
"Problems creating module maps, " 1339 "continuing anyway...\n");
1341 pr_debug(
"Problems creating module maps for guest %d, " 1342 "continuing anyway...\n", machine->
pid);
1367 pr_debug(
"Problems creating extra kernel maps, continuing anyway...\n");
1401 struct dso *
kernel = kernel_map ? kernel_map->
dso : NULL;
1403 .
start =
event->mmap.start,
1404 .end =
event->mmap.start +
event->mmap.len,
1405 .pgoff =
event->mmap.pgoff,
1421 bool is_kernel_mmap;
1442 map->
end = map->
start +
event->mmap.len;
1443 }
else if (is_kernel_mmap) {
1444 const char *symbol_name = (
event->mmap.filename +
1475 PERF_RECORD_MISC_CPUMODE_UNKNOWN))
1490 kernel->
kernel = kernel_type;
1496 if (strstr(kernel->
long_name,
"vmlinux"))
1538 if (sample->
cpumode == PERF_RECORD_MISC_GUEST_KERNEL ||
1539 sample->
cpumode == PERF_RECORD_MISC_KERNEL) {
1561 goto out_problem_map;
1565 goto out_problem_insert;
1576 dump_printf(
"problem processing PERF_RECORD_MMAP2, skipping event.\n");
1591 if (sample->
cpumode == PERF_RECORD_MISC_GUEST_KERNEL ||
1592 sample->
cpumode == PERF_RECORD_MISC_KERNEL) {
1604 if (!(event->
header.misc & PERF_RECORD_MISC_MMAP_DATA))
1609 0, 0, 0, 0, prot, 0,
1614 goto out_problem_map;
1618 goto out_problem_insert;
1629 dump_printf(
"problem processing PERF_RECORD_MMAP, skipping event.\n");
1640 BUG_ON(refcount_read(&th->
refcnt) == 0);
1651 list_add_tail(&th->
node, &threads->
dead);
1683 dump_printf(
"removing erroneous parent thread %d/%d\n",
1692 if (thread != NULL) {
1700 if (thread == NULL || parent == NULL ||
1702 dump_printf(
"problem processing PERF_RECORD_FORK, skipping event.\n");
1721 if (thread != NULL) {
1734 switch (event->
header.type) {
1735 case PERF_RECORD_COMM:
1737 case PERF_RECORD_MMAP:
1739 case PERF_RECORD_NAMESPACES:
1741 case PERF_RECORD_MMAP2:
1743 case PERF_RECORD_FORK:
1745 case PERF_RECORD_EXIT:
1747 case PERF_RECORD_LOST:
1749 case PERF_RECORD_AUX:
1751 case PERF_RECORD_ITRACE_START:
1753 case PERF_RECORD_LOST_SAMPLES:
1755 case PERF_RECORD_SWITCH:
1756 case PERF_RECORD_SWITCH_CPU_WIDE:
1768 if (!regexec(regex, sym->
name, 0, NULL, 0))
1779 memset(&al, 0,
sizeof(al));
1798 u64
addr, u64 phys_addr)
1802 memset(&al, 0,
sizeof(al));
1831 char *srcline = NULL;
1838 bool show_sym =
false;
1842 sym, show_sym, show_addr, ip);
1866 int nr_loop_iter = 0;
1867 u64 iter_cycles = 0;
1875 if (ip >= PERF_CONTEXT_MAX) {
1877 case PERF_CONTEXT_HV:
1878 *cpumode = PERF_RECORD_MISC_HYPERVISOR;
1880 case PERF_CONTEXT_KERNEL:
1881 *cpumode = PERF_RECORD_MISC_KERNEL;
1883 case PERF_CONTEXT_USER:
1884 *cpumode = PERF_RECORD_MISC_USER;
1887 pr_debug(
"invalid callchain context: " 1888 "%"PRId64
"\n", (s64) ip);
1901 if (al.
sym != NULL) {
1919 iter_cycles = iter->
cycles;
1924 branch, flags, nr_loop_iter,
1925 iter_cycles, branch_from, srcline);
1938 for (i = 0; i < bs->
nr; i++) {
1954 for (i = 0; i < nr; i++)
1960 #define NO_ENTRY 0xff 1962 #define PERF_MAX_BRANCH_DEPTH 127 1975 for (i = 0; i < nr; i++) {
1981 }
else if (l[chash[h]].from == l[i].from) {
1982 bool is_loop =
true;
1985 for (j = chash[h]; j < i && i + off < nr; j++, off++)
1986 if (l[j].from != l[i + off].from) {
1996 memmove(iter + i, iter + i + off,
1999 memmove(l + i, l + i + off,
2025 int chain_nr =
min(max_stack, (
int)chain->
nr), i;
2026 u8 cpumode = PERF_RECORD_MISC_USER;
2027 u64 ip, branch_from = 0;
2029 for (i = 0; i < chain_nr; i++) {
2030 if (chain->
ips[i] == PERF_CONTEXT_USER)
2035 if (i != chain_nr) {
2037 int lbr_nr = lbr_stack->
nr, j, k;
2050 int mix_chain_nr = i + 1 + lbr_nr + 1;
2052 for (j = 0; j < mix_chain_nr; j++) {
2060 else if (j > i + 1) {
2079 else if (j > lbr_nr)
2080 ip = chain->
ips[i + 1 - (j - lbr_nr)];
2091 root_al, &cpumode, ip,
2092 branch, flags, NULL,
2095 return (err < 0) ?
err : 0;
2114 u8 cpumode = PERF_RECORD_MISC_USER;
2115 int i, j,
err, nr_entries;
2120 chain_nr = chain->
nr;
2124 root_al, max_stack);
2126 return (err < 0) ?
err : 0;
2148 int nr =
min(max_stack, (
int)branch->
nr);
2153 pr_warning(
"corrupted branch chain. skipping...\n");
2157 for (i = 0; i < nr; i++) {
2171 if (i == skip_idx ||
2172 chain->
ips[first_call] >= PERF_CONTEXT_MAX)
2174 else if (be[i].from < chain->ips[first_call] &&
2175 be[i].from >= chain->
ips[first_call] - 8)
2178 be[i] = branch->
entries[branch->
nr - i - 1];
2184 for (i = 0; i < nr; i++) {
2209 for (i = first_call, nr_entries = 0;
2210 i < chain_nr && nr_entries < max_stack; i++) {
2216 j = chain->
nr - i - 1;
2218 #ifdef HAVE_SKIP_CALLCHAIN_IDX 2224 if (ip < PERF_CONTEXT_MAX)
2228 root_al, &cpumode, ip,
2229 false, NULL, NULL, 0);
2232 return (err < 0) ?
err : 0;
2259 list_for_each_entry(ilist, &inline_node->
val,
list) {
2262 NULL, 0, 0, 0, ilist->
srcline);
2274 const char *srcline = NULL;
2285 false, NULL, 0, 0, 0, srcline);
2295 if (!((evsel->
attr.sample_type & PERF_SAMPLE_REGS_USER) &&
2296 (evsel->
attr.sample_type & PERF_SAMPLE_STACK_USER)))
2305 thread, sample, max_stack);
2351 struct thread *thread;
2356 threads = &machine->
threads[i];
2357 for (nd = rb_first(&threads->
entries); nd; nd = rb_next(nd)) {
2358 thread = rb_entry(nd,
struct thread,
rb_node);
2359 rc = fn(thread, priv);
2364 list_for_each_entry(thread, &threads->
dead,
node) {
2365 rc = fn(thread, priv);
2384 for (nd = rb_first(&machines->
guests); nd; nd = rb_next(nd)) {
2385 struct machine *machine = rb_entry(nd,
struct machine,
rb_node);
2397 unsigned int proc_map_timeout,
2398 unsigned int nr_threads_synthesize)
2406 nr_threads_synthesize);
2438 pr_err(
"Requested CPU %d too large. ", cpu);
2439 pr_err(
"Consider raising MAX_NR_CPUS\n");
2503 struct machine *machine = vmachine;
static struct threads * machine__threads(struct machine *machine, pid_t tid)
static bool symbol__match_regex(struct symbol *sym, regex_t *regex)
void srcline__tree_insert(struct rb_root *tree, u64 addr, char *srcline)
int machine__process_itrace_start_event(struct machine *machine __maybe_unused, union perf_event *event)
u64(* map_ip)(struct map *, u64)
static struct dso * machine__get_kernel(struct machine *machine)
static void thread__exited(struct thread *thread)
void machines__exit(struct machines *machines)
static void __machine__remove_thread(struct machine *machine, struct thread *th, bool lock)
int machine__process_switch_event(struct machine *machine __maybe_unused, union perf_event *event)
int machine__process_mmap2_event(struct machine *machine, union perf_event *event, struct perf_sample *sample)
struct map * map_groups__find_by_name(struct map_groups *mg, const char *name)
static void dso__set_loaded(struct dso *dso)
static int add_callchain_ip(struct thread *thread, struct callchain_cursor *cursor, struct symbol **parent, struct addr_location *root_al, u8 *cpumode, u64 ip, bool branch, struct branch_flags *flags, struct iterations *iter, u64 branch_from)
static int machine__set_modules_path(struct machine *machine)
struct dso * dsos__findnew(struct dsos *dsos, const char *name)
#define PERF_MAX_BRANCH_DEPTH
const char * vmlinux_name
int(* perf_event__handler_t)(struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct machine *machine)
struct rb_root inlined_nodes
struct kmap * map__kmap(struct map *map)
static void dsos__purge(struct dsos *dsos)
static bool machine__is_host(struct machine *machine)
static void skip(int size)
char * get_srcline(struct dso *dso, u64 addr, struct symbol *sym, bool show_sym, bool show_addr, u64 ip)
static void callchain_cursor_reset(struct callchain_cursor *cursor)
static struct version version
void machines__process_guests(struct machines *machines, machine__process_t process, void *data)
static u64 identity__map_ip(struct map *map __maybe_unused, u64 ip)
const char * default_guest_modules
void map_groups__exit(struct map_groups *mg)
int machine__process_aux_event(struct machine *machine __maybe_unused, union perf_event *event)
int machine__create_kernel_maps(struct machine *machine)
int __machine__synthesize_threads(struct machine *machine, struct perf_tool *tool, struct target *target, struct thread_map *threads, perf_event__handler_t process, bool data_mmap, unsigned int proc_map_timeout, unsigned int nr_threads_synthesize)
struct ip_callchain * callchain
void machine__remove_thread(struct machine *machine, struct thread *th)
size_t machines__fprintf_dsos(struct machines *machines, FILE *fp)
size_t perf_event__fprintf_comm(union perf_event *event, FILE *fp)
static void ip__resolve_data(struct thread *thread, u8 m, struct addr_map_symbol *ams, u64 addr, u64 phys_addr)
static void machine__update_thread_pid(struct machine *machine, struct thread *th, pid_t pid)
int machine__nr_cpus_avail(struct machine *machine)
static bool target__has_task(struct target *target)
int machines__create_kernel_maps(struct machines *machines, pid_t pid)
static char * callchain_srcline(struct map *map, struct symbol *sym, u64 ip)
int strlist__add(struct strlist *slist, const char *new_entry)
void machine__exit(struct machine *machine)
#define ENTRY_TRAMPOLINE_NAME
#define DEFAULT_GUEST_KERNEL_ID
int machine__process_exit_event(struct machine *machine, union perf_event *event, struct perf_sample *sample __maybe_unused)
int machine__init(struct machine *machine, const char *root_dir, pid_t pid)
int machine__for_each_thread(struct machine *machine, int(*fn)(struct thread *thread, void *p), void *priv)
size_t perf_event__fprintf_aux(union perf_event *event, FILE *fp)
#define pr_debug2(fmt,...)
static bool is_entry_trampoline(const char *name)
void dso__set_long_name(struct dso *dso, const char *name, bool name_allocated)
static void machine__threads_init(struct machine *machine)
struct thread * __machine__findnew_thread(struct machine *machine, pid_t pid, pid_t tid)
void machines__set_id_hdr_size(struct machines *machines, u16 id_hdr_size)
struct addr_map_symbol daddr
struct namespaces_event namespaces
static int resolve_lbr_callchain_sample(struct thread *thread, struct callchain_cursor *cursor, struct perf_sample *sample, struct symbol **parent, struct addr_location *root_al, int max_stack)
static void dsos__exit(struct dsos *dsos)
static int __machine__create_kernel_maps(struct machine *machine, struct dso *kernel)
struct branch_flags flags
struct machine * machines__findnew(struct machines *machines, pid_t pid)
int machine__set_current_tid(struct machine *machine, int cpu, pid_t pid, pid_t tid)
size_t __dsos__fprintf(struct list_head *head, FILE *fp)
int dump_printf(const char *fmt,...)
int up_write(struct rw_semaphore *sem)
int machine__process_event(struct machine *machine, union perf_event *event, struct perf_sample *sample)
void machine__get_kallsyms_filename(struct machine *machine, char *buf, size_t bufsz)
x86 movsq based memset() in arch/x86/lib/memset_64.S") MEMSET_FN(memset_erms
int unwind__get_entries(unwind_entry_cb_t cb, void *arg, struct thread *thread, struct perf_sample *data, int max_stack)
static int machine__create_module(void *arg, const char *name, u64 start, u64 size)
struct vdso_info * vdso_info
void map__put(struct map *map)
int map__set_kallsyms_ref_reloc_sym(struct map *map, const char *symbol_name, u64 addr)
void dso__put(struct dso *dso)
int thread__init_map_groups(struct thread *thread, struct machine *machine)
static bool __map__is_kmodule(const struct map *map)
struct dso * machine__findnew_dso(struct machine *machine, const char *filename)
bool symbol__restricted_filename(const char *filename, const char *restricted_filename)
static int machine__process_extra_kernel_map(struct machine *machine, union perf_event *event)
#define X86_64_ENTRY_TRAMPOLINE
struct branch_entry entries[0]
static int machine__set_mmap_name(struct machine *machine)
int down_read(struct rw_semaphore *sem)
const char * default_guest_vmlinux_name
struct lost_samples_event lost_samples
int dso__kernel_module_get_build_id(struct dso *dso, const char *root_dir)
void map_groups__init(struct map_groups *mg, struct machine *machine)
struct map * map__new(struct machine *machine, u64 start, u64 len, u64 pgoff, u32 d_maj, u32 d_min, u64 ino, u64 ino_gen, u32 prot, u32 flags, char *filename, struct thread *thread)
struct machine * machines__find(struct machines *machines, pid_t pid)
bool is_kernel_module(const char *pathname, int cpumode)
void machines__set_comm_exec(struct machines *machines, bool comm_exec)
struct dso * __dsos__find(struct dsos *dsos, const char *name, bool cmp_short)
struct comm * thread__exec_comm(const struct thread *thread)
void thread__find_cpumode_addr_location(struct thread *thread, u64 addr, struct addr_location *al)
static struct map * machine__kernel_map(struct machine *machine)
int arch_skip_callchain_idx(struct thread *thread, struct ip_callchain *chain)
struct thread * machine__find_thread(struct machine *machine, pid_t pid, pid_t tid)
struct map * maps__first(struct maps *maps)
int machine__get_kernel_start(struct machine *machine)
int exit_rwsem(struct rw_semaphore *sem)
static int append_inlines(struct callchain_cursor *cursor, struct map *map, struct symbol *sym, u64 ip)
#define pr_debug(fmt,...)
static bool target__has_cpu(struct target *target)
struct dso * machine__findnew_kernel(struct machine *machine, const char *name, const char *short_name, int dso_type)
static int map_groups__set_modules_path_dir(struct map_groups *mg, const char *dir_name, int depth)
static bool perf_event__is_extra_kernel_mmap(struct machine *machine, union perf_event *event)
int perf_event__synthesize_threads(struct perf_tool *tool, perf_event__handler_t process, struct machine *machine, bool mmap_data, unsigned int proc_map_timeout, unsigned int nr_threads_synthesize)
static int machine__create_modules(struct machine *machine)
int __weak machine__create_extra_kernel_maps(struct machine *machine __maybe_unused, struct dso *kernel __maybe_unused)
struct map * map__next(struct map *map)
struct threads threads[THREADS__TABLE_SIZE]
static int entry(u64 ip, struct unwind_info *ui)
size_t perf_event__fprintf_namespaces(union perf_event *event, FILE *fp)
size_t perf_event__fprintf_mmap2(union perf_event *event, FILE *fp)
struct regs_dump user_regs
size_t machine__fprintf_dsos_buildid(struct machine *m, FILE *fp, bool(skip)(struct dso *dso, int parm), int parm)
int machine__map_x86_64_entry_trampolines(struct machine *machine, struct dso *kernel)
static void dso__adjust_kmod_long_name(struct dso *dso, const char *filename)
static struct perf_tool tool
void inlines__tree_insert(struct rb_root *tree, struct inline_node *inlines)
static int unwind_entry(struct unwind_entry *entry, void *arg)
bool kptr_restrict_warned
struct dso * __dsos__addnew(struct dsos *dsos, const char *name)
char * srcline__tree_find(struct rb_root *tree, u64 addr)
struct dso * dso__get(struct dso *dso)
void machine__destroy_kernel_maps(struct machine *machine)
int thread__fork(struct thread *thread, struct thread *parent, u64 timestamp)
union perf_mem_data_src data_src
static void machine__set_kernel_mmap(struct machine *machine, u64 start, u64 end)
void machine__exit_vdso(struct machine *machine)
int __dso__load_kallsyms(struct dso *dso, const char *filename, struct map *map, bool no_kcore)
static int thread__resolve_callchain_unwind(struct thread *thread, struct callchain_cursor *cursor, struct perf_evsel *evsel, struct perf_sample *sample, int max_stack)
void dso__set_short_name(struct dso *dso, const char *name, bool name_allocated)
int machines__create_guest_kernel_maps(struct machines *machines)
static bool dso__is_kcore(struct dso *dso)
#define X86_64_CPU_ENTRY_AREA_PER_CPU
int callchain_cursor_append(struct callchain_cursor *cursor, u64 ip, struct map *map, struct symbol *sym, bool branch, struct branch_flags *flags, int nr_loop_iter, u64 iter_cycles, u64 branch_from, const char *srcline)
static void dsos__init(struct dsos *dsos)
struct branch_stack * branch_stack
void map_groups__fixup_end(struct map_groups *mg)
static int machine__process_kernel_mmap_event(struct machine *machine, union perf_event *event)
enum dso_kernel_type kernel
struct map_groups * kmaps
struct ref_reloc_sym * ref_reloc_sym
static char * get_kernel_version(const char *root_dir)
u64 map__rip_2objdump(struct map *map, u64 rip)
size_t machines__fprintf_dsos_buildid(struct machines *machines, FILE *fp, bool(skip)(struct dso *dso, int parm), int parm)
int thread__set_namespaces(struct thread *thread, u64 timestamp, struct namespaces_event *event)
const char * ref_reloc_sym_names[]
static void ip__resolve_ams(struct thread *thread, struct addr_map_symbol *ams, u64 ip)
int dso__load(struct dso *dso, struct map *map)
void machines__destroy_kernel_maps(struct machines *machines)
static int thread__resolve_callchain_sample(struct thread *thread, struct callchain_cursor *cursor, struct perf_evsel *evsel, struct perf_sample *sample, struct symbol **parent, struct addr_location *root_al, int max_stack)
static void map_groups__remove(struct map_groups *mg, struct map *map)
static struct thread_data threads[THREADS]
static struct map * map__get(struct map *map)
void(* machine__process_t)(struct machine *machine, void *data)
static struct map * map_groups__find(struct map_groups *mg, u64 addr)
struct perf_event_header header
static int thread__set_comm(struct thread *thread, const char *comm, u64 timestamp)
struct map_groups * map_groups__new(struct machine *machine)
int init_rwsem(struct rw_semaphore *sem)
struct inline_node * dso__parse_addr_inlines(struct dso *dso, u64 addr, struct symbol *sym)
struct machine * machines__add(struct machines *machines, pid_t pid, const char *root_dir)
void thread__put(struct thread *thread)
struct mem_info * mem_info__new(void)
int machine__load_vmlinux_path(struct machine *machine)
int machine__load_kallsyms(struct machine *machine, const char *filename)
static int machine__get_running_kernel_start(struct machine *machine, const char **symbol_name, u64 *start)
void map_groups__put(struct map_groups *mg)
regex_t ignore_callees_regex
void machines__init(struct machines *machines)
int machine__create_extra_kernel_map(struct machine *machine, struct dso *kernel, struct extra_kernel_map *xm)
struct kmap * __map__kmap(struct map *map)
static int sym(yyscan_t scanner, int type, int config)
void machine__delete(struct machine *machine)
static struct dso * machine__findnew_module_dso(struct machine *machine, struct kmod_path *m, const char *filename)
const char * default_guest_kallsyms
struct comm * machine__thread_exec_comm(struct machine *machine, struct thread *thread)
static struct map_groups * map_groups__get(struct map_groups *mg)
int perf_event__synthesize_thread_map(struct perf_tool *tool, struct thread_map *threads, perf_event__handler_t process, struct machine *machine, bool mmap_data, unsigned int proc_map_timeout)
struct machine * machine__new_host(void)
struct thread * thread__new(pid_t pid, pid_t tid)
struct symbol * thread__find_symbol(struct thread *thread, u8 cpumode, u64 addr, struct addr_location *al)
int perf_env__nr_cpus_avail(struct perf_env *env)
#define kmod_path__parse_name(__m, __p)
enum dso_binary_type symtab_type
#define X86_64_CPU_ENTRY_AREA_SIZE
void dso__set_module_info(struct dso *dso, struct kmod_path *m, struct machine *machine)
static struct symbol * machine__find_kernel_symbol(struct machine *machine, u64 addr, struct map **mapp)
size_t perf_event__fprintf_task(union perf_event *event, FILE *fp)
int arch__fix_module_text_start(u64 *start, const char *name)
static bool machine__uses_kcore(struct machine *machine)
struct addr_map_symbol to
#define THREADS__TABLE_SIZE
struct addr_map_symbol from
int kallsyms__get_function_start(const char *kallsyms_filename, const char *symbol_name, u64 *addr)
void dso__read_running_kernel_build_id(struct dso *dso, struct machine *machine)
static int map_groups__set_module_path(struct map_groups *mg, const char *path, struct kmod_path *m)
int machine__process_lost_event(struct machine *machine __maybe_unused, union perf_event *event, struct perf_sample *sample __maybe_unused)
const char * perf_env__raw_arch(struct perf_env *env)
int modules__parse(const char *filename, void *arg, int(*process_module)(void *arg, const char *name, u64 start, u64 size))
size_t perf_event__fprintf_switch(union perf_event *event, FILE *fp)
struct addr_map_symbol iaddr
int dso__load_vmlinux_path(struct dso *dso, struct map *map)
int machines__for_each_thread(struct machines *machines, int(*fn)(struct thread *thread, void *p), void *priv)
struct mem_info * sample__resolve_mem(struct perf_sample *sample, struct addr_location *al)
pid_t machine__get_current_tid(struct machine *machine, int cpu)
static struct thread * ____machine__findnew_thread(struct machine *machine, struct threads *threads, pid_t pid, pid_t tid, bool create)
struct thread * last_match
size_t machine__fprintf_vmlinux_path(struct machine *machine, FILE *fp)
static int remove_loops(struct branch_entry *l, int nr, struct iterations *iter)
int thread__insert_map(struct thread *thread, struct map *map)
int down_write(struct rw_semaphore *sem)
struct branch_info * sample__resolve_bstack(struct perf_sample *sample, struct addr_location *al)
u64(* unmap_ip)(struct map *, u64)
int thread__resolve_callchain(struct thread *thread, struct callchain_cursor *cursor, struct perf_evsel *evsel, struct perf_sample *sample, struct symbol **parent, struct addr_location *root_al, int max_stack)
size_t thread__fprintf(struct thread *thread, FILE *fp)
char * dso__build_id_filename(const struct dso *dso, char *bf, size_t size, bool is_debug)
static void save_iterations(struct iterations *iter, struct branch_entry *be, int nr)
struct comm * thread__comm(const struct thread *thread)
char * machine__resolve_kernel_addr(void *vmachine, unsigned long long *addrp, char **modp)
struct thread * thread__get(struct thread *thread)
#define pr_warning(fmt,...)
size_t __dsos__fprintf_buildid(struct list_head *head, FILE *fp, bool(skip)(struct dso *dso, int parm), int parm)
size_t perf_event__fprintf_mmap(union perf_event *event, FILE *fp)
struct symbol * dso__next_symbol(struct symbol *sym)
int machine__process_comm_event(struct machine *machine, union perf_event *event, struct perf_sample *sample)
static bool is_kmod_dso(struct dso *dso)
int vmlinux_path__nr_entries
static u64 find_entry_trampoline(struct dso *dso)
static void map_groups__insert(struct map_groups *mg, struct map *map)
int map__load(struct map *map)
size_t perf_event__fprintf_itrace_start(union perf_event *event, FILE *fp)
int up_read(struct rw_semaphore *sem)
void machine__delete_threads(struct machine *machine)
bool map_groups__empty(struct map_groups *mg)
struct stack_dump user_stack
static bool strlist__has_entry(struct strlist *slist, const char *entry)
struct strlist * strlist__new(const char *list, const struct strlist_config *config)
struct symbol * dso__first_symbol(struct dso *dso)
size_t machine__fprintf(struct machine *machine, FILE *fp)
struct thread * machine__findnew_thread(struct machine *machine, pid_t pid, pid_t tid)
struct map * machine__findnew_module_map(struct machine *machine, u64 start, const char *filename)
struct perf_event_attr attr
static bool perf_evsel__has_branch_callstack(const struct perf_evsel *evsel)
struct branch_flags flags
int __thread__set_comm(struct thread *thread, const char *str, u64 timestamp, bool exec)
int machine__process_fork_event(struct machine *machine, union perf_event *event, struct perf_sample *sample)
int machine__process_namespaces_event(struct machine *machine __maybe_unused, union perf_event *event, struct perf_sample *sample __maybe_unused)
struct map * map__new2(u64 start, struct dso *dso)
bool machine__is(struct machine *machine, const char *arch)
struct machine * machine__new_kallsyms(void)
struct inline_node * inlines__tree_find(struct rb_root *tree, u64 addr)
int machine__process_lost_samples_event(struct machine *machine __maybe_unused, union perf_event *event, struct perf_sample *sample)
static bool machine__is_default_guest(struct machine *machine)
int machine__process_mmap_event(struct machine *machine, union perf_event *event, struct perf_sample *sample)