linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Ahern <dsahern@gmail.com>
To: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: linux-kernel@vger.kernel.org, mingo@elte.hu,
	peterz@infradead.org, fweisbec@gmail.com
Subject: Re: [PATCH] perf top: fix crash on annotate request
Date: Wed, 19 Oct 2011 14:21:06 -0600	[thread overview]
Message-ID: <4E9F3132.8020106@gmail.com> (raw)
In-Reply-To: <20111019192011.GG2229@ghostprotocols.net>



On 10/19/2011 01:20 PM, Arnaldo Carvalho de Melo wrote:
> Em Wed, Oct 19, 2011 at 12:44:48PM -0600, David Ahern escreveu:
>> On 10/19/2011 12:38 PM, Arnaldo Carvalho de Melo wrote:
>>> Em Wed, Oct 19, 2011 at 12:23:18PM -0600, David Ahern escreveu:
>>>> Hitting an annotate case where src is not set and
>>>> perf-top crashes.
> 
>>> How did you got there? 
>>
>> I was starting perf top, selecting a symbol and pressing 'a'. In the
>> crash case it was the perf command itself.
> 
> Humm, looks like a race, the old 'perf top --tui' had this:
> 
> static void perf_top_browser__annotate(struct perf_top_browser *browser)
> {
>         struct sym_entry *syme = browser->selection;
>         struct symbol *sym = sym_entry__symbol(syme);
>         struct annotation *notes = symbol__annotation(sym);
>         struct perf_top *top = browser->b.priv;
> 
>         if (notes->src != NULL)
>                 goto do_annotation;
> 
>         pthread_mutex_lock(&notes->lock);
> 
>         top->sym_filter_entry = NULL;
> 
>         if (symbol__alloc_hist(sym, top->evlist->nr_entries) < 0) {
>                 pr_err("Not enough memory for annotating '%s' symbol!\n",
>                        sym->name);
>                 pthread_mutex_unlock(&notes->lock);
>                 return;
>         }
> 
>         top->sym_filter_entry = syme;
> 
>         pthread_mutex_unlock(&notes->lock);
> do_annotation:
>         symbol__tui_annotate(sym, syme->map, 0, top->delay_secs * 1000);
> }
> 
> 
> Which is not even completely right, the notes->src should happen inside
> the lock, like parse_source in the --stdio...
> 
> Can you check if that is the problem? I.e. take notes->lock, check if
> ->src is NULL, if so call symbol__alloc_hist, etc?

Well, I rebooted my laptop during lunch and cannot repeat the crash. I
had installed prelink yesterday to get it to do its thing which it had
-- almost every process (gnome, daemons, terminals, shells, etc) had
deleted dso's.

Today (just a suspend overnight) I started looking at the perf-top code.
I noticed that the annotate key was doing nothing - except on the perf
command itself where it crashed.

After rebooting - which cleared all the prelink deletions - it works
fine. Re-running prelink (force mode) gets the prelink deletions, but
annotate in perf-top works fine. If it happens again I'll try your
suggestion.

David

> 
> - Arnaldo

  reply	other threads:[~2011-10-19 20:21 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-19 18:23 [PATCH] perf top: fix crash on annotate request David Ahern
2011-10-19 18:38 ` Arnaldo Carvalho de Melo
2011-10-19 18:44   ` David Ahern
2011-10-19 19:20     ` Arnaldo Carvalho de Melo
2011-10-19 20:21       ` David Ahern [this message]
2011-10-19 21:39       ` David Ahern
2011-10-20 12:51         ` Arnaldo Carvalho de Melo
2011-10-19 22:12       ` David Ahern
2011-10-20 13:00         ` Arnaldo Carvalho de Melo
2011-10-20 14:15           ` David Ahern
2011-11-10 22:01           ` Brian Marete
2011-11-13 13:43             ` Arnaldo Carvalho de Melo
2011-11-13 21:03               ` Brian Marete
2011-11-13 21:42                 ` Brian Marete
2011-11-30 13:23             ` Brian Marete
2011-11-30 18:10               ` Arnaldo Carvalho de Melo
2011-12-01 13:17                 ` Brian Marete
2011-12-01 14:11                   ` Arnaldo Carvalho de Melo
2011-12-06  7:22                     ` Brian Gitonga Marete
2011-12-06 13:44                       ` Arnaldo Carvalho de Melo
2011-12-15 21:01                         ` Brian Gitonga Marete
2011-12-15 22:04                           ` Brian Gitonga Marete
2011-12-16 23:46                             ` Arnaldo Carvalho de Melo
  -- strict thread matches above, loose matches on Subject: below --
2011-10-20 20:39 David Ahern
2011-10-20 21:30 ` Arnaldo Carvalho de Melo
2011-10-20 23:26 ` 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=4E9F3132.8020106@gmail.com \
    --to=dsahern@gmail.com \
    --cc=acme@ghostprotocols.net \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    /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;
as well as URLs for NNTP newsgroup(s).