perf thread: Rename thread->mg to thread->maps
authorArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 26 Nov 2019 01:07:43 +0000 (22:07 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 26 Nov 2019 14:07:46 +0000 (11:07 -0300)
One more step on the merge of 'struct maps' with 'struct map_groups'.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://lkml.kernel.org/n/tip-69vcr8pubpym90skxhmbwhiw@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
19 files changed:
tools/perf/arch/arm/tests/dwarf-unwind.c
tools/perf/arch/arm64/tests/dwarf-unwind.c
tools/perf/arch/powerpc/tests/dwarf-unwind.c
tools/perf/arch/x86/tests/dwarf-unwind.c
tools/perf/builtin-report.c
tools/perf/tests/code-reading.c
tools/perf/tests/thread-mg-share.c
tools/perf/ui/stdio/hist.c
tools/perf/util/db-export.c
tools/perf/util/event.c
tools/perf/util/machine.c
tools/perf/util/map.c
tools/perf/util/thread-stack.c
tools/perf/util/thread.c
tools/perf/util/thread.h
tools/perf/util/unwind-libdw.c
tools/perf/util/unwind-libunwind-local.c
tools/perf/util/unwind-libunwind.c
tools/perf/util/vdso.c

index 026737243766d381b94e0df54886cb0c7afebb76..ff0bea660cf985569a56f0f6ecc30a24e8a73ad3 100644 (file)
@@ -26,7 +26,7 @@ static int sample_ustack(struct perf_sample *sample,
 
        sp = (unsigned long) regs[PERF_REG_ARM_SP];
 
-       map = maps__find(thread->mg, (u64)sp);
+       map = maps__find(thread->maps, (u64)sp);
        if (!map) {
                pr_debug("failed to get stack map\n");
                free(buf);
index 886489632d17535e4079e53ef7f859401ffe4c36..85108437b3af0a9a64d61bfd0e3d7238d9dead58 100644 (file)
@@ -26,7 +26,7 @@ static int sample_ustack(struct perf_sample *sample,
 
        sp = (unsigned long) regs[PERF_REG_ARM64_SP];
 
-       map = maps__find(thread->mg, (u64)sp);
+       map = maps__find(thread->maps, (u64)sp);
        if (!map) {
                pr_debug("failed to get stack map\n");
                free(buf);
index b38117c50040c700c7b13bbd5181b48a4aba0b81..30658e3b32b286bcbcf65eb1fab2cda58ea1035f 100644 (file)
@@ -27,7 +27,7 @@ static int sample_ustack(struct perf_sample *sample,
 
        sp = (unsigned long) regs[PERF_REG_POWERPC_R1];
 
-       map = maps__find(thread->mg, (u64)sp);
+       map = maps__find(thread->maps, (u64)sp);
        if (!map) {
                pr_debug("failed to get stack map\n");
                free(buf);
index f52132ed7a8c044065dccd0c26ef517390696550..418969cd64e9e344774e644f778a707beaefb503 100644 (file)
@@ -27,7 +27,7 @@ static int sample_ustack(struct perf_sample *sample,
 
        sp = (unsigned long) regs[PERF_REG_X86_SP];
 
-       map = maps__find(thread->mg, (u64)sp);
+       map = maps__find(thread->maps, (u64)sp);
        if (!map) {
                pr_debug("failed to get stack map\n");
                free(buf);
index 729d68427cf7069bd63f0d0b9320ffd505987c5f..830d563de8898f92559af9dd5bcf5803f948cefa 100644 (file)
@@ -790,7 +790,7 @@ static void task__print_level(struct task *task, FILE *fp, int level)
 
        fprintf(fp, "%s\n", thread__comm_str(thread));
 
-       maps__fprintf_task(thread->mg, comm_indent, fp);
+       maps__fprintf_task(thread->maps, comm_indent, fp);
 
        if (!list_empty(&task->children)) {
                list_for_each_entry(child, &task->children, list)
index 1f017e1b2a55ed73ad667bfcf08742e549cf7452..6fe221d31f07e13562a176c5bb5b11caf7421a89 100644 (file)
@@ -276,7 +276,7 @@ static int read_object_code(u64 addr, size_t len, u8 cpumode,
                len = al.map->end - addr;
 
        /* Read the object code using perf */
-       ret_len = dso__data_read_offset(al.map->dso, thread->mg->machine,
+       ret_len = dso__data_read_offset(al.map->dso, thread->maps->machine,
                                        al.addr, buf1, len);
        if (ret_len != len) {
                pr_debug("dso__data_read_offset failed\n");
index 7f15eedabbf68ab1e62b3df2fbc638a847c0f60b..6032061958d267bfd0c0367e0753e47498c4c139 100644 (file)
@@ -42,13 +42,13 @@ int test__thread_mg_share(struct test *test __maybe_unused, int subtest __maybe_
        TEST_ASSERT_VAL("failed to create threads",
                        leader && t1 && t2 && t3 && other);
 
-       mg = leader->mg;
+       mg = leader->maps;
        TEST_ASSERT_EQUAL("wrong refcnt", refcount_read(&mg->refcnt), 4);
 
        /* test the map groups pointer is shared */
-       TEST_ASSERT_VAL("map groups don't match", mg == t1->mg);
-       TEST_ASSERT_VAL("map groups don't match", mg == t2->mg);
-       TEST_ASSERT_VAL("map groups don't match", mg == t3->mg);
+       TEST_ASSERT_VAL("map groups don't match", mg == t1->maps);
+       TEST_ASSERT_VAL("map groups don't match", mg == t2->maps);
+       TEST_ASSERT_VAL("map groups don't match", mg == t3->maps);
 
        /*
         * Verify the other leader was created by previous call.
@@ -70,10 +70,10 @@ int test__thread_mg_share(struct test *test __maybe_unused, int subtest __maybe_
        machine__remove_thread(machine, other);
        machine__remove_thread(machine, other_leader);
 
-       other_mg = other->mg;
+       other_mg = other->maps;
        TEST_ASSERT_EQUAL("wrong refcnt", refcount_read(&other_mg->refcnt), 2);
 
-       TEST_ASSERT_VAL("map groups don't match", other_mg == other_leader->mg);
+       TEST_ASSERT_VAL("map groups don't match", other_mg == other_leader->maps);
 
        /* release thread group */
        thread__put(leader);
index 2d9c4843fd62e7e6bab786c62f5586eb4e0310c4..161d8342ce05756ea43db8ccb064d74bb33d1dd2 100644 (file)
@@ -885,7 +885,7 @@ size_t hists__fprintf(struct hists *hists, bool show_header, int max_rows,
                }
 
                if (h->ms.map == NULL && verbose > 1) {
-                       maps__fprintf(h->thread->mg, fp);
+                       maps__fprintf(h->thread->maps, fp);
                        fprintf(fp, "%.10s end\n", graph_dotted_line);
                }
        }
index d029faf9fc9f139702766d2278abc9515ae71b18..e726922eb663ef57101e288af7905c3132eac31e 100644 (file)
@@ -251,7 +251,7 @@ static struct call_path *call_path_from_sample(struct db_export *dbe,
                 */
                al.sym = node->ms.sym;
                al.map = node->ms.map;
-               al.mg  = thread->mg;
+               al.mg  = thread->maps;
                al.addr = node->ip;
 
                if (al.map && !al.sym)
index 0181790dd0c03b2a8b08ecfe92f7f9c312de893a..2f0b77366cc0f6ce7177bdff91aa3b19a6a16409 100644 (file)
@@ -457,7 +457,7 @@ int perf_event__process(struct perf_tool *tool __maybe_unused,
 struct map *thread__find_map(struct thread *thread, u8 cpumode, u64 addr,
                             struct addr_location *al)
 {
-       struct maps *mg = thread->mg;
+       struct maps *mg = thread->maps;
        struct machine *machine = mg->machine;
        bool load_map = false;
 
@@ -523,7 +523,7 @@ struct map *thread__find_map_fb(struct thread *thread, u8 cpumode, u64 addr,
                                struct addr_location *al)
 {
        struct map *map = thread__find_map(thread, cpumode, addr, al);
-       struct machine *machine = thread->mg->machine;
+       struct machine *machine = thread->maps->machine;
        u8 addr_cpumode = machine__addr_cpumode(machine, cpumode, addr);
 
        if (map || addr_cpumode == cpumode)
index d646aea39333553e8d26008aa7663cb87b005709..b351476407e63906517b44c8691d5049ccfe7009 100644 (file)
@@ -412,28 +412,28 @@ static void machine__update_thread_pid(struct machine *machine,
        if (!leader)
                goto out_err;
 
-       if (!leader->mg)
-               leader->mg = maps__new(machine);
+       if (!leader->maps)
+               leader->maps = maps__new(machine);
 
-       if (!leader->mg)
+       if (!leader->maps)
                goto out_err;
 
-       if (th->mg == leader->mg)
+       if (th->maps == leader->maps)
                return;
 
-       if (th->mg) {
+       if (th->maps) {
                /*
                 * Maps are created from MMAP events which provide the pid and
                 * tid.  Consequently there never should be any maps on a thread
                 * with an unknown pid.  Just print an error if there are.
                 */
-               if (!maps__empty(th->mg))
+               if (!maps__empty(th->maps))
                        pr_err("Discarding thread maps for %d:%d\n",
                               th->pid_, th->tid);
-               maps__put(th->mg);
+               maps__put(th->maps);
        }
 
-       th->mg = maps__get(leader->mg);
+       th->maps = maps__get(leader->maps);
 out_put:
        thread__put(leader);
        return;
index 4c9fd064028fbbaf5012f7af6cbdd943a123597c..39bfed48b7f541b1ba3ae734cb0e4e96c043f4cb 100644 (file)
@@ -819,7 +819,7 @@ out:
  */
 int maps__clone(struct thread *thread, struct maps *parent)
 {
-       struct maps *mg = thread->mg;
+       struct maps *mg = thread->maps;
        int err = -ENOMEM;
        struct map *map;
 
index cd8a948d03ec9e6ba9b64faf790691de158f1789..0885967d5bc38077acf6a69cd66718657ca3fed9 100644 (file)
@@ -134,8 +134,8 @@ static int thread_stack__init(struct thread_stack *ts, struct thread *thread,
        if (err)
                return err;
 
-       if (thread->mg && thread->mg->machine) {
-               struct machine *machine = thread->mg->machine;
+       if (thread->maps && thread->maps->machine) {
+               struct machine *machine = thread->maps->machine;
                const char *arch = perf_env__arch(machine->env);
 
                ts->kernel_start = machine__kernel_start(machine);
index b672a2a73b6b072634ea909f792ee243002e1996..28b719388028bce9f9384b9c95c9cff51193c800 100644 (file)
@@ -24,16 +24,16 @@ int thread__init_maps(struct thread *thread, struct machine *machine)
        pid_t pid = thread->pid_;
 
        if (pid == thread->tid || pid == -1) {
-               thread->mg = maps__new(machine);
+               thread->maps = maps__new(machine);
        } else {
                struct thread *leader = __machine__findnew_thread(machine, pid, pid);
                if (leader) {
-                       thread->mg = maps__get(leader->mg);
+                       thread->maps = maps__get(leader->maps);
                        thread__put(leader);
                }
        }
 
-       return thread->mg ? 0 : -1;
+       return thread->maps ? 0 : -1;
 }
 
 struct thread *thread__new(pid_t pid, pid_t tid)
@@ -86,9 +86,9 @@ void thread__delete(struct thread *thread)
 
        thread_stack__free(thread);
 
-       if (thread->mg) {
-               maps__put(thread->mg);
-               thread->mg = NULL;
+       if (thread->maps) {
+               maps__put(thread->maps);
+               thread->maps = NULL;
        }
        down_write(&thread->namespaces_lock);
        list_for_each_entry_safe(namespaces, tmp_namespaces,
@@ -251,7 +251,7 @@ static int ____thread__set_comm(struct thread *thread, const char *str,
                list_add(&new->list, &thread->comm_list);
 
                if (exec)
-                       unwind__flush_access(thread->mg);
+                       unwind__flush_access(thread->maps);
        }
 
        thread->comm_set = true;
@@ -324,19 +324,19 @@ int thread__comm_len(struct thread *thread)
 size_t thread__fprintf(struct thread *thread, FILE *fp)
 {
        return fprintf(fp, "Thread %d %s\n", thread->tid, thread__comm_str(thread)) +
-              maps__fprintf(thread->mg, fp);
+              maps__fprintf(thread->maps, fp);
 }
 
 int thread__insert_map(struct thread *thread, struct map *map)
 {
        int ret;
 
-       ret = unwind__prepare_access(thread->mg, map, NULL);
+       ret = unwind__prepare_access(thread->maps, map, NULL);
        if (ret)
                return ret;
 
-       maps__fixup_overlappings(thread->mg, map, stderr);
-       maps__insert(thread->mg, map);
+       maps__fixup_overlappings(thread->maps, map, stderr);
+       maps__insert(thread->maps, map);
 
        return 0;
 }
@@ -345,13 +345,13 @@ static int __thread__prepare_access(struct thread *thread)
 {
        bool initialized = false;
        int err = 0;
-       struct maps *maps = thread->mg;
+       struct maps *maps = thread->maps;
        struct map *map;
 
        down_read(&maps->lock);
 
        maps__for_each_entry(maps, map) {
-               err = unwind__prepare_access(thread->mg, map, &initialized);
+               err = unwind__prepare_access(thread->maps, map, &initialized);
                if (err || initialized)
                        break;
        }
@@ -377,13 +377,13 @@ static int thread__clone_maps(struct thread *thread, struct thread *parent, bool
        if (thread->pid_ == parent->pid_)
                return thread__prepare_access(thread);
 
-       if (thread->mg == parent->mg) {
+       if (thread->maps == parent->maps) {
                pr_debug("broken map groups on thread %d/%d parent %d/%d\n",
                         thread->pid_, thread->tid, parent->pid_, parent->tid);
                return 0;
        }
        /* But this one is new process, copy maps. */
-       return do_maps_clone ? maps__clone(thread, parent->mg) : 0;
+       return do_maps_clone ? maps__clone(thread, parent->maps) : 0;
 }
 
 int thread__fork(struct thread *thread, struct thread *parent, u64 timestamp, bool do_maps_clone)
index 4735d920dfb1db1fe518435d74fcf8232ed36c5d..20b96b5d1f1593117225ec93c376596377e38e17 100644 (file)
@@ -25,7 +25,7 @@ struct thread {
                struct rb_node   rb_node;
                struct list_head node;
        };
-       struct maps             *mg;
+       struct maps             *maps;
        pid_t                   pid_; /* Not all tools update this */
        pid_t                   tid;
        pid_t                   ppid;
index d2a8df01c4a7988a0d07a9d343bf5758554bfbdd..33f655207c6236322004e60bba3d0e7d4f045a6f 100644 (file)
@@ -200,7 +200,7 @@ int unwind__get_entries(unwind_entry_cb_t cb, void *arg,
        struct unwind_info *ui, ui_buf = {
                .sample         = data,
                .thread         = thread,
-               .machine        = thread->mg->machine,
+               .machine        = thread->maps->machine,
                .cb             = cb,
                .arg            = arg,
                .max_stack      = max_stack,
index 31f77f8d515b0d9d598645b6399dfe8f98c3e8fc..30f921f634876e4859b0c14df6f1fd6cfd4e5a1c 100644 (file)
@@ -660,7 +660,7 @@ static int get_entries(struct unwind_info *ui, unwind_entry_cb_t cb,
         */
        if (max_stack - 1 > 0) {
                WARN_ONCE(!ui->thread, "WARNING: ui->thread is NULL");
-               addr_space = ui->thread->mg->addr_space;
+               addr_space = ui->thread->maps->addr_space;
 
                if (addr_space == NULL)
                        return -1;
@@ -709,7 +709,7 @@ static int _unwind__get_entries(unwind_entry_cb_t cb, void *arg,
        struct unwind_info ui = {
                .sample       = data,
                .thread       = thread,
-               .machine      = thread->mg->machine,
+               .machine      = thread->maps->machine,
        };
 
        if (!data->user_regs.regs)
index 3769ae93ca5a5ed9f648adc5e1410f1bfd0c0f14..4003ae80edba73df94da1e437012683c9b6f7313 100644 (file)
@@ -82,7 +82,7 @@ int unwind__get_entries(unwind_entry_cb_t cb, void *arg,
                         struct thread *thread,
                         struct perf_sample *data, int max_stack)
 {
-       if (thread->mg->unwind_libunwind_ops)
-               return thread->mg->unwind_libunwind_ops->get_entries(cb, arg, thread, data, max_stack);
+       if (thread->maps->unwind_libunwind_ops)
+               return thread->maps->unwind_libunwind_ops->get_entries(cb, arg, thread, data, max_stack);
        return 0;
 }
index 765b29acbf7c041192b8e7d38bef809b1feb4a60..3cc91ad048ea87a9b954711ffb2e901e754253c4 100644 (file)
@@ -144,7 +144,7 @@ static enum dso_type machine__thread_dso_type(struct machine *machine,
        enum dso_type dso_type = DSO__TYPE_UNKNOWN;
        struct map *map;
 
-       maps__for_each_entry(thread->mg, map) {
+       maps__for_each_entry(thread->maps, map) {
                struct dso *dso = map->dso;
                if (!dso || dso->long_name[0] != '/')
                        continue;