From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752352AbcCBGhF (ORCPT ); Wed, 2 Mar 2016 01:37:05 -0500 Received: from mx1.redhat.com ([209.132.183.28]:54650 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751560AbcCBGhD (ORCPT ); Wed, 2 Mar 2016 01:37:03 -0500 Date: Wed, 2 Mar 2016 07:36:59 +0100 From: Jiri Olsa To: Andi Kleen Cc: acme@kernel.org, jolsa@kernel.org, linux-kernel@vger.kernel.org, Andi Kleen Subject: Re: [PATCH] perf, tools, stat: Avoid crash with --per-thread Message-ID: <20160302063659.GA7272@krava> References: <1456875157-23263-1-git-send-email-andi@firstfloor.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1456875157-23263-1-git-send-email-andi@firstfloor.org> User-Agent: Mutt/1.5.24 (2015-08-30) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 02 Mar 2016 06:37:03 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 01, 2016 at 03:32:37PM -0800, Andi Kleen wrote: > From: Andi Kleen > > 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. right, so --per-thread paths go through perf_stat__print_shadow_stats but never actually collect shadow data, so it does not print anything we would need somehow map each thread to the shadow cpu.. I'll try to come up with something.. however: Acked-by: Jiri Olsa thanks, jirka > > Could be folded into > "perf, tools, stat: Support metrics in --per-core/socket mode" > > Signed-off-by: Andi Kleen > --- > 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 >