aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/perf_counter.c
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2009-03-04 04:36:51 -0500
committerPaul Mackerras <paulus@samba.org>2009-03-04 04:36:51 -0500
commit2743a5b0fa6f309da904f2190a9cc25deee34dbd (patch)
tree0efad6834902a3e0621bf9a74e5cde8cd49f97e6 /kernel/perf_counter.c
parenta1ef58f442542d8b3e3b963339fbc522c36e827c (diff)
perfcounters: provide expansion room in the ABI
Impact: ABI change This expands several fields in the perf_counter_hw_event struct and adds a "flags" argument to the perf_counter_open system call, in order that features can be added in future without ABI changes. In particular the record_type field is expanded to 64 bits, and the space for flag bits has been expanded from 32 to 64 bits. This also adds some new fields: * read_format (64 bits) is intended to provide a way to specify what userspace wants to get back when it does a read() on a simple (non-interrupting) counter; * exclude_idle (1 bit) provides a way for userspace to ask that events that occur when the cpu is idle be excluded; * extra_config_len will provide a way for userspace to supply an arbitrary amount of extra machine-specific PMU configuration data immediately following the perf_counter_hw_event struct, to allow sophisticated users to program things such as instruction matching CAMs and address range registers; * __reserved_3 and __reserved_4 provide space for future expansion. Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'kernel/perf_counter.c')
-rw-r--r--kernel/perf_counter.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index 16b14ba99d34..b2e838959f3e 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -1683,16 +1683,16 @@ perf_counter_alloc(struct perf_counter_hw_event *hw_event,
1683} 1683}
1684 1684
1685/** 1685/**
1686 * sys_perf_task_open - open a performance counter, associate it to a task/cpu 1686 * sys_perf_counter_open - open a performance counter, associate it to a task/cpu
1687 * 1687 *
1688 * @hw_event_uptr: event type attributes for monitoring/sampling 1688 * @hw_event_uptr: event type attributes for monitoring/sampling
1689 * @pid: target pid 1689 * @pid: target pid
1690 * @cpu: target cpu 1690 * @cpu: target cpu
1691 * @group_fd: group leader counter fd 1691 * @group_fd: group leader counter fd
1692 */ 1692 */
1693SYSCALL_DEFINE4(perf_counter_open, 1693SYSCALL_DEFINE5(perf_counter_open,
1694 const struct perf_counter_hw_event __user *, hw_event_uptr, 1694 const struct perf_counter_hw_event __user *, hw_event_uptr,
1695 pid_t, pid, int, cpu, int, group_fd) 1695 pid_t, pid, int, cpu, int, group_fd, unsigned long, flags)
1696{ 1696{
1697 struct perf_counter *counter, *group_leader; 1697 struct perf_counter *counter, *group_leader;
1698 struct perf_counter_hw_event hw_event; 1698 struct perf_counter_hw_event hw_event;
@@ -1703,6 +1703,10 @@ SYSCALL_DEFINE4(perf_counter_open,
1703 int fput_needed2 = 0; 1703 int fput_needed2 = 0;
1704 int ret; 1704 int ret;
1705 1705
1706 /* for future expandability... */
1707 if (flags)
1708 return -EINVAL;
1709
1706 if (copy_from_user(&hw_event, hw_event_uptr, sizeof(hw_event)) != 0) 1710 if (copy_from_user(&hw_event, hw_event_uptr, sizeof(hw_event)) != 0)
1707 return -EFAULT; 1711 return -EFAULT;
1708 1712