public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Arun Sharma <asharma@fb.com>
To: Stephane Eranian <eranian@google.com>
Cc: <linux-kernel@vger.kernel.org>, <peterz@infradead.org>,
	<acme@redhat.com>, <ravitillo@lbl.gov>, <vweaver1@eecs.utk.edu>,
	<khandual@linux.vnet.ibm.com>, <dsahern@gmail.com>,
	Ingo Molnar <mingo@elte.hu>, Namhyung Kim <namhyung.kim@lge.com>
Subject: Re: [PATCH] perf: Add branch stack support to perf script
Date: Thu, 15 Mar 2012 18:28:05 -0700	[thread overview]
Message-ID: <4F629725.30306@fb.com> (raw)
In-Reply-To: <1331842127-27468-1-git-send-email-asharma@fb.com>

On 3/15/12 1:08 PM, Arun Sharma wrote:

> The samples seem to have the sense of call/return
> inverted. If the original callgraph was a ->  b ->  c
> I get samples like:
>
> from	to
> c	b
> b	a
>
> To restore the normal sense, I'm printing them as:
>
> to =>  from

I debugged this some more and something seems to be wrong with the the 
way the kernel maps PERF_SAMPLE_BRANCH_ANY_CALL to MSR_LBR_SELECT.

perf record -aj any_call,u -F 1 --   sleep 300 &

msr[0x1c8] = 0x1d

perf record -aj any_ret,u -F 1 --   sleep 300 &

msr[0x1c8] = 0x1ad

Stephane: does this give a clue about what may be wrong? It doesn't 
match the kernel code:

static const int nhm_lbr_sel_map[PERF_SAMPLE_BRANCH_MAX] = {
...
[PERF_SAMPLE_BRANCH_ANY_CALL] =
          LBR_REL_CALL | LBR_IND_CALL | LBR_REL_JMP | LBR_IND_JMP | LBR_FAR,
};

It'd be nice to have *_lbr_sel_map[] in the same order as
enum perf_branch_sample_type. Right now, the call and return entries are 
reversed. Which shouldn't matter in theory, since the initializer has an 
explicit index.

I also got a kernel hang running the two perf record lines above 
simultaneously (without the -F 1).

  -Arun

      reply	other threads:[~2012-03-16  1:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-15 20:08 [PATCH] perf: Add branch stack support to perf script Arun Sharma
2012-03-16  1:28 ` Arun Sharma [this message]

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=4F629725.30306@fb.com \
    --to=asharma@fb.com \
    --cc=acme@redhat.com \
    --cc=dsahern@gmail.com \
    --cc=eranian@google.com \
    --cc=khandual@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=namhyung.kim@lge.com \
    --cc=peterz@infradead.org \
    --cc=ravitillo@lbl.gov \
    --cc=vweaver1@eecs.utk.edu \
    /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