public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andi Kleen <andi@firstfloor.org>
To: acme@kernel.org
Cc: jolsa@kernel.org, linux-kernel@vger.kernel.org,
	Andi Kleen <ak@linux.intel.com>
Subject: [PATCH] perf, tools, stat: Avoid crash with --per-thread
Date: Tue,  1 Mar 2016 15:32:37 -0800	[thread overview]
Message-ID: <1456875157-23263-1-git-send-email-andi@firstfloor.org> (raw)

From: Andi Kleen <ak@linux.intel.com>

Bug fix:

The earlier metrics changes broke --per-thread causing a segfault.
Handle this case correctly. We actually don't print metrics
in per thread mode, so using a 0 shadow CPU is fine.

Could be folded into
"perf, tools, stat: Support metrics in --per-core/socket mode"

Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
 tools/perf/builtin-stat.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index c11374b..52a37a5 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -977,6 +977,9 @@ static int first_shadow_cpu(struct perf_evsel *evsel, int id)
 {
 	int i;
 
+	if (!aggr_get_id)
+		return 0;
+
 	if (stat_config.aggr_mode == AGGR_NONE)
 		return id;
 
-- 
2.5.0

             reply	other threads:[~2016-03-01 23:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-01 23:32 Andi Kleen [this message]
2016-03-02  6:36 ` [PATCH] perf, tools, stat: Avoid crash with --per-thread Jiri Olsa
2016-03-02 12:12   ` 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=1456875157-23263-1-git-send-email-andi@firstfloor.org \
    --to=andi@firstfloor.org \
    --cc=acme@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@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