Commit eab656ae authored by Thomas Gleixner's avatar Thomas Gleixner Committed by Ingo Molnar

perf counters: clean up 'raw' type API

Impact: cleanup

Introduce a separate hw_event type.
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 4ac13294
...@@ -38,6 +38,7 @@ enum hw_event_types { ...@@ -38,6 +38,7 @@ enum hw_event_types {
* If this bit is set in the type, then trigger NMI sampling: * If this bit is set in the type, then trigger NMI sampling:
*/ */
PERF_COUNT_NMI = (1 << 30), PERF_COUNT_NMI = (1 << 30),
PERF_COUNT_RAW = (1 << 31),
}; };
/* /*
...@@ -49,6 +50,12 @@ enum perf_record_type { ...@@ -49,6 +50,12 @@ enum perf_record_type {
PERF_RECORD_GROUP, PERF_RECORD_GROUP,
}; };
struct perf_counter_event {
u32 hw_event_type;
u32 hw_event_period;
u64 hw_raw_ctrl;
};
/** /**
* struct hw_perf_counter - performance counter hardware details * struct hw_perf_counter - performance counter hardware details
*/ */
......
...@@ -54,6 +54,7 @@ struct compat_stat; ...@@ -54,6 +54,7 @@ struct compat_stat;
struct compat_timeval; struct compat_timeval;
struct robust_list_head; struct robust_list_head;
struct getcpu_cache; struct getcpu_cache;
struct perf_counter_event;
#include <linux/types.h> #include <linux/types.h>
#include <linux/aio_abi.h> #include <linux/aio_abi.h>
...@@ -625,9 +626,6 @@ asmlinkage long sys_fallocate(int fd, int mode, loff_t offset, loff_t len); ...@@ -625,9 +626,6 @@ asmlinkage long sys_fallocate(int fd, int mode, loff_t offset, loff_t len);
int kernel_execve(const char *filename, char *const argv[], char *const envp[]); int kernel_execve(const char *filename, char *const argv[], char *const envp[]);
asmlinkage int asmlinkage int
sys_perf_counter_open(u32 hw_event_type, sys_perf_counter_open(struct perf_counter_event __user *uevent, u32 record_type,
u32 hw_event_period, pid_t pid, int cpu, int masterfd);
u32 record_type,
pid_t pid,
int cpu);
#endif #endif
...@@ -734,26 +734,27 @@ perf_counter_alloc(u32 hw_event_period, int cpu, u32 record_type) ...@@ -734,26 +734,27 @@ perf_counter_alloc(u32 hw_event_period, int cpu, u32 record_type)
* @pid: target pid * @pid: target pid
*/ */
asmlinkage int asmlinkage int
sys_perf_counter_open(u32 hw_event_type, sys_perf_counter_open(struct perf_counter_event __user *uevent, u32 record_type,
u32 hw_event_period, pid_t pid, int cpu, int masterfd)
u32 record_type,
pid_t pid,
int cpu)
{ {
struct perf_counter_context *ctx; struct perf_counter_context *ctx;
struct perf_counter_event event;
struct perf_counter *counter; struct perf_counter *counter;
int ret; int ret;
if (copy_from_user(&event, uevent, sizeof(event)) != 0)
return -EFAULT;
ctx = find_get_context(pid, cpu); ctx = find_get_context(pid, cpu);
if (IS_ERR(ctx)) if (IS_ERR(ctx))
return PTR_ERR(ctx); return PTR_ERR(ctx);
ret = -ENOMEM; ret = -ENOMEM;
counter = perf_counter_alloc(hw_event_period, cpu, record_type); counter = perf_counter_alloc(event.hw_event_period, cpu, record_type);
if (!counter) if (!counter)
goto err_put_context; goto err_put_context;
ret = hw_perf_counter_init(counter, hw_event_type); ret = hw_perf_counter_init(counter, event.hw_event_type);
if (ret) if (ret)
goto err_free_put_context; goto err_free_put_context;
......
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