diff options
Diffstat (limited to 'kernel/perf_event.c')
-rw-r--r-- | kernel/perf_event.c | 49 |
1 files changed, 18 insertions, 31 deletions
diff --git a/kernel/perf_event.c b/kernel/perf_event.c index 8e352c756ba7..4393b9e73740 100644 --- a/kernel/perf_event.c +++ b/kernel/perf_event.c | |||
@@ -56,21 +56,6 @@ static atomic_t nr_task_events __read_mostly; | |||
56 | */ | 56 | */ |
57 | int sysctl_perf_event_paranoid __read_mostly = 1; | 57 | int sysctl_perf_event_paranoid __read_mostly = 1; |
58 | 58 | ||
59 | static inline bool perf_paranoid_tracepoint_raw(void) | ||
60 | { | ||
61 | return sysctl_perf_event_paranoid > -1; | ||
62 | } | ||
63 | |||
64 | static inline bool perf_paranoid_cpu(void) | ||
65 | { | ||
66 | return sysctl_perf_event_paranoid > 0; | ||
67 | } | ||
68 | |||
69 | static inline bool perf_paranoid_kernel(void) | ||
70 | { | ||
71 | return sysctl_perf_event_paranoid > 1; | ||
72 | } | ||
73 | |||
74 | int sysctl_perf_event_mlock __read_mostly = 512; /* 'free' kb per user */ | 59 | int sysctl_perf_event_mlock __read_mostly = 512; /* 'free' kb per user */ |
75 | 60 | ||
76 | /* | 61 | /* |
@@ -4123,8 +4108,7 @@ void __perf_sw_event(u32 event_id, u64 nr, int nmi, | |||
4123 | if (rctx < 0) | 4108 | if (rctx < 0) |
4124 | return; | 4109 | return; |
4125 | 4110 | ||
4126 | data.addr = addr; | 4111 | perf_sample_data_init(&data, addr); |
4127 | data.raw = NULL; | ||
4128 | 4112 | ||
4129 | do_perf_sw_event(PERF_TYPE_SOFTWARE, event_id, nr, nmi, &data, regs); | 4113 | do_perf_sw_event(PERF_TYPE_SOFTWARE, event_id, nr, nmi, &data, regs); |
4130 | 4114 | ||
@@ -4169,11 +4153,10 @@ static enum hrtimer_restart perf_swevent_hrtimer(struct hrtimer *hrtimer) | |||
4169 | struct perf_event *event; | 4153 | struct perf_event *event; |
4170 | u64 period; | 4154 | u64 period; |
4171 | 4155 | ||
4172 | event = container_of(hrtimer, struct perf_event, hw.hrtimer); | 4156 | event = container_of(hrtimer, struct perf_event, hw.hrtimer); |
4173 | event->pmu->read(event); | 4157 | event->pmu->read(event); |
4174 | 4158 | ||
4175 | data.addr = 0; | 4159 | perf_sample_data_init(&data, 0); |
4176 | data.raw = NULL; | ||
4177 | data.period = event->hw.last_period; | 4160 | data.period = event->hw.last_period; |
4178 | regs = get_irq_regs(); | 4161 | regs = get_irq_regs(); |
4179 | /* | 4162 | /* |
@@ -4337,17 +4320,15 @@ static const struct pmu perf_ops_task_clock = { | |||
4337 | void perf_tp_event(int event_id, u64 addr, u64 count, void *record, | 4320 | void perf_tp_event(int event_id, u64 addr, u64 count, void *record, |
4338 | int entry_size) | 4321 | int entry_size) |
4339 | { | 4322 | { |
4323 | struct pt_regs *regs = get_irq_regs(); | ||
4324 | struct perf_sample_data data; | ||
4340 | struct perf_raw_record raw = { | 4325 | struct perf_raw_record raw = { |
4341 | .size = entry_size, | 4326 | .size = entry_size, |
4342 | .data = record, | 4327 | .data = record, |
4343 | }; | 4328 | }; |
4344 | 4329 | ||
4345 | struct perf_sample_data data = { | 4330 | perf_sample_data_init(&data, addr); |
4346 | .addr = addr, | 4331 | data.raw = &raw; |
4347 | .raw = &raw, | ||
4348 | }; | ||
4349 | |||
4350 | struct pt_regs *regs = get_irq_regs(); | ||
4351 | 4332 | ||
4352 | if (!regs) | 4333 | if (!regs) |
4353 | regs = task_pt_regs(current); | 4334 | regs = task_pt_regs(current); |
@@ -4463,8 +4444,7 @@ void perf_bp_event(struct perf_event *bp, void *data) | |||
4463 | struct perf_sample_data sample; | 4444 | struct perf_sample_data sample; |
4464 | struct pt_regs *regs = data; | 4445 | struct pt_regs *regs = data; |
4465 | 4446 | ||
4466 | sample.raw = NULL; | 4447 | perf_sample_data_init(&sample, bp->attr.bp_addr); |
4467 | sample.addr = bp->attr.bp_addr; | ||
4468 | 4448 | ||
4469 | if (!perf_exclude_event(bp, regs)) | 4449 | if (!perf_exclude_event(bp, regs)) |
4470 | perf_swevent_add(bp, 1, 1, &sample, regs); | 4450 | perf_swevent_add(bp, 1, 1, &sample, regs); |
@@ -5481,13 +5461,16 @@ void __init perf_event_init(void) | |||
5481 | register_cpu_notifier(&perf_cpu_nb); | 5461 | register_cpu_notifier(&perf_cpu_nb); |
5482 | } | 5462 | } |
5483 | 5463 | ||
5484 | static ssize_t perf_show_reserve_percpu(struct sysdev_class *class, char *buf) | 5464 | static ssize_t perf_show_reserve_percpu(struct sysdev_class *class, |
5465 | struct sysdev_class_attribute *attr, | ||
5466 | char *buf) | ||
5485 | { | 5467 | { |
5486 | return sprintf(buf, "%d\n", perf_reserved_percpu); | 5468 | return sprintf(buf, "%d\n", perf_reserved_percpu); |
5487 | } | 5469 | } |
5488 | 5470 | ||
5489 | static ssize_t | 5471 | static ssize_t |
5490 | perf_set_reserve_percpu(struct sysdev_class *class, | 5472 | perf_set_reserve_percpu(struct sysdev_class *class, |
5473 | struct sysdev_class_attribute *attr, | ||
5491 | const char *buf, | 5474 | const char *buf, |
5492 | size_t count) | 5475 | size_t count) |
5493 | { | 5476 | { |
@@ -5516,13 +5499,17 @@ perf_set_reserve_percpu(struct sysdev_class *class, | |||
5516 | return count; | 5499 | return count; |
5517 | } | 5500 | } |
5518 | 5501 | ||
5519 | static ssize_t perf_show_overcommit(struct sysdev_class *class, char *buf) | 5502 | static ssize_t perf_show_overcommit(struct sysdev_class *class, |
5503 | struct sysdev_class_attribute *attr, | ||
5504 | char *buf) | ||
5520 | { | 5505 | { |
5521 | return sprintf(buf, "%d\n", perf_overcommit); | 5506 | return sprintf(buf, "%d\n", perf_overcommit); |
5522 | } | 5507 | } |
5523 | 5508 | ||
5524 | static ssize_t | 5509 | static ssize_t |
5525 | perf_set_overcommit(struct sysdev_class *class, const char *buf, size_t count) | 5510 | perf_set_overcommit(struct sysdev_class *class, |
5511 | struct sysdev_class_attribute *attr, | ||
5512 | const char *buf, size_t count) | ||
5526 | { | 5513 | { |
5527 | unsigned long val; | 5514 | unsigned long val; |
5528 | int err; | 5515 | int err; |