aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/perf_event.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/perf_event.c')
-rw-r--r--kernel/perf_event.c36
1 files changed, 8 insertions, 28 deletions
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index f40560b86544..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 */
57int sysctl_perf_event_paranoid __read_mostly = 1; 57int sysctl_perf_event_paranoid __read_mostly = 1;
58 58
59static inline bool perf_paranoid_tracepoint_raw(void)
60{
61 return sysctl_perf_event_paranoid > -1;
62}
63
64static inline bool perf_paranoid_cpu(void)
65{
66 return sysctl_perf_event_paranoid > 0;
67}
68
69static inline bool perf_paranoid_kernel(void)
70{
71 return sysctl_perf_event_paranoid > 1;
72}
73
74int sysctl_perf_event_mlock __read_mostly = 512; /* 'free' kb per user */ 59int 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 = {
4337void perf_tp_event(int event_id, u64 addr, u64 count, void *record, 4320void 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);