linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Richter <tmricht@linux.ibm.com>
To: Arnaldo Carvalho de Melo <acme@kernel.org>,
	Ian Rogers <irogers@google.com>
Cc: sumanth Korikkar <sumanthk@linux.ibm.com>,
	Heiko Carstens <hca@linux.ibm.com>,
	"linux-perf-use." <linux-perf-users@vger.kernel.org>,
	Namhyung Kim <namhyung@kernel.org>
Subject: Re: perf list dumps core using 5.13.0.rc2
Date: Thu, 20 May 2021 08:35:44 +0200	[thread overview]
Message-ID: <47c2afdd-a140-780b-aae3-4242b746a183@linux.ibm.com> (raw)
In-Reply-To: <YKVIciYdoooQNfsS@kernel.org>

On 5/19/21 7:18 PM, Arnaldo Carvalho de Melo wrote:
> Em Wed, May 19, 2021 at 09:27:14AM -0700, Ian Rogers escreveu:
>> On Wed, May 19, 2021 at 7:57 AM Thomas Richter <tmricht@linux.ibm.com> wrote:
>>>
>>> Using kernel 5.13.0.rc2 command perf list dumps core on my x86
>>> virtual machine:
>>>
>>> [root@f34 perf]# ./perf list
>>> Segmentation fault (core dumped)
>>> ^C
>>> [root@f34 perf]#
>>>
>>> The root case this this change in file ../include/uapi/linux/perf_event.h:
>>> enum perf_sw_ids {
>>>         PERF_COUNT_SW_CPU_CLOCK                 = 0,
>>>         ...
>>>  --->   PERF_COUNT_SW_CGROUP_SWITCHES           = 11,
>>>
>>>         PERF_COUNT_SW_MAX,                      /* non-ABI */
>>> };
>>>
>>> This change increases PERF_COUNT_SW_MAX to 12. However this
>>> change is not reflected in file util/parse-events.c where data structure
>>>
>>> struct event_symbol event_symbols_sw[PERF_COUNT_SW_MAX] = {
>>>         ....
>>> }
>>>
>>> is defined and it misses the symbol name and alias for this new software
>>> event. So when command 'perf list' is called, the call chain sequence
>>> is
>>>   cmd_list()
>>>     print_events()
>>>       print_symbol_events(event_glob, PERF_TYPE_SOFTWARE,
>>>                           event_symbols_sw, PERF_COUNT_SW_MAX, name_only);
>>>
>>> where PERF_COUNT_SW_MAX is 12 and  structure event_symbols_sw[] contains
>>> only 11 elements. This ends up with the last element of the array being
>>> all zeroes and the line:
>>>
>>>     if (!name_only && strlen(syms->alias))
>>>
>>> dumps core because syms->alias is a NULL pointer.
>>>
>>> Is this dummy event PERF_COUNT_SW_CGROUP_SWITCHES simply missing in the
>>> event_symbols_sw[] array or is there more to it (which I am missing).
>>>
>>> Thanks.
>>>
>>> PS: I can sent a patch if needed....
>>
>> I believe Namhyung's pending change will fix this:
>> https://lore.kernel.org/lkml/20210210083327.22726-3-namhyung@kernel.org/
> 
> Ok, I'll pick that one instead of the one I did, similar one.
> 
> - Arnaldo
> 

Thanks for looking into this, Namhyung's patch fixes this issue.

-- 
Thomas Richter, Dept 3303, IBM s390 Linux Development, Boeblingen, Germany
--
Vorsitzender des Aufsichtsrats: Gregor Pillen
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen / Registergericht: Amtsgericht Stuttgart, HRB 243294

      reply	other threads:[~2021-05-20  6:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-19 14:57 perf list dumps core using 5.13.0.rc2 Thomas Richter
2021-05-19 16:26 ` Arnaldo Carvalho de Melo
2021-05-19 17:00   ` Arnaldo Carvalho de Melo
2021-05-19 16:27 ` Ian Rogers
2021-05-19 17:18   ` Arnaldo Carvalho de Melo
2021-05-20  6:35     ` Thomas Richter [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=47c2afdd-a140-780b-aae3-4242b746a183@linux.ibm.com \
    --to=tmricht@linux.ibm.com \
    --cc=acme@kernel.org \
    --cc=hca@linux.ibm.com \
    --cc=irogers@google.com \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=namhyung@kernel.org \
    --cc=sumanthk@linux.ibm.com \
    /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).