Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

+7 -1
+7 -1
tools/perf/util/sort.c
··· 2381 2381 if (sort__mode != SORT_MODE__MEMORY) 2382 2382 return -EINVAL; 2383 2383 2384 + if (sd->entry == &sort_mem_dcacheline && cacheline_size == 0) 2385 + return -EINVAL; 2386 + 2384 2387 if (sd->entry == &sort_mem_daddr_sym) 2385 2388 list->sym = 1; 2386 2389 ··· 2427 2424 if (*tok) { 2428 2425 ret = sort_dimension__add(list, tok, evlist, level); 2429 2426 if (ret == -EINVAL) { 2430 - error("Invalid --sort key: `%s'", tok); 2427 + if (!cacheline_size && !strncasecmp(tok, "dcacheline", strlen(tok))) 2428 + error("The \"dcacheline\" --sort key needs to know the cacheline size and it couldn't be determined on this system"); 2429 + else 2430 + error("Invalid --sort key: `%s'", tok); 2431 2431 break; 2432 2432 } else if (ret == -ESRCH) { 2433 2433 error("Unknown --sort key: `%s'", tok);