*     index:  of callchain entry that needs to be ignored (if any)
  *     -1      if no entry needs to be ignored or in case of errors
  */
-int arch_skip_callchain_idx(struct machine *machine, struct thread *thread,
-                               struct ip_callchain *chain)
+int arch_skip_callchain_idx(struct thread *thread, struct ip_callchain *chain)
 {
        struct addr_location al;
        struct dso *dso = NULL;
 
        ip = chain->ips[2];
 
-       thread__find_addr_location(thread, machine, PERF_RECORD_MISC_USER,
+       thread__find_addr_location(thread, PERF_RECORD_MISC_USER,
                        MAP__FUNCTION, ip, &al);
 
        if (al.map)
 
                goto repipe;
        }
 
-       thread__find_addr_map(thread, machine, cpumode, MAP__FUNCTION,
-                             sample->ip, &al);
+       thread__find_addr_map(thread, cpumode, MAP__FUNCTION, sample->ip, &al);
 
        if (al.map != NULL) {
                if (!al.map->dso->hit) {
 
 
 static void print_sample_addr(union perf_event *event,
                          struct perf_sample *sample,
-                         struct machine *machine,
                          struct thread *thread,
                          struct perf_event_attr *attr)
 {
        if (!sample_addr_correlates_sym(attr))
                return;
 
-       perf_event__preprocess_sample_addr(event, sample, machine, thread, &al);
+       perf_event__preprocess_sample_addr(event, sample, thread, &al);
 
        if (PRINT_FIELD(SYM)) {
                printf(" ");
            ((evsel->attr.sample_type & PERF_SAMPLE_ADDR) &&
             !output[attr->type].user_set)) {
                printf(" => ");
-               print_sample_addr(event, sample, al->machine, thread, attr);
+               print_sample_addr(event, sample, thread, attr);
        }
 
        if (print_srcline_last)
                event_format__print(evsel->tp_format, sample->cpu,
                                    sample->raw_data, sample->raw_size);
        if (PRINT_FIELD(ADDR))
-               print_sample_addr(event, sample, al->machine, thread, attr);
+               print_sample_addr(event, sample, thread, attr);
 
        if (PRINT_FIELD(IP)) {
                if (!symbol_conf.use_callchain)
 
                }
 
                tal.filtered = 0;
-               thread__find_addr_location(al.thread, machine, cpumode,
+               thread__find_addr_location(al.thread, cpumode,
                                           MAP__FUNCTION, ip, &tal);
 
                if (tal.sym)
 
        if (trace->summary_only)
                return 0;
 
-       thread__find_addr_location(thread, trace->host, cpumode, MAP__FUNCTION,
+       thread__find_addr_location(thread, cpumode, MAP__FUNCTION,
                              sample->ip, &al);
 
        trace__fprintf_entry_head(trace, thread, 0, sample->time, trace->output);
 
        fprintf(trace->output, "] => ");
 
-       thread__find_addr_location(thread, trace->host, cpumode, MAP__VARIABLE,
+       thread__find_addr_location(thread, cpumode, MAP__VARIABLE,
                                   sample->addr, &al);
 
        if (!al.map) {
-               thread__find_addr_location(thread, trace->host, cpumode,
+               thread__find_addr_location(thread, cpumode,
                                           MAP__FUNCTION, sample->addr, &al);
 
                if (al.map)
 
 
        pr_debug("Reading object code for memory address: %#"PRIx64"\n", addr);
 
-       thread__find_addr_map(thread, machine, cpumode, MAP__FUNCTION, addr,
-                             &al);
+       thread__find_addr_map(thread, cpumode, MAP__FUNCTION, addr, &al);
        if (!al.map || !al.map->dso) {
                pr_debug("thread__find_addr_map failed\n");
                return -1;
 
 
                pr_debug("looking for map %p\n", td->map);
 
-               thread__find_addr_map(thread, machine,
+               thread__find_addr_map(thread,
                                      PERF_RECORD_MISC_USER, MAP__FUNCTION,
                                      (unsigned long) (td->map + 1), &al);
 
 
                return -1;
        }
 
-       thread__find_addr_map(thread, machine, cpumode, MAP__FUNCTION,
-                             sample->ip, &al);
+       thread__find_addr_map(thread, cpumode, MAP__FUNCTION, sample->ip, &al);
 
        if (al.map != NULL)
                al.map->dso->hit = 1;
 
 }
 
 #ifdef HAVE_SKIP_CALLCHAIN_IDX
-extern int arch_skip_callchain_idx(struct machine *machine,
-                       struct thread *thread, struct ip_callchain *chain);
+extern int arch_skip_callchain_idx(struct thread *thread, struct ip_callchain *chain);
 #else
-static inline int arch_skip_callchain_idx(struct machine *machine __maybe_unused,
-                       struct thread *thread __maybe_unused,
+static inline int arch_skip_callchain_idx(struct thread *thread __maybe_unused,
                        struct ip_callchain *chain __maybe_unused)
 {
        return -1;
 
        return machine__process_event(machine, event, sample);
 }
 
-void thread__find_addr_map(struct thread *thread,
-                          struct machine *machine, u8 cpumode,
+void thread__find_addr_map(struct thread *thread, u8 cpumode,
                           enum map_type type, u64 addr,
                           struct addr_location *al)
 {
        struct map_groups *mg = thread->mg;
+       struct machine *machine = mg->machine;
        bool load_map = false;
 
        al->machine = machine;
        }
 }
 
-void thread__find_addr_location(struct thread *thread, struct machine *machine,
+void thread__find_addr_location(struct thread *thread,
                                u8 cpumode, enum map_type type, u64 addr,
                                struct addr_location *al)
 {
-       thread__find_addr_map(thread, machine, cpumode, type, addr, al);
+       thread__find_addr_map(thread, cpumode, type, addr, al);
        if (al->map != NULL)
                al->sym = map__find_symbol(al->map, al->addr,
-                                          machine->symbol_filter);
+                                          thread->mg->machine->symbol_filter);
        else
                al->sym = NULL;
 }
            machine->vmlinux_maps[MAP__FUNCTION] == NULL)
                machine__create_kernel_maps(machine);
 
-       thread__find_addr_map(thread, machine, cpumode, MAP__FUNCTION,
-                             sample->ip, al);
+       thread__find_addr_map(thread, cpumode, MAP__FUNCTION, sample->ip, al);
        dump_printf(" ...... dso: %s\n",
                    al->map ? al->map->dso->long_name :
                        al->level == 'H' ? "[hypervisor]" : "<not found>");
 
 void perf_event__preprocess_sample_addr(union perf_event *event,
                                        struct perf_sample *sample,
-                                       struct machine *machine,
                                        struct thread *thread,
                                        struct addr_location *al)
 {
        u8 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK;
 
-       thread__find_addr_map(thread, machine, cpumode, MAP__FUNCTION,
-                             sample->addr, al);
+       thread__find_addr_map(thread, cpumode, MAP__FUNCTION, sample->addr, al);
        if (!al->map)
-               thread__find_addr_map(thread, machine, cpumode, MAP__VARIABLE,
+               thread__find_addr_map(thread, cpumode, MAP__VARIABLE,
                                      sample->addr, al);
 
        al->cpu = sample->cpu;
 
 bool sample_addr_correlates_sym(struct perf_event_attr *attr);
 void perf_event__preprocess_sample_addr(union perf_event *event,
                                        struct perf_sample *sample,
-                                       struct machine *machine,
                                        struct thread *thread,
                                        struct addr_location *al);
 
 
        return 0;
 }
 
-static void ip__resolve_ams(struct machine *machine, struct thread *thread,
+static void ip__resolve_ams(struct thread *thread,
                            struct addr_map_symbol *ams,
                            u64 ip)
 {
         * Thus, we have to try consecutively until we find a match
         * or else, the symbol is unknown
         */
-       thread__find_cpumode_addr_location(thread, machine, MAP__FUNCTION, ip, &al);
+       thread__find_cpumode_addr_location(thread, MAP__FUNCTION, ip, &al);
 
        ams->addr = ip;
        ams->al_addr = al.addr;
        ams->map = al.map;
 }
 
-static void ip__resolve_data(struct machine *machine, struct thread *thread,
+static void ip__resolve_data(struct thread *thread,
                             u8 m, struct addr_map_symbol *ams, u64 addr)
 {
        struct addr_location al;
 
        memset(&al, 0, sizeof(al));
 
-       thread__find_addr_location(thread, machine, m, MAP__VARIABLE, addr,
-                                  &al);
+       thread__find_addr_location(thread, m, MAP__VARIABLE, addr, &al);
        if (al.map == NULL) {
                /*
                 * some shared data regions have execute bit set which puts
                 * their mapping in the MAP__FUNCTION type array.
                 * Check there as a fallback option before dropping the sample.
                 */
-               thread__find_addr_location(thread, machine, m, MAP__FUNCTION, addr,
-                                          &al);
+               thread__find_addr_location(thread, m, MAP__FUNCTION, addr, &al);
        }
 
        ams->addr = addr;
        if (!mi)
                return NULL;
 
-       ip__resolve_ams(al->machine, al->thread, &mi->iaddr, sample->ip);
-       ip__resolve_data(al->machine, al->thread, al->cpumode,
-                        &mi->daddr, sample->addr);
+       ip__resolve_ams(al->thread, &mi->iaddr, sample->ip);
+       ip__resolve_data(al->thread, al->cpumode, &mi->daddr, sample->addr);
        mi->data_src.val = sample->data_src;
 
        return mi;
                return NULL;
 
        for (i = 0; i < bs->nr; i++) {
-               ip__resolve_ams(al->machine, al->thread, &bi[i].to, bs->entries[i].to);
-               ip__resolve_ams(al->machine, al->thread, &bi[i].from, bs->entries[i].from);
+               ip__resolve_ams(al->thread, &bi[i].to, bs->entries[i].to);
+               ip__resolve_ams(al->thread, &bi[i].from, bs->entries[i].from);
                bi[i].flags = bs->entries[i].flags;
        }
        return bi;
 }
 
-static int machine__resolve_callchain_sample(struct machine *machine,
-                                            struct thread *thread,
+static int thread__resolve_callchain_sample(struct thread *thread,
                                             struct ip_callchain *chain,
                                             struct symbol **parent,
                                             struct addr_location *root_al,
         * Based on DWARF debug information, some architectures skip
         * a callchain entry saved by the kernel.
         */
-       skip_idx = arch_skip_callchain_idx(machine, thread, chain);
+       skip_idx = arch_skip_callchain_idx(thread, chain);
 
        for (i = 0; i < chain_nr; i++) {
                u64 ip;
                }
 
                al.filtered = 0;
-               thread__find_addr_location(thread, machine, cpumode,
+               thread__find_addr_location(thread, cpumode,
                                           MAP__FUNCTION, ip, &al);
                if (al.sym != NULL) {
                        if (sort__has_parent && !*parent &&
                               struct addr_location *root_al,
                               int max_stack)
 {
-       int ret;
-
-       ret = machine__resolve_callchain_sample(machine, thread,
-                                               sample->callchain, parent,
-                                               root_al, max_stack);
+       int ret = thread__resolve_callchain_sample(thread, sample->callchain,
+                                                  parent, root_al, max_stack);
        if (ret)
                return ret;
 
 
 }
 
 void thread__find_cpumode_addr_location(struct thread *thread,
-                                       struct machine *machine,
                                        enum map_type type, u64 addr,
                                        struct addr_location *al)
 {
        };
 
        for (i = 0; i < ARRAY_SIZE(cpumodes); i++) {
-               thread__find_addr_location(thread, machine, cpumodes[i], type,
-                                          addr, al);
+               thread__find_addr_location(thread, cpumodes[i], type, addr, al);
                if (al->map)
                        break;
        }
 
 int thread__fork(struct thread *thread, struct thread *parent, u64 timestamp);
 size_t thread__fprintf(struct thread *thread, FILE *fp);
 
-void thread__find_addr_map(struct thread *thread, struct machine *machine,
+void thread__find_addr_map(struct thread *thread,
                           u8 cpumode, enum map_type type, u64 addr,
                           struct addr_location *al);
 
-void thread__find_addr_location(struct thread *thread, struct machine *machine,
+void thread__find_addr_location(struct thread *thread,
                                u8 cpumode, enum map_type type, u64 addr,
                                struct addr_location *al);
 
 void thread__find_cpumode_addr_location(struct thread *thread,
-                                       struct machine *machine,
                                        enum map_type type, u64 addr,
                                        struct addr_location *al);
 
 
        Dwfl_Module *mod;
        struct dso *dso = NULL;
 
-       thread__find_addr_location(ui->thread, ui->machine,
+       thread__find_addr_location(ui->thread,
                                   PERF_RECORD_MISC_USER,
                                   MAP__FUNCTION, ip, al);
 
        struct addr_location al;
        ssize_t size;
 
-       thread__find_addr_map(ui->thread, ui->machine, PERF_RECORD_MISC_USER,
+       thread__find_addr_map(ui->thread, PERF_RECORD_MISC_USER,
                              MAP__FUNCTION, addr, &al);
        if (!al.map) {
                pr_debug("unwind: no map for %lx\n", (unsigned long)addr);
 
 {
        struct addr_location al;
 
-       thread__find_addr_map(ui->thread, ui->machine, PERF_RECORD_MISC_USER,
+       thread__find_addr_map(ui->thread, PERF_RECORD_MISC_USER,
                              MAP__FUNCTION, ip, &al);
        return al.map;
 }
        struct addr_location al;
        ssize_t size;
 
-       thread__find_addr_map(ui->thread, ui->machine, PERF_RECORD_MISC_USER,
+       thread__find_addr_map(ui->thread, PERF_RECORD_MISC_USER,
                              MAP__FUNCTION, addr, &al);
        if (!al.map) {
                pr_debug("unwind: no map for %lx\n", (unsigned long)addr);
        pr_debug("unwind: put_unwind_info called\n");
 }
 
-static int entry(u64 ip, struct thread *thread, struct machine *machine,
+static int entry(u64 ip, struct thread *thread,
                 unwind_entry_cb_t cb, void *arg)
 {
        struct unwind_entry e;
        struct addr_location al;
 
-       thread__find_addr_location(thread, machine,
-                                  PERF_RECORD_MISC_USER,
+       thread__find_addr_location(thread, PERF_RECORD_MISC_USER,
                                   MAP__FUNCTION, ip, &al);
 
        e.ip = ip;
                unw_word_t ip;
 
                unw_get_reg(&c, UNW_REG_IP, &ip);
-               ret = ip ? entry(ip, ui->thread, ui->machine, cb, arg) : 0;
+               ret = ip ? entry(ip, ui->thread, cb, arg) : 0;
        }
 
        return ret;
        if (ret)
                return ret;
 
-       ret = entry(ip, thread, machine, cb, arg);
+       ret = entry(ip, thread, cb, arg);
        if (ret)
                return -ENOMEM;