perf counters: add arch-specific perf counters

arch perf counters are placed at start, so offset all
other counters (because placing arch perf counters at the end
wouldn't have been intrusive enough?)

Change-Id: Ifab1047872384927d9cfa0a0212327ee73545c29
Fujitsu: POSTK_DEBUG_ARCH_DEP_86
This commit is contained in:
Dominique Martinet
2019-01-30 13:47:38 +09:00
parent 0e895478a1
commit fb9832af6d
3 changed files with 10 additions and 4 deletions

View File

@ -14,6 +14,9 @@ static inline bool pte_is_write_combined(pte_t pte)
}
#endif /* POSTK_DEBUG_ARCH_DEP_12 */
#define ARMV8_IDX_COUNTER0 1
#define ARCH_PERF_COUNTER_START ARMV8_IDX_COUNTER0
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0)
static const unsigned long arch_rus_vm_flags = VM_RESERVED | VM_MIXEDMAP | VM_EXEC;
#else

View File

@ -14,6 +14,8 @@ static inline bool pte_is_write_combined(pte_t pte)
}
#endif /* POSTK_DEBUG_ARCH_DEP_12 */
#define ARCH_PERF_COUNTER_START 0
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0)
static const unsigned long arch_rus_vm_flags = VM_RESERVED | VM_MIXEDMAP;
#else

View File

@ -49,6 +49,7 @@
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
#include <uapi/linux/sched/types.h>
#endif
#include <archdeps.h>
//#define DEBUG
@ -2128,7 +2129,7 @@ long mcctrl_perf_set(ihk_os_t os, struct ihk_perf_event_attr *__user arg)
perf_desc->ctrl_type = PERF_CTRL_SET;
perf_desc->err = 0;
perf_desc->target_cntr = i;
perf_desc->target_cntr = i + ARCH_PERF_COUNTER_START;
perf_desc->config = attr.config;
perf_desc->exclude_kernel = attr.exclude_kernel;
perf_desc->exclude_user = attr.exclude_user;
@ -2188,7 +2189,7 @@ long mcctrl_perf_get(ihk_os_t os, unsigned long *__user arg)
perf_desc->ctrl_type = PERF_CTRL_GET;
perf_desc->err = 0;
perf_desc->target_cntr = i;
perf_desc->target_cntr = i + ARCH_PERF_COUNTER_START;
memset(&isp, '\0', sizeof(struct ikc_scd_packet));
isp.msg = SCD_MSG_PERF_CTRL;
@ -2235,7 +2236,7 @@ long mcctrl_perf_enable(ihk_os_t os)
int need_free;
for (i = 0; i < usrdata->perf_event_num; i++) {
cntr_mask |= 1UL << i;
cntr_mask |= 1UL << (i + ARCH_PERF_COUNTER_START);
}
perf_desc = kmalloc(sizeof(struct mcctrl_perf_ctrl_desc), GFP_KERNEL);
if (!perf_desc) {
@ -2288,7 +2289,7 @@ long mcctrl_perf_disable(ihk_os_t os)
int need_free;
for (i = 0; i < usrdata->perf_event_num; i++) {
cntr_mask |= 1UL << i;
cntr_mask |= 1UL << (i + ARCH_PERF_COUNTER_START);
}
perf_desc = kmalloc(sizeof(struct mcctrl_perf_ctrl_desc), GFP_KERNEL);
if (!perf_desc) {