All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* perf stat crashes with latest download (git clone -b perf/core)
@ 2017-11-09 14:23 Thomas-Mich Richter
  2017-11-09 14:30 ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas-Mich Richter @ 2017-11-09 14:23 UTC (permalink / raw
  To: linux-perf-use., Hendrik Brueckner

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: perf stat crashes with latest download (git clone -b perf/core)
  2017-11-09 14:23 perf stat crashes with latest download (git clone -b perf/core) Thomas-Mich Richter
@ 2017-11-09 14:30 ` Arnaldo Carvalho de Melo
  2017-11-09 14:31   ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-11-09 14:30 UTC (permalink / raw
  To: Thomas-Mich Richter
  Cc: linux-perf-use., Hendrik Brueckner, Jiri Olsa, Namhyung Kim,
	Andi Kleen

Em Thu, Nov 09, 2017 at 03:23:43PM +0100, Thomas-Mich Richter escreveu:
> 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:

Trying with today's acme/perf/core:

Yeah,

[acme@jouet linuxdev-br]$ perf stat  -e '{cpu-clock,instructions}' kill
kill: not enough arguments
Segmentation fault (core dumped)
[acme@jouet linuxdev-br]$

Trying to bisect it now, thanks for the report!
 
> 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
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-perf-users" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: perf stat crashes with latest download (git clone -b perf/core)
  2017-11-09 14:30 ` Arnaldo Carvalho de Melo
@ 2017-11-09 14:31   ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-11-09 14:31 UTC (permalink / raw
  To: Thomas-Mich Richter
  Cc: linux-perf-use., Hendrik Brueckner, Jiri Olsa, Namhyung Kim,
	Andi Kleen

Em Thu, Nov 09, 2017 at 11:30:24AM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Thu, Nov 09, 2017 at 03:23:43PM +0100, Thomas-Mich Richter escreveu:
> > 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:
> 
> Trying with today's acme/perf/core:
> 
> Yeah,
> 
> [acme@jouet linuxdev-br]$ perf stat  -e '{cpu-clock,instructions}' kill
> kill: not enough arguments
> Segmentation fault (core dumped)
> [acme@jouet linuxdev-br]$
> 
> Trying to bisect it now, thanks for the report!

Additional data point, this is happening only with perf/core, not
perf/urgent.

- Arnaldo

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-11-09 14:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-09 14:23 perf stat crashes with latest download (git clone -b perf/core) Thomas-Mich Richter
2017-11-09 14:30 ` Arnaldo Carvalho de Melo
2017-11-09 14:31   ` Arnaldo Carvalho de Melo

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.