From: Thomas-Mich Richter <tmricht@linux.vnet.ibm.com>
To: "linux-perf-use." <linux-perf-users@vger.kernel.org>,
Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Subject: perf stat crashes with latest download (git clone -b perf/core)
Date: Thu, 9 Nov 2017 15:23:43 +0100 [thread overview]
Message-ID: <c64c1529-d0d7-2d1d-0a42-91db6e247863@linux.vnet.ibm.com> (raw)
I have downloaded this code some days ago
git clone -b perf/core git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux acme
and run into this issue which I reproduce on my KVM virtual machine on intel and s390x.
[root@localhost perf]# ./perf stat -e '{cpu-clock,instructions}' kill
kill: not enough arguments
Segmentation fault (core dumped)
[root@localhost perf]#
When I debug this further using gdb I get this error:
root@localhost perf]# gdb perf core.4496
GNU gdb (GDB) Fedora 8.0.1-26.fc26
Copyright (C) 2017 Free Software Foundation, Inc.
....
Core was generated by `./perf stat -e {cpu-clock,instructions} kill'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 perf_evsel__read_group (thread=0, cpu=2, leader=0x3bc8110) at util/evsel.c:1377
1377 u64 *data = ps->group_data;
This goes back to commit f7794d525447f1e4e4b2228dd29dba084005e6bf ("perf evsel: Add read_counter()")
(gdb) where
#0 perf_evsel__read_group (thread=0, cpu=2, leader=0x3bc8110) at util/evsel.c:1377
#1 perf_evsel__read_counter (evsel=evsel@entry=0x3bc8110, cpu=cpu@entry=0, thread=thread@entry=0) at util/evsel.c:1407
#2 0x0000000000442aad in read_counter (counter=0x3bc8110) at builtin-stat.c:360
#3 read_counters () at builtin-stat.c:395
#4 0x000000000044735a in __run_perf_stat (argc=argc@entry=1, argv=argv@entry=0x7ffdc05145f0) at builtin-stat.c:786
#5 0x0000000000448a60 in run_perf_stat (argv=0x7ffdc05145f0, argc=1) at builtin-stat.c:805
#6 cmd_stat (argc=1, argv=0x7ffdc05145f0) at builtin-stat.c:2838
#7 0x00000000004a004f in run_builtin (p=p@entry=0xa34ae0 <commands+288>, argc=argc@entry=4, argv=argv@entry=0x7ffdc05145f0)
at perf.c:297
#8 0x00000000004a0351 in handle_internal_command (argc=argc@entry=4, argv=argv@entry=0x7ffdc05145f0) at perf.c:349
#9 0x000000000042a21a in run_argv (argcp=<synthetic pointer>, argv=<synthetic pointer>) at perf.c:393
#10 main (argc=<optimized out>, argv=0x7ffdc05145f0) at perf.c:537
(gdb) list
1372 perf_evsel__read_group(struct perf_evsel *leader, int cpu, int thread)
1373 {
1374 struct perf_stat_evsel *ps = leader->priv;
1375 u64 read_format = leader->attr.read_format;
1376 int size = perf_evsel__read_size(leader);
1377 u64 *data = ps->group_data;
1378
1379 if (!(read_format & PERF_FORMAT_ID))
1380 return -EINVAL;
1381
(gdb) p *leader
$1 = {node = {next = 0x3bc8320, prev = 0x3bb75c0}, evlist = 0x3bb75c0, attr = {type = 1, size = 112, config = 0, {
sample_period = 0, sample_freq = 0}, sample_type = 65536, read_format = 15, disabled = 1, inherit = 1, pinned = 0,
exclusive = 0, exclude_user = 0, exclude_kernel = 0, exclude_hv = 0, exclude_idle = 0, mmap = 0, comm = 0, freq = 0,
inherit_stat = 0, enable_on_exec = 1, task = 0, watermark = 0, precise_ip = 0, mmap_data = 0, sample_id_all = 0,
exclude_host = 0, exclude_guest = 1, exclude_callchain_kernel = 0, exclude_callchain_user = 0, mmap2 = 0, comm_exec = 0,
use_clockid = 0, context_switch = 0, write_backward = 0, namespaces = 0, __reserved_1 = 0, {wakeup_events = 0,
wakeup_watermark = 0}, bp_type = 0, {bp_addr = 0, config1 = 0}, {bp_len = 0, config2 = 0}, branch_sample_type = 0,
sample_regs_user = 0, sample_stack_user = 0, clockid = 0, sample_regs_intr = 0, aux_watermark = 0, sample_max_stack = 0,
__reserved_2 = 0}, filter = 0x0, fd = 0x3bc02f0, sample_id = 0x3bc4360, id = 0x3bc43d0, counts = 0x3bc0100,
prev_raw_counts = 0x0, idx = 0, ids = 1, name = 0x3bc82c0 "cpu-clock", scale = 1, unit = 0x7b8643 "", tp_format = 0x0,
id_offset = 0, stats = 0x3bc5530, priv = 0x0, db_id = 0, cgrp = 0x0, handler = 0x0, cpus = 0x3bc5510, own_cpus = 0x0,
threads = 0x3bc54f0, sample_size = 0, id_pos = -1, is_pos = -1, snapshot = false, supported = true, needs_swap = false,
no_aux_samples = false, immediate = false, system_wide = false, tracking = true, per_pkg = false, precise_max = false,
ignore_missing_thread = false, exclude_GH = 0, nr_members = 2, sample_read = 0, per_pkg_mask = 0x0, leader = 0x3bc8110,
group_name = 0x0, cmdline_group_boundary = false, config_terms = {next = 0x3bc8280, prev = 0x3bc8280}, bpf_fd = -1,
auto_merge_stats = false, merged_stat = false, metric_expr = 0x0, metric_name = 0x0, metric_events = 0x0, collect_stat = false,
weak_group = false}
(
(gdb) p leader->priv
$2 = (void *) 0x0
(gdb)
The problem is the value of leader->priv which is 0x0 and line 1377 actually does leader->priv->group_data
which references a NULL pointer.
--
Thomas Richter, Dept 3303, IBM LTC Boeblingen Germany
--
Vorsitzende des Aufsichtsrats: Martina Koederitz
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen / Registergericht: Amtsgericht Stuttgart, HRB 243294
next reply other threads:[~2017-11-09 14:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-09 14:23 Thomas-Mich Richter [this message]
2017-11-09 14:30 ` perf stat crashes with latest download (git clone -b perf/core) Arnaldo Carvalho de Melo
2017-11-09 14:31 ` 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=c64c1529-d0d7-2d1d-0a42-91db6e247863@linux.vnet.ibm.com \
--to=tmricht@linux.vnet.ibm.com \
--cc=brueckner@linux.vnet.ibm.com \
--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 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).