All of lore.kernel.org
 help / color / mirror / Atom feed
From: Milian Wolff <milian.wolff@kdab.com>
To: linux-perf-users@vger.kernel.org
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Subject: Re: perf inject --sched-stat can produce invalid perf.data files
Date: Tue, 30 Aug 2016 23:26:53 +0200	[thread overview]
Message-ID: <1996346.OFykjbkAe6@agathebauer> (raw)
In-Reply-To: <1705181.9Ekn7j0XTY@agathebauer>

[-- Attachment #1: Type: text/plain, Size: 2399 bytes --]

On Dienstag, 16. August 2016 17:56:10 CEST Milian Wolff wrote:
> Hey all,

ping?

> I've hit another issue that I have trouble understanding and fixing:
> 
> ~~~~~~~~~~~~
> echo 1 | sudo tee /proc/sys/kernel/sched_schedstats
> 
> perf record \
>     --event sched:sched_stat_sleep/call-graph=no/ \
>     --event sched:sched_switch/call-graph=fp/ \
>     --output perf.data.raw \
>     sleep 1
> 
> echo 0 | sudo tee /proc/sys/kernel/sched_schedstats
> 
> perf inject --sched-stat --input perf.data.raw --output perf.data
> perf script # or perf report
> 0x4e18 [0xd8]: failed to process type: 9
> ~~~~~~~~~~~~
> 
> This happens only for the perf.data produced by perf-inject when at least
> one of the sched events has no call graph.
> 
> Looking at the code, I see that the issue is triggered in evsel.c:
> 
> ~~~~~~~~~~~~
> 	if (type & PERF_SAMPLE_CALLCHAIN) {
> 		const u64 max_callchain_nr = UINT64_MAX / sizeof(u64);
> 
> 		OVERFLOW_CHECK_u64(array);
> 		data->callchain = (struct ip_callchain *)array++;
> 		if (data->callchain->nr > max_callchain_nr)
> 			return -EFAULT;
> 		sz = data->callchain->nr * sizeof(u64);
> 		OVERFLOW_CHECK(array, sz, max_size);
> 		array = (void *)array + sz;
> 	}
> ~~~~~~~~~~~~
> 
> In GDB:
> 
> ~~~~~~~~~~~~
> (gdb) break evsel.c:1859
> Breakpoint 1 at 0x5555556704d9: file util/evsel.c, line 1859.
> (gdb) run
> Starting program: /home/milian/.bin/perf script
> [Thread debugging using libthread_db enabled]
> Using host libthread_db library "/usr/lib/libthread_db.so.1".
> 
> Breakpoint 1, perf_evsel__parse_sample (evsel=0x5555571c1d50,
> event=0x7ffff7ff4e18, data=0x7fffffffb3e0) at util/evsel.c:1861
> 1861                    data->callchain = (struct ip_callchain *)array++;
> (gdb) next
> 1862                    if (data->callchain->nr > max_callchain_nr)
> (gdb) print *data->callchain
> $1 = {nr = 61654255534090, ips = 0x7ffff7ff4e58}
> (gdb) next
> 1864                    sz = data->callchain->nr * sizeof(u64);
> (gdb)
> 1865                    OVERFLOW_CHECK(array, sz, max_size);
> (gdb) print sz
> $2 = 493234044272720
> (gdb) next
> 1934                                    return -EFAULT;
> ~~~~~~~~~~~~
> 
> Can someone please look into this issue and find a way to fix perf-inject?

-- 
Milian Wolff | milian.wolff@kdab.com | Software Engineer
KDAB (Deutschland) GmbH&Co KG, a KDAB Group company
Tel: +49-30-521325470
KDAB - The Qt Experts

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5903 bytes --]

      reply	other threads:[~2016-08-30 21:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-16 15:56 perf inject --sched-stat can produce invalid perf.data files Milian Wolff
2016-08-30 21:26 ` Milian Wolff [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=1996346.OFykjbkAe6@agathebauer \
    --to=milian.wolff@kdab.com \
    --cc=acme@kernel.org \
    --cc=linux-perf-users@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.