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

arc: perf: Enable generic "cache-references" and "cache-misses" events

We used to live with PERF_COUNT_HW_CACHE_REFERENCES and
PERF_COUNT_HW_CACHE_REFERENCES not specified on ARC.

Those events are actually aliases to 2 cache events that we do support
and so this change sets "cache-reference" and "cache-misses" events
in the same way as "L1-dcache-loads" and L1-dcache-load-misses.

And while at it adding debug info for cache events as well as doing a
subtle fix in HW events debug info - config value is much better
represented by hex so we may see not only event index but as well other
control bits set (if they exist).

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Vineet Gupta <vgupta@synopsys.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-snps-arc@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>

authored by

Alexey Brodkin and committed by
Vineet Gupta
e0d5321f ce0f4932

+7 -2
+3
arch/arc/include/asm/perf_event.h
··· 118 118 [PERF_COUNT_ARC_ICM] = "icm", /* I-cache Miss */ 119 119 [PERF_COUNT_ARC_EDTLB] = "edtlb", /* D-TLB Miss */ 120 120 [PERF_COUNT_ARC_EITLB] = "eitlb", /* I-TLB Miss */ 121 + 122 + [PERF_COUNT_HW_CACHE_REFERENCES] = "imemrdc", /* Instr: mem read cached */ 123 + [PERF_COUNT_HW_CACHE_MISSES] = "dclm", /* D-cache Load Miss */ 121 124 }; 122 125 123 126 #define C(_x) PERF_COUNT_HW_CACHE_##_x
+4 -2
arch/arc/kernel/perf_event.c
··· 179 179 if (arc_pmu->ev_hw_idx[event->attr.config] < 0) 180 180 return -ENOENT; 181 181 hwc->config |= arc_pmu->ev_hw_idx[event->attr.config]; 182 - pr_debug("init event %d with h/w %d \'%s\'\n", 183 - (int) event->attr.config, (int) hwc->config, 182 + pr_debug("init event %d with h/w %08x \'%s\'\n", 183 + (int)event->attr.config, (int)hwc->config, 184 184 arc_pmu_ev_hw_map[event->attr.config]); 185 185 return 0; 186 186 ··· 189 189 if (ret < 0) 190 190 return ret; 191 191 hwc->config |= arc_pmu->ev_hw_idx[ret]; 192 + pr_debug("init cache event with h/w %08x \'%s\'\n", 193 + (int)hwc->config, arc_pmu_ev_hw_map[ret]); 192 194 return 0; 193 195 default: 194 196 return -ENOENT;