Lines Matching full:pmu
53 #define pr_fmt(fmt) "RAPL PMU: " fmt
119 struct pmu *pmu; member
125 struct pmu pmu; member
211 static void rapl_start_hrtimer(struct rapl_pmu *pmu) in rapl_start_hrtimer() argument
213 hrtimer_start(&pmu->hrtimer, pmu->timer_interval, in rapl_start_hrtimer()
219 struct rapl_pmu *pmu = container_of(hrtimer, struct rapl_pmu, hrtimer); in rapl_hrtimer_handle() local
223 if (!pmu->n_active) in rapl_hrtimer_handle()
226 raw_spin_lock_irqsave(&pmu->lock, flags); in rapl_hrtimer_handle()
228 list_for_each_entry(event, &pmu->active_list, active_entry) in rapl_hrtimer_handle()
231 raw_spin_unlock_irqrestore(&pmu->lock, flags); in rapl_hrtimer_handle()
233 hrtimer_forward_now(hrtimer, pmu->timer_interval); in rapl_hrtimer_handle()
238 static void rapl_hrtimer_init(struct rapl_pmu *pmu) in rapl_hrtimer_init() argument
240 struct hrtimer *hr = &pmu->hrtimer; in rapl_hrtimer_init()
246 static void __rapl_pmu_event_start(struct rapl_pmu *pmu, in __rapl_pmu_event_start() argument
254 list_add_tail(&event->active_entry, &pmu->active_list); in __rapl_pmu_event_start()
258 pmu->n_active++; in __rapl_pmu_event_start()
259 if (pmu->n_active == 1) in __rapl_pmu_event_start()
260 rapl_start_hrtimer(pmu); in __rapl_pmu_event_start()
265 struct rapl_pmu *pmu = event->pmu_private; in rapl_pmu_event_start() local
268 raw_spin_lock_irqsave(&pmu->lock, flags); in rapl_pmu_event_start()
269 __rapl_pmu_event_start(pmu, event); in rapl_pmu_event_start()
270 raw_spin_unlock_irqrestore(&pmu->lock, flags); in rapl_pmu_event_start()
275 struct rapl_pmu *pmu = event->pmu_private; in rapl_pmu_event_stop() local
279 raw_spin_lock_irqsave(&pmu->lock, flags); in rapl_pmu_event_stop()
283 WARN_ON_ONCE(pmu->n_active <= 0); in rapl_pmu_event_stop()
284 pmu->n_active--; in rapl_pmu_event_stop()
285 if (pmu->n_active == 0) in rapl_pmu_event_stop()
286 hrtimer_cancel(&pmu->hrtimer); in rapl_pmu_event_stop()
304 raw_spin_unlock_irqrestore(&pmu->lock, flags); in rapl_pmu_event_stop()
309 struct rapl_pmu *pmu = event->pmu_private; in rapl_pmu_event_add() local
313 raw_spin_lock_irqsave(&pmu->lock, flags); in rapl_pmu_event_add()
318 __rapl_pmu_event_start(pmu, event); in rapl_pmu_event_add()
320 raw_spin_unlock_irqrestore(&pmu->lock, flags); in rapl_pmu_event_add()
334 struct rapl_pmu *pmu; in rapl_pmu_event_init() local
337 if (event->attr.type != rapl_pmus->pmu.type) in rapl_pmu_event_init()
364 pmu = cpu_to_rapl_pmu(event->cpu); in rapl_pmu_event_init()
365 if (!pmu) in rapl_pmu_event_init()
367 event->cpu = pmu->cpu; in rapl_pmu_event_init()
368 event->pmu_private = pmu; in rapl_pmu_event_init()
526 struct rapl_pmu *pmu = cpu_to_rapl_pmu(cpu); in rapl_cpu_offline() local
533 pmu->cpu = -1; in rapl_cpu_offline()
540 pmu->cpu = target; in rapl_cpu_offline()
541 perf_pmu_migrate_context(pmu->pmu, cpu, target); in rapl_cpu_offline()
548 struct rapl_pmu *pmu = cpu_to_rapl_pmu(cpu); in rapl_cpu_online() local
551 if (!pmu) { in rapl_cpu_online()
552 pmu = kzalloc_node(sizeof(*pmu), GFP_KERNEL, cpu_to_node(cpu)); in rapl_cpu_online()
553 if (!pmu) in rapl_cpu_online()
556 raw_spin_lock_init(&pmu->lock); in rapl_cpu_online()
557 INIT_LIST_HEAD(&pmu->active_list); in rapl_cpu_online()
558 pmu->pmu = &rapl_pmus->pmu; in rapl_cpu_online()
559 pmu->timer_interval = ms_to_ktime(rapl_timer_ms); in rapl_cpu_online()
560 rapl_hrtimer_init(pmu); in rapl_cpu_online()
562 rapl_pmus->pmus[topology_logical_die_id(cpu)] = pmu; in rapl_cpu_online()
574 pmu->cpu = cpu; in rapl_cpu_online()
657 rapl_pmus->pmu.attr_groups = rapl_attr_groups; in init_rapl_pmus()
658 rapl_pmus->pmu.attr_update = rapl_attr_update; in init_rapl_pmus()
659 rapl_pmus->pmu.task_ctx_nr = perf_invalid_context; in init_rapl_pmus()
660 rapl_pmus->pmu.event_init = rapl_pmu_event_init; in init_rapl_pmus()
661 rapl_pmus->pmu.add = rapl_pmu_event_add; in init_rapl_pmus()
662 rapl_pmus->pmu.del = rapl_pmu_event_del; in init_rapl_pmus()
663 rapl_pmus->pmu.start = rapl_pmu_event_start; in init_rapl_pmus()
664 rapl_pmus->pmu.stop = rapl_pmu_event_stop; in init_rapl_pmus()
665 rapl_pmus->pmu.read = rapl_pmu_event_read; in init_rapl_pmus()
666 rapl_pmus->pmu.module = THIS_MODULE; in init_rapl_pmus()
667 rapl_pmus->pmu.capabilities = PERF_PMU_CAP_NO_EXCLUDE; in init_rapl_pmus()
780 ret = perf_pmu_register(&rapl_pmus->pmu, "power", -1); in rapl_pmu_init()
799 perf_pmu_unregister(&rapl_pmus->pmu); in intel_rapl_exit()