[PATCH] tools/perf: Fix the mask in regs_dump__printf
Jiri Olsa
jolsa at redhat.com
Fri Jun 17 21:24:01 AEST 2016
On Fri, Jun 17, 2016 at 02:43:31PM +0530, Madhavan Srinivasan wrote:
SNIP
>
>
> if (data->user_regs.abi) {
> - u64 mask = evsel->attr.sample_regs_user;
> + u.val64 = evsel->attr.sample_regs_user;
>
> - sz = hweight_long(mask) * sizeof(u64);
> + if (sizeof(u64) > sizeof(unsigned long)) {
> + u64 mask = u.val64;
> + u.val32[1] = mask >> 32;
> + u.val32[0] = mask & ULONG_MAX;
> + }
> +
> + sz = hweight_long(u.val64) * sizeof(u64);
> OVERFLOW_CHECK(array, sz, max_size);
> - data->user_regs.mask = mask;
> + data->user_regs.mask = u.val64;
> data->user_regs.regs = (u64 *)array;
>
> Issue I see is when printing the mask value in a 32bit perf
> on a 64bit kernel (big endian).
>
> 442044948492 0xdc0 [0x188]: PERF_RECORD_SAMPLE(IP, 0x1): 7299/7299:
> 0xc000000000059200 period: 12599 addr: 0
> ... intr regs: mask 0xffffffff000007ff ABI 32-bit
> ^^^ shld have been 0x7ffffffffff
>
> I agree it is better to fix this when reading, but
> we need to swap again when printing?
hum, sample data should be swap at this point already..
see perf_session__process_event
jirka
More information about the Linuxppc-dev
mailing list