From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934067AbcIENZI (ORCPT ); Mon, 5 Sep 2016 09:25:08 -0400 Received: from terminus.zytor.com ([198.137.202.10]:38816 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933460AbcIENYx (ORCPT ); Mon, 5 Sep 2016 09:24:53 -0400 Date: Mon, 5 Sep 2016 06:24:41 -0700 From: tip-bot for Arnaldo Carvalho de Melo Message-ID: Cc: linux-kernel@vger.kernel.org, tglx@linutronix.de, wangnan0@huawei.com, mingo@kernel.org, namhyung@kernel.org, adrian.hunter@intel.com, jolsa@kernel.org, dsahern@gmail.com, hpa@zytor.com, acme@redhat.com, mhiramat@kernel.org Reply-To: mhiramat@kernel.org, acme@redhat.com, dsahern@gmail.com, hpa@zytor.com, adrian.hunter@intel.com, jolsa@kernel.org, mingo@kernel.org, wangnan0@huawei.com, namhyung@kernel.org, linux-kernel@vger.kernel.org, tglx@linutronix.de To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf test vmlinux: Avoid printing headers for empty lists Git-Commit-ID: 54da07695a0c11b342815be0d8f1796c88765bde X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 54da07695a0c11b342815be0d8f1796c88765bde Gitweb: http://git.kernel.org/tip/54da07695a0c11b342815be0d8f1796c88765bde Author: Arnaldo Carvalho de Melo AuthorDate: Thu, 1 Sep 2016 10:40:57 -0300 Committer: Arnaldo Carvalho de Melo CommitDate: Thu, 1 Sep 2016 12:42:23 -0300 perf test vmlinux: Avoid printing headers for empty lists Before: # perf test -F -v 1 1: vmlinux symtab matches kallsyms: --- start --- WARN: Maps only in vmlinux: ffffffffb7d7d000-ffffffffb7eeaac8 117d000 [kernel].init.text ffffffffb7eeaac8-ffffffffc03ad000 12eaac8 [kernel].exit.text WARN: Maps in vmlinux with a different name in kallsyms: WARN: Maps only in kallsyms: ---- end ---- vmlinux symtab matches kallsyms: Ok # The two last WARN lines are now suppressed, since there are no such cases detected. Cc: Adrian Hunter Cc: David Ahern Cc: Jiri Olsa Cc: Masami Hiramatsu Cc: Namhyung Kim Cc: Wang Nan Link: http://lkml.kernel.org/n/tip-9ww8uvzl682ykaw8ht1tozlr@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/tests/vmlinux-kallsyms.c | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/tools/perf/tests/vmlinux-kallsyms.c b/tools/perf/tests/vmlinux-kallsyms.c index 6bd5bf9..450f699 100644 --- a/tools/perf/tests/vmlinux-kallsyms.c +++ b/tools/perf/tests/vmlinux-kallsyms.c @@ -28,6 +28,7 @@ int test__vmlinux_matches_kallsyms(int subtest __maybe_unused) enum map_type type = MAP__FUNCTION; struct maps *maps = &vmlinux.kmaps.maps[type]; u64 mem_start, mem_end; + bool header_printed; /* * Step 1: @@ -178,7 +179,7 @@ next_pair: if (!verbose) goto out; - pr_info("WARN: Maps only in vmlinux:\n"); + header_printed = false; for (map = maps__first(maps); map; map = map__next(map)) { struct map * @@ -192,13 +193,18 @@ next_pair: (map->dso->kernel ? map->dso->short_name : map->dso->name)); - if (pair) + if (pair) { pair->priv = 1; - else + } else { + if (!header_printed) { + pr_info("WARN: Maps only in vmlinux:\n"); + header_printed = true; + } map__fprintf(map, stderr); + } } - pr_info("WARN: Maps in vmlinux with a different name in kallsyms:\n"); + header_printed = false; for (map = maps__first(maps); map; map = map__next(map)) { struct map *pair; @@ -211,7 +217,11 @@ next_pair: continue; if (pair->start == mem_start) { - pair->priv = 1; + if (!header_printed) { + pr_info("WARN: Maps in vmlinux with a different name in kallsyms:\n"); + header_printed = true; + } + pr_info("WARN: %" PRIx64 "-%" PRIx64 " %" PRIx64 " %s in kallsyms as", map->start, map->end, map->pgoff, map->dso->name); if (mem_end != pair->end) @@ -222,13 +232,18 @@ next_pair: } } - pr_info("WARN: Maps only in kallsyms:\n"); + header_printed = false; maps = &kallsyms.kmaps.maps[type]; for (map = maps__first(maps); map; map = map__next(map)) { - if (!map->priv) + if (!map->priv) { + if (!header_printed) { + pr_info("WARN: Maps only in kallsyms:\n"); + header_printed = true; + } map__fprintf(map, stderr); + } } out: machine__exit(&kallsyms);