All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Thomas Richter <tmricht@linux.ibm.com>,
	Namhyung Kim <namhyung@kernel.org>
Cc: sumanth Korikkar <sumanthk@linux.ibm.com>,
	Jiri Olsa <jolsa@kernel.org>, Heiko Carstens <hca@linux.ibm.com>,
	"linux-perf-use." <linux-perf-users@vger.kernel.org>
Subject: Re: perf list dumps core using 5.13.0.rc2
Date: Wed, 19 May 2021 14:00:56 -0300	[thread overview]
Message-ID: <YKVESEKRjKtILhog@kernel.org> (raw)
In-Reply-To: <YKU8L/v7BDobrzBb@kernel.org>

Em Wed, May 19, 2021 at 01:26:23PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Wed, May 19, 2021 at 04:57:05PM +0200, Thomas Richter escreveu:
> > 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

Please check and provide your Acked-by or Reviewed-by,

Thanks,

- Arnaldo

From f8b0fe090267a901aa30070351b40f5e8abc0286 Mon Sep 17 00:00:00 2001
From: Arnaldo Carvalho de Melo <acme@redhat.com>
Date: Wed, 19 May 2021 13:50:31 -0300
Subject: [PATCH 1/1] perf parse-events: Check if the software events array
 slots are populated

To avoid a NULL pointer dereference when the kernel supports the new
entry but the tooling still hasn't added an entry for it.

This happened with the recently added PERF_COUNT_SW_CGROUP_SWITCHES
software event.

Reported-by: Thomas Richter <tmricht@linux.ibm.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Sumanth Korikkar <sumanthk@linux.ibm.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/parse-events.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 4dad14265b81dfb8..8c5df56121d85cb2 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -2928,9 +2928,14 @@ void print_symbol_events(const char *event_glob, unsigned type,
 	}
 
 	for (i = 0; i < max; i++, syms++) {
+		/*
+		 * New attr.config still not supported here, the latest
+		 * example was PERF_COUNT_SW_CGROUP_SWITCHES
+		 */
+		if (syms->symbol == NULL)
+			continue;
 
-		if (event_glob != NULL && syms->symbol != NULL &&
-		    !(strglobmatch(syms->symbol, event_glob) ||
+		if (event_glob != NULL && !(strglobmatch(syms->symbol, event_glob) ||
 		      (syms->alias && strglobmatch(syms->alias, event_glob))))
 			continue;
 
-- 
2.31.1


  reply	other threads:[~2021-05-19 17:01 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 [this message]
2021-05-19 16:27 ` Ian Rogers
2021-05-19 17:18   ` Arnaldo Carvalho de Melo
2021-05-20  6:35     ` Thomas Richter

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=YKVESEKRjKtILhog@kernel.org \
    --to=acme@kernel.org \
    --cc=hca@linux.ibm.com \
    --cc=jolsa@kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=namhyung@kernel.org \
    --cc=sumanthk@linux.ibm.com \
    --cc=tmricht@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 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.