Lines Matching refs:event
52 struct perf_event *event; /* Perf event for sampling */ member
120 static void paiext_event_destroy_cpu(struct perf_event *event, int cpu) in paiext_event_destroy_cpu() argument
132 static void paiext_event_destroy(struct perf_event *event) in paiext_event_destroy() argument
136 free_page(PAI_SAVE_AREA(event)); in paiext_event_destroy()
137 if (event->cpu == -1) { in paiext_event_destroy()
138 struct cpumask *mask = PAI_CPU_MASK(event); in paiext_event_destroy()
141 paiext_event_destroy_cpu(event, cpu); in paiext_event_destroy()
144 paiext_event_destroy_cpu(event, event->cpu); in paiext_event_destroy()
147 event->cpu); in paiext_event_destroy()
164 static int paiext_alloc_cpu(struct perf_event *event, int cpu) in paiext_alloc_cpu() argument
224 static int paiext_alloc(struct perf_event *event) in paiext_alloc() argument
234 rc = paiext_alloc_cpu(event, cpu); in paiext_alloc()
237 paiext_event_destroy_cpu(event, cpu); in paiext_alloc()
250 PAI_CPU_MASK(event) = maskptr; in paiext_alloc()
260 static int paiext_event_valid(struct perf_event *event) in paiext_event_valid() argument
262 u64 cfg = event->attr.config; in paiext_event_valid()
266 event->hw.config_base = offsetof(struct paiext_cb, acc); in paiext_event_valid()
273 static int paiext_event_init(struct perf_event *event) in paiext_event_init() argument
275 struct perf_event_attr *a = &event->attr; in paiext_event_init()
279 if (a->type != PERF_TYPE_RAW && event->pmu->type != a->type) in paiext_event_init()
282 rc = paiext_event_valid(event); in paiext_event_init()
293 PAI_SAVE_AREA(event) = get_zeroed_page(GFP_KERNEL); in paiext_event_init()
294 if (!PAI_SAVE_AREA(event)) in paiext_event_init()
298 if (event->cpu >= 0) in paiext_event_init()
299 rc = paiext_alloc_cpu(event, event->cpu); in paiext_event_init()
301 rc = paiext_alloc(event); in paiext_event_init()
303 free_page(PAI_SAVE_AREA(event)); in paiext_event_init()
306 event->destroy = paiext_event_destroy; in paiext_event_init()
312 event->attach_state |= PERF_ATTACH_SCHED_CB; in paiext_event_init()
330 static u64 paiext_getdata(struct perf_event *event) in paiext_getdata() argument
337 if (event->attr.config != PAI_NNPA_BASE) in paiext_getdata()
339 event->attr.config - PAI_NNPA_BASE); in paiext_getdata()
347 static u64 paiext_getall(struct perf_event *event) in paiext_getall() argument
349 return paiext_getdata(event); in paiext_getall()
352 static void paiext_read(struct perf_event *event) in paiext_read() argument
356 prev = local64_read(&event->hw.prev_count); in paiext_read()
357 new = paiext_getall(event); in paiext_read()
358 local64_set(&event->hw.prev_count, new); in paiext_read()
360 local64_add(delta, &event->count); in paiext_read()
363 static void paiext_start(struct perf_event *event, int flags) in paiext_start() argument
369 if (!event->attr.sample_period) { /* Counting */ in paiext_start()
370 sum = paiext_getall(event); /* Get current value */ in paiext_start()
371 local64_set(&event->hw.prev_count, sum); in paiext_start()
373 memcpy((void *)PAI_SAVE_AREA(event), cpump->area, in paiext_start()
376 if (!(event->attach_state & PERF_ATTACH_TASK)) { in paiext_start()
377 list_add_tail(PAI_SWLIST(event), &cpump->syswide_list); in paiext_start()
378 perf_sched_cb_inc(event->pmu); in paiext_start()
380 cpump->event = event; in paiext_start()
385 static int paiext_add(struct perf_event *event, int flags) in paiext_add() argument
398 paiext_start(event, PERF_EF_RELOAD); in paiext_add()
399 event->hw.state = 0; in paiext_add()
404 static void paiext_stop(struct perf_event *event, int flags) in paiext_stop() argument
409 if (!event->attr.sample_period) { /* Counting */ in paiext_stop()
410 paiext_read(event); in paiext_stop()
412 if (!(event->attach_state & PERF_ATTACH_TASK)) { in paiext_stop()
413 list_del(PAI_SWLIST(event)); in paiext_stop()
414 perf_sched_cb_dec(event->pmu); in paiext_stop()
416 paiext_have_sample(event, cpump); in paiext_stop()
417 cpump->event = NULL; in paiext_stop()
420 event->hw.state = PERF_HES_STOPPED; in paiext_stop()
423 static void paiext_del(struct perf_event *event, int flags) in paiext_del() argument
429 paiext_stop(event, PERF_EF_UPDATE); in paiext_del()
481 struct perf_event *event) in paiext_push_sample() argument
492 perf_sample_data_init(&data, 0, event->hw.last_period); in paiext_push_sample()
493 if (event->attr.sample_type & PERF_SAMPLE_TID) { in paiext_push_sample()
497 if (event->attr.sample_type & PERF_SAMPLE_TIME) in paiext_push_sample()
498 data.time = event->clock(); in paiext_push_sample()
499 if (event->attr.sample_type & (PERF_SAMPLE_ID | PERF_SAMPLE_IDENTIFIER)) in paiext_push_sample()
500 data.id = event->id; in paiext_push_sample()
501 if (event->attr.sample_type & PERF_SAMPLE_CPU) in paiext_push_sample()
503 if (event->attr.sample_type & PERF_SAMPLE_RAW) { in paiext_push_sample()
509 overflow = perf_event_overflow(event, &data, ®s); in paiext_push_sample()
510 perf_event_update_userpage(event); in paiext_push_sample()
512 memcpy((void *)PAI_SAVE_AREA(event), cpump->area, in paiext_push_sample()
518 static void paiext_have_sample(struct perf_event *event, in paiext_have_sample() argument
523 if (!event) in paiext_have_sample()
526 (unsigned long *)PAI_SAVE_AREA(event)); in paiext_have_sample()
528 paiext_push_sample(rawsize, cpump, event); in paiext_have_sample()
536 struct perf_event *event; in paiext_have_samples() local
538 list_for_each_entry(event, &cpump->syswide_list, hw.tp_list) in paiext_have_samples()
539 paiext_have_sample(event, cpump); in paiext_have_samples()
572 PMU_FORMAT_ATTR(event, "config:0-63");