Em Tue, Feb 16, 2016 at 10:42:19PM -0800, Steven Noonan escreveu:
> I oddly didn't run into this issue on every machine I tried, but
> there's some issues here:
> 
> $ sudo perf test 21
> 21: Test object code reading                                 :***
> Error in `perf': corrupted double-linked list: 0x00000000023ffcd0 ***

>  FAILED!
> 
> Valgrind seems to suggest that the cpu map is getting freed too early:
> 
> ==11450==  Address 0x875b8a0 is 0 bytes inside a block of size 136 free'd
> ==11450==    at 0x4C29D2A: free (in
> /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
> ==11450==    by 0x4CBD49: cpu_map__delete (cpumap.c:228)
> ==11450==    by 0x4CC690: cpu_map__put (cpumap.c:242)
> ==11450==    by 0x484DE3: __perf_evlist__propagate_maps (evlist.c:136)
 
 
> I tried this, and the problem goes away:

 
> +++ b/tools/perf/tests/code-reading.c
> @@ -514,6 +514,7 @@ static int do_test_code_reading(bool try_kcore)
>         }
> +       cpu_map__get(cpus);
> 
>         while (1) {

Yeah, we forgot to grab refcounts in perf_evlist__set_maps(), can you
try this instead, if it works please let me know so that I can add a:

Reported-and-Tested-by: you to this patch,

Thanks for the nice report!

- Arnaldo

diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index d81f13de2476..a7eb0eae9938 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -1181,12 +1181,12 @@ void perf_evlist__set_maps(struct perf_evlist *evlist, 
struct cpu_map *cpus,
         */
        if (cpus != evlist->cpus) {
                cpu_map__put(evlist->cpus);
-               evlist->cpus = cpus;
+               evlist->cpus = cpu_map__get(cpus);
        }
 
        if (threads != evlist->threads) {
                thread_map__put(evlist->threads);
-               evlist->threads = threads;
+               evlist->threads = thread_map__get(threads);
        }
 
        perf_evlist__propagate_maps(evlist);

Reply via email to