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 <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-ho8d8g8mh0o2dri7ckcccafi@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 8811e8ea
...@@ -2381,6 +2381,9 @@ static int sort_dimension__add(struct perf_hpp_list *list, const char *tok, ...@@ -2381,6 +2381,9 @@ static int sort_dimension__add(struct perf_hpp_list *list, const char *tok,
if (sort__mode != SORT_MODE__MEMORY) if (sort__mode != SORT_MODE__MEMORY)
return -EINVAL; return -EINVAL;
if (sd->entry == &sort_mem_dcacheline && cacheline_size == 0)
return -EINVAL;
if (sd->entry == &sort_mem_daddr_sym) if (sd->entry == &sort_mem_daddr_sym)
list->sym = 1; list->sym = 1;
...@@ -2424,7 +2427,10 @@ static int setup_sort_list(struct perf_hpp_list *list, char *str, ...@@ -2424,7 +2427,10 @@ static int setup_sort_list(struct perf_hpp_list *list, char *str,
if (*tok) { if (*tok) {
ret = sort_dimension__add(list, tok, evlist, level); ret = sort_dimension__add(list, tok, evlist, level);
if (ret == -EINVAL) { 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; break;
} else if (ret == -ESRCH) { } else if (ret == -ESRCH) {
error("Unknown --sort key: `%s'", tok); error("Unknown --sort key: `%s'", tok);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment