mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@redhat.com>
To: Steven Noonan <steven@uplinklabs.net>
Cc: Linux Kernel mailing List <linux-kernel@vger.kernel.org>,
	Adrian Hunter <adrian.hunter@intel.com>,
	acme@kernel.org
Subject: Re: perf object code reading test crashes
Date: Wed, 17 Feb 2016 12:27:26 -0200	[thread overview]
Message-ID: <20160217142726.GA11190@redhat.com> (raw)
In-Reply-To: <CAKbGBLjC2Dx5vshxyGmQkcD+VwiAQLbHoXA9i7kvRB2-2opHZQ@mail.gmail.com>

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	other threads:[~2016-02-17 13:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-17  6:42 Steven Noonan
2016-02-17 14:27 ` Arnaldo Carvalho de Melo [this message]
2016-02-18  1:13   ` Steven Noonan
2016-02-18 14:27     ` Arnaldo Carvalho de Melo
2016-02-18 14:36       ` Arnaldo Carvalho de Melo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160217142726.GA11190@redhat.com \
    --to=acme@redhat.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=steven@uplinklabs.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®