From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752047AbcGPUo7 (ORCPT ); Sat, 16 Jul 2016 16:44:59 -0400 Received: from terminus.zytor.com ([198.137.202.10]:38478 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751733AbcGPUo6 (ORCPT ); Sat, 16 Jul 2016 16:44:58 -0400 Date: Sat, 16 Jul 2016 13:44:48 -0700 From: tip-bot for Arnaldo Carvalho de Melo Message-ID: Cc: mingo@kernel.org, linux-kernel@vger.kernel.org, jolsa@kernel.org, hpa@zytor.com, namhyung@kernel.org, dsahern@gmail.com, tglx@linutronix.de, wangnan0@huawei.com, adrian.hunter@intel.com, acme@redhat.com Reply-To: mingo@kernel.org, linux-kernel@vger.kernel.org, hpa@zytor.com, jolsa@kernel.org, namhyung@kernel.org, dsahern@gmail.com, tglx@linutronix.de, wangnan0@huawei.com, adrian.hunter@intel.com, acme@redhat.com To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf tools: Bail out at "--sort dcacheline" and cacheline_size not known Git-Commit-ID: 0d203166de37ad50ea826f97570b3a2beea87c9d 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: 0d203166de37ad50ea826f97570b3a2beea87c9d Gitweb: http://git.kernel.org/tip/0d203166de37ad50ea826f97570b3a2beea87c9d Author: Arnaldo Carvalho de Melo AuthorDate: Fri, 15 Jul 2016 10:08:43 -0300 Committer: Arnaldo Carvalho de Melo CommitDate: Fri, 15 Jul 2016 10:08:43 -0300 perf tools: Bail out at "--sort dcacheline" and cacheline_size not known There are cases where further work would be needed to overcome the fact that neither sysconf(_SC_LEVEL1_DCACHE_LINESIZE) nor /sys/devices/system/cpu/cpu0/cache/index0/coherency_line_size are available in some systems (Android, for instance), so bail out when such a situation takes place. Cc: Adrian Hunter Cc: David Ahern Cc: Jiri Olsa Cc: Namhyung Kim Cc: Wang Nan Link: http://lkml.kernel.org/n/tip-ho8d8g8mh0o2dri7ckcccafi@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/sort.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c index 5854b46..947d21f 100644 --- a/tools/perf/util/sort.c +++ b/tools/perf/util/sort.c @@ -2381,6 +2381,9 @@ static int sort_dimension__add(struct perf_hpp_list *list, const char *tok, if (sort__mode != SORT_MODE__MEMORY) return -EINVAL; + if (sd->entry == &sort_mem_dcacheline && cacheline_size == 0) + return -EINVAL; + if (sd->entry == &sort_mem_daddr_sym) list->sym = 1; @@ -2424,7 +2427,10 @@ static int setup_sort_list(struct perf_hpp_list *list, char *str, if (*tok) { ret = sort_dimension__add(list, tok, evlist, level); if (ret == -EINVAL) { - error("Invalid --sort key: `%s'", tok); + if (!cacheline_size && !strncasecmp(tok, "dcacheline", strlen(tok))) + error("The \"dcacheline\" --sort key needs to know the cacheline size and it couldn't be determined on this system"); + else + error("Invalid --sort key: `%s'", tok); break; } else if (ret == -ESRCH) { error("Unknown --sort key: `%s'", tok);