Lines Matching refs:pmu
124 struct pmu *pmu; member
130 struct pmu pmu; member
235 static void rapl_start_hrtimer(struct rapl_pmu *pmu) in rapl_start_hrtimer() argument
237 hrtimer_start(&pmu->hrtimer, pmu->timer_interval, in rapl_start_hrtimer()
243 struct rapl_pmu *pmu = container_of(hrtimer, struct rapl_pmu, hrtimer); in rapl_hrtimer_handle() local
247 if (!pmu->n_active) in rapl_hrtimer_handle()
250 raw_spin_lock_irqsave(&pmu->lock, flags); in rapl_hrtimer_handle()
252 list_for_each_entry(event, &pmu->active_list, active_entry) in rapl_hrtimer_handle()
255 raw_spin_unlock_irqrestore(&pmu->lock, flags); in rapl_hrtimer_handle()
257 hrtimer_forward_now(hrtimer, pmu->timer_interval); in rapl_hrtimer_handle()
262 static void rapl_hrtimer_init(struct rapl_pmu *pmu) in rapl_hrtimer_init() argument
264 struct hrtimer *hr = &pmu->hrtimer; in rapl_hrtimer_init()
270 static void __rapl_pmu_event_start(struct rapl_pmu *pmu, in __rapl_pmu_event_start() argument
278 list_add_tail(&event->active_entry, &pmu->active_list); in __rapl_pmu_event_start()
282 pmu->n_active++; in __rapl_pmu_event_start()
283 if (pmu->n_active == 1) in __rapl_pmu_event_start()
284 rapl_start_hrtimer(pmu); in __rapl_pmu_event_start()
289 struct rapl_pmu *pmu = event->pmu_private; in rapl_pmu_event_start() local
292 raw_spin_lock_irqsave(&pmu->lock, flags); in rapl_pmu_event_start()
293 __rapl_pmu_event_start(pmu, event); in rapl_pmu_event_start()
294 raw_spin_unlock_irqrestore(&pmu->lock, flags); in rapl_pmu_event_start()
299 struct rapl_pmu *pmu = event->pmu_private; in rapl_pmu_event_stop() local
303 raw_spin_lock_irqsave(&pmu->lock, flags); in rapl_pmu_event_stop()
307 WARN_ON_ONCE(pmu->n_active <= 0); in rapl_pmu_event_stop()
308 pmu->n_active--; in rapl_pmu_event_stop()
309 if (pmu->n_active == 0) in rapl_pmu_event_stop()
310 hrtimer_cancel(&pmu->hrtimer); in rapl_pmu_event_stop()
328 raw_spin_unlock_irqrestore(&pmu->lock, flags); in rapl_pmu_event_stop()
333 struct rapl_pmu *pmu = event->pmu_private; in rapl_pmu_event_add() local
337 raw_spin_lock_irqsave(&pmu->lock, flags); in rapl_pmu_event_add()
342 __rapl_pmu_event_start(pmu, event); in rapl_pmu_event_add()
344 raw_spin_unlock_irqrestore(&pmu->lock, flags); in rapl_pmu_event_add()
358 struct rapl_pmu *pmu; in rapl_pmu_event_init() local
361 if (event->attr.type != rapl_pmus->pmu.type) in rapl_pmu_event_init()
386 pmu = cpu_to_rapl_pmu(event->cpu); in rapl_pmu_event_init()
387 if (!pmu) in rapl_pmu_event_init()
389 event->pmu_private = pmu; in rapl_pmu_event_init()
631 struct rapl_pmu *pmu; in init_rapl_pmu() local
635 pmu = kzalloc(sizeof(*pmu), GFP_KERNEL); in init_rapl_pmu()
636 if (!pmu) in init_rapl_pmu()
639 raw_spin_lock_init(&pmu->lock); in init_rapl_pmu()
640 INIT_LIST_HEAD(&pmu->active_list); in init_rapl_pmu()
641 pmu->pmu = &rapl_pmus->pmu; in init_rapl_pmu()
642 pmu->timer_interval = ms_to_ktime(rapl_timer_ms); in init_rapl_pmu()
643 rapl_hrtimer_init(pmu); in init_rapl_pmu()
645 rapl_pmus->pmus[idx] = pmu; in init_rapl_pmu()
670 rapl_pmus->pmu.attr_groups = rapl_attr_groups; in init_rapl_pmus()
671 rapl_pmus->pmu.attr_update = rapl_attr_update; in init_rapl_pmus()
672 rapl_pmus->pmu.task_ctx_nr = perf_invalid_context; in init_rapl_pmus()
673 rapl_pmus->pmu.event_init = rapl_pmu_event_init; in init_rapl_pmus()
674 rapl_pmus->pmu.add = rapl_pmu_event_add; in init_rapl_pmus()
675 rapl_pmus->pmu.del = rapl_pmu_event_del; in init_rapl_pmus()
676 rapl_pmus->pmu.start = rapl_pmu_event_start; in init_rapl_pmus()
677 rapl_pmus->pmu.stop = rapl_pmu_event_stop; in init_rapl_pmus()
678 rapl_pmus->pmu.read = rapl_pmu_event_read; in init_rapl_pmus()
679 rapl_pmus->pmu.scope = rapl_pmu_scope; in init_rapl_pmus()
680 rapl_pmus->pmu.module = THIS_MODULE; in init_rapl_pmus()
681 rapl_pmus->pmu.capabilities = PERF_PMU_CAP_NO_EXCLUDE; in init_rapl_pmus()
829 ret = perf_pmu_register(&rapl_pmus->pmu, "power", -1); in rapl_pmu_init()
845 perf_pmu_unregister(&rapl_pmus->pmu); in intel_rapl_exit()