Lines Matching refs:event
38 struct perf_event *event; /* Perf event for sampling */ member
95 static void paicrypt_event_destroy_cpu(struct perf_event *event, int cpu) in paicrypt_event_destroy_cpu() argument
102 "refcnt %u\n", __func__, event->attr.config, in paicrypt_event_destroy_cpu()
103 event->cpu, cpump->active_events, in paicrypt_event_destroy_cpu()
111 static void paicrypt_event_destroy(struct perf_event *event) in paicrypt_event_destroy() argument
116 free_page(PAI_SAVE_AREA(event)); in paicrypt_event_destroy()
117 if (event->cpu == -1) { in paicrypt_event_destroy()
118 struct cpumask *mask = PAI_CPU_MASK(event); in paicrypt_event_destroy()
121 paicrypt_event_destroy_cpu(event, cpu); in paicrypt_event_destroy()
124 paicrypt_event_destroy_cpu(event, event->cpu); in paicrypt_event_destroy()
138 static u64 paicrypt_getdata(struct perf_event *event, bool kernel) in paicrypt_getdata() argument
145 if (event->attr.config != PAI_CRYPTO_BASE) { in paicrypt_getdata()
147 event->attr.config - PAI_CRYPTO_BASE, in paicrypt_getdata()
161 static u64 paicrypt_getall(struct perf_event *event) in paicrypt_getall() argument
165 if (!event->attr.exclude_kernel) in paicrypt_getall()
166 sum += paicrypt_getdata(event, true); in paicrypt_getall()
167 if (!event->attr.exclude_user) in paicrypt_getall()
168 sum += paicrypt_getdata(event, false); in paicrypt_getall()
180 static int paicrypt_alloc_cpu(struct perf_event *event, int cpu) in paicrypt_alloc_cpu() argument
232 static int paicrypt_alloc(struct perf_event *event) in paicrypt_alloc() argument
242 rc = paicrypt_alloc_cpu(event, cpu); in paicrypt_alloc()
245 paicrypt_event_destroy_cpu(event, cpu); in paicrypt_alloc()
258 PAI_CPU_MASK(event) = maskptr; in paicrypt_alloc()
265 static int paicrypt_event_init(struct perf_event *event) in paicrypt_event_init() argument
267 struct perf_event_attr *a = &event->attr; in paicrypt_event_init()
271 if (a->type != PERF_TYPE_RAW && event->pmu->type != a->type) in paicrypt_event_init()
282 PAI_SAVE_AREA(event) = get_zeroed_page(GFP_KERNEL); in paicrypt_event_init()
283 if (!PAI_SAVE_AREA(event)) { in paicrypt_event_init()
289 if (event->cpu >= 0) in paicrypt_event_init()
290 rc = paicrypt_alloc_cpu(event, event->cpu); in paicrypt_event_init()
292 rc = paicrypt_alloc(event); in paicrypt_event_init()
294 free_page(PAI_SAVE_AREA(event)); in paicrypt_event_init()
297 event->destroy = paicrypt_event_destroy; in paicrypt_event_init()
303 event->attach_state |= PERF_ATTACH_SCHED_CB; in paicrypt_event_init()
315 static void paicrypt_read(struct perf_event *event) in paicrypt_read() argument
319 prev = local64_read(&event->hw.prev_count); in paicrypt_read()
320 new = paicrypt_getall(event); in paicrypt_read()
321 local64_set(&event->hw.prev_count, new); in paicrypt_read()
324 local64_add(delta, &event->count); in paicrypt_read()
327 static void paicrypt_start(struct perf_event *event, int flags) in paicrypt_start() argument
333 if (!event->attr.sample_period) { /* Counting */ in paicrypt_start()
334 sum = paicrypt_getall(event); /* Get current value */ in paicrypt_start()
335 local64_set(&event->hw.prev_count, sum); in paicrypt_start()
337 memcpy((void *)PAI_SAVE_AREA(event), cpump->page, PAGE_SIZE); in paicrypt_start()
339 if (!(event->attach_state & PERF_ATTACH_TASK)) { in paicrypt_start()
340 list_add_tail(PAI_SWLIST(event), &cpump->syswide_list); in paicrypt_start()
341 perf_sched_cb_inc(event->pmu); in paicrypt_start()
343 cpump->event = event; in paicrypt_start()
348 static int paicrypt_add(struct perf_event *event, int flags) in paicrypt_add() argument
360 paicrypt_start(event, PERF_EF_RELOAD); in paicrypt_add()
361 event->hw.state = 0; in paicrypt_add()
366 static void paicrypt_stop(struct perf_event *event, int flags) in paicrypt_stop() argument
371 if (!event->attr.sample_period) { /* Counting */ in paicrypt_stop()
372 paicrypt_read(event); in paicrypt_stop()
374 if (!(event->attach_state & PERF_ATTACH_TASK)) { in paicrypt_stop()
375 perf_sched_cb_dec(event->pmu); in paicrypt_stop()
376 list_del(PAI_SWLIST(event)); in paicrypt_stop()
378 paicrypt_have_sample(event, cpump); in paicrypt_stop()
379 cpump->event = NULL; in paicrypt_stop()
382 event->hw.state = PERF_HES_STOPPED; in paicrypt_stop()
385 static void paicrypt_del(struct perf_event *event, int flags) in paicrypt_del() argument
390 paicrypt_stop(event, PERF_EF_UPDATE); in paicrypt_del()
435 struct perf_event *event) in paicrypt_push_sample() argument
446 perf_sample_data_init(&data, 0, event->hw.last_period); in paicrypt_push_sample()
447 if (event->attr.sample_type & PERF_SAMPLE_TID) { in paicrypt_push_sample()
451 if (event->attr.sample_type & PERF_SAMPLE_TIME) in paicrypt_push_sample()
452 data.time = event->clock(); in paicrypt_push_sample()
453 if (event->attr.sample_type & (PERF_SAMPLE_ID | PERF_SAMPLE_IDENTIFIER)) in paicrypt_push_sample()
454 data.id = event->id; in paicrypt_push_sample()
455 if (event->attr.sample_type & PERF_SAMPLE_CPU) { in paicrypt_push_sample()
459 if (event->attr.sample_type & PERF_SAMPLE_RAW) { in paicrypt_push_sample()
462 perf_sample_save_raw_data(&data, event, &raw); in paicrypt_push_sample()
465 overflow = perf_event_overflow(event, &data, ®s); in paicrypt_push_sample()
466 perf_event_update_userpage(event); in paicrypt_push_sample()
468 memcpy((void *)PAI_SAVE_AREA(event), cpump->page, PAGE_SIZE); in paicrypt_push_sample()
473 static void paicrypt_have_sample(struct perf_event *event, in paicrypt_have_sample() argument
478 if (!event) /* No event active */ in paicrypt_have_sample()
481 (unsigned long *)PAI_SAVE_AREA(event), in paicrypt_have_sample()
482 event->attr.exclude_user, in paicrypt_have_sample()
483 event->attr.exclude_kernel); in paicrypt_have_sample()
485 paicrypt_push_sample(rawsize, cpump, event); in paicrypt_have_sample()
493 struct perf_event *event; in paicrypt_have_samples() local
495 list_for_each_entry(event, &cpump->syswide_list, hw.tp_list) in paicrypt_have_samples()
496 paicrypt_have_sample(event, cpump); in paicrypt_have_samples()
528 PMU_FORMAT_ATTR(event, "config:0-63");