Re: [PATCH] perf: Add branch stack support to perf script

From: Arun Sharma
Date: Thu Mar 15 2012 - 21:28:31 EST


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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/