Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 187841
b: refs/heads/master
c: 320ebf0
h: refs/heads/master
i:
  187839: aa22dd8
v: v3
  • Loading branch information
Peter Zijlstra authored and Ingo Molnar committed Mar 2, 2010
1 parent 30e6aae commit ee6e109
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 16 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: bb1165d6882f423f90fc7007a88c6c993b7c2ac4
refs/heads/master: 320ebf09cbb6d01954c9a060266aa8e0d27f4638
3 changes: 3 additions & 0 deletions trunk/arch/x86/kernel/cpu/perf_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,9 @@ static int __hw_perf_event_init(struct perf_event *event)
*/
if (attr->type == PERF_TYPE_RAW) {
hwc->config |= x86_pmu.raw_event(attr->config);
if ((hwc->config & ARCH_PERFMON_EVENTSEL_ANY) &&
perf_paranoid_cpu() && !capable(CAP_SYS_ADMIN))
return -EACCES;
return 0;
}

Expand Down
15 changes: 15 additions & 0 deletions trunk/include/linux/perf_event.h
Original file line number Diff line number Diff line change
Expand Up @@ -857,6 +857,21 @@ extern int sysctl_perf_event_paranoid;
extern int sysctl_perf_event_mlock;
extern int sysctl_perf_event_sample_rate;

static inline bool perf_paranoid_tracepoint_raw(void)
{
return sysctl_perf_event_paranoid > -1;
}

static inline bool perf_paranoid_cpu(void)
{
return sysctl_perf_event_paranoid > 0;
}

static inline bool perf_paranoid_kernel(void)
{
return sysctl_perf_event_paranoid > 1;
}

extern void perf_event_init(void);
extern void perf_tp_event(int event_id, u64 addr, u64 count, void *record, int entry_size);
extern void perf_bp_event(struct perf_event *event, void *data);
Expand Down
15 changes: 0 additions & 15 deletions trunk/kernel/perf_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,21 +56,6 @@ static atomic_t nr_task_events __read_mostly;
*/
int sysctl_perf_event_paranoid __read_mostly = 1;

static inline bool perf_paranoid_tracepoint_raw(void)
{
return sysctl_perf_event_paranoid > -1;
}

static inline bool perf_paranoid_cpu(void)
{
return sysctl_perf_event_paranoid > 0;
}

static inline bool perf_paranoid_kernel(void)
{
return sysctl_perf_event_paranoid > 1;
}

int sysctl_perf_event_mlock __read_mostly = 512; /* 'free' kb per user */

/*
Expand Down

0 comments on commit ee6e109

Please sign in to comment.