From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754489AbbJZNvg (ORCPT ); Mon, 26 Oct 2015 09:51:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51134 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754350AbbJZNvd (ORCPT ); Mon, 26 Oct 2015 09:51:33 -0400 Date: Mon, 26 Oct 2015 14:51:30 +0100 From: Jiri Olsa To: Adrian Hunter Cc: acme@kernel.org, Peter Zijlstra , Ingo Molnar , Namhyung Kim , Kan Liang , Andi Kleen , linux-kernel@vger.kernel.org, Michael Petlan Subject: [PATCH] perf tools: Fix endless loop in dso__split_kallsyms_for_kcore Message-ID: <20151026135130.GA26003@krava.brq.redhat.com> References: <20151026130154.GA4400@krava.local> <562E2919.5000601@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <562E2919.5000601@intel.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 26, 2015 at 03:22:33PM +0200, Adrian Hunter wrote: > On 26/10/15 15:01, Jiri Olsa wrote: > > hi, > > I'm getting stuck buildid-list command on s390 > > > > seems like the kcore code gets stuck with inseting > > into rbtree while iterating it.. > > > > I was able to fix it with patch below, bu I'm not sure it's the > > correct fix because the kcore maps magic is beyond me so far ;-) > > > > please check attached backtrace and patch > > Your fix looks correct to me. great, attached patch with changelog.. please feel free to add more detail or correct it thanks, jirka --- Currently we split symbols based on the map comparison, but symbols are stored within dso objects and maps could point into same dso objects (kernel maps). Hence we could end up changing rbtree we are currently iterating and mess it up. It's easily reproduced on s390x by running: $ perf record -a -- sleep 3 $ perf buildid-list -i perf.data --with-hits The fix is to compare dso objects instead. Reported-by: Michael Petlan Link: http://lkml.kernel.org/n/tip-p9ge2nvme7u5s21j0sn987wd@git.kernel.org Signed-off-by: Jiri Olsa --- tools/perf/util/symbol.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index e7bf0c46918d..b0d2fb272f7e 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c @@ -680,7 +680,7 @@ static int dso__split_kallsyms_for_kcore(struct dso *dso, struct map *map, pos->start -= curr_map->start - curr_map->pgoff; if (pos->end) pos->end -= curr_map->start - curr_map->pgoff; - if (curr_map != map) { + if (curr_map->dso != map->dso) { rb_erase_init(&pos->rb_node, root); symbols__insert( &curr_map->dso->symbols[curr_map->type], -- 2.4.3