Lines Matching refs:pmu

110 	struct pmu		*pmu;  member
116 struct pmu pmu; member
210 static void rapl_start_hrtimer(struct rapl_pmu *pmu) in rapl_start_hrtimer() argument
212 hrtimer_start(&pmu->hrtimer, pmu->timer_interval, in rapl_start_hrtimer()
218 struct rapl_pmu *pmu = container_of(hrtimer, struct rapl_pmu, hrtimer); in rapl_hrtimer_handle() local
222 if (!pmu->n_active) in rapl_hrtimer_handle()
225 raw_spin_lock_irqsave(&pmu->lock, flags); in rapl_hrtimer_handle()
227 list_for_each_entry(event, &pmu->active_list, active_entry) in rapl_hrtimer_handle()
230 raw_spin_unlock_irqrestore(&pmu->lock, flags); in rapl_hrtimer_handle()
232 hrtimer_forward_now(hrtimer, pmu->timer_interval); in rapl_hrtimer_handle()
237 static void rapl_hrtimer_init(struct rapl_pmu *pmu) in rapl_hrtimer_init() argument
239 struct hrtimer *hr = &pmu->hrtimer; in rapl_hrtimer_init()
245 static void __rapl_pmu_event_start(struct rapl_pmu *pmu, in __rapl_pmu_event_start() argument
253 list_add_tail(&event->active_entry, &pmu->active_list); in __rapl_pmu_event_start()
257 pmu->n_active++; in __rapl_pmu_event_start()
258 if (pmu->n_active == 1) in __rapl_pmu_event_start()
259 rapl_start_hrtimer(pmu); in __rapl_pmu_event_start()
264 struct rapl_pmu *pmu = event->pmu_private; in rapl_pmu_event_start() local
267 raw_spin_lock_irqsave(&pmu->lock, flags); in rapl_pmu_event_start()
268 __rapl_pmu_event_start(pmu, event); in rapl_pmu_event_start()
269 raw_spin_unlock_irqrestore(&pmu->lock, flags); in rapl_pmu_event_start()
274 struct rapl_pmu *pmu = event->pmu_private; in rapl_pmu_event_stop() local
278 raw_spin_lock_irqsave(&pmu->lock, flags); in rapl_pmu_event_stop()
282 WARN_ON_ONCE(pmu->n_active <= 0); in rapl_pmu_event_stop()
283 pmu->n_active--; in rapl_pmu_event_stop()
284 if (pmu->n_active == 0) in rapl_pmu_event_stop()
285 hrtimer_cancel(&pmu->hrtimer); in rapl_pmu_event_stop()
303 raw_spin_unlock_irqrestore(&pmu->lock, flags); in rapl_pmu_event_stop()
308 struct rapl_pmu *pmu = event->pmu_private; in rapl_pmu_event_add() local
312 raw_spin_lock_irqsave(&pmu->lock, flags); in rapl_pmu_event_add()
317 __rapl_pmu_event_start(pmu, event); in rapl_pmu_event_add()
319 raw_spin_unlock_irqrestore(&pmu->lock, flags); in rapl_pmu_event_add()
333 struct rapl_pmu *pmu; in rapl_pmu_event_init() local
336 if (event->attr.type != rapl_pmus->pmu.type) in rapl_pmu_event_init()
363 pmu = cpu_to_rapl_pmu(event->cpu); in rapl_pmu_event_init()
364 if (!pmu) in rapl_pmu_event_init()
366 event->cpu = pmu->cpu; in rapl_pmu_event_init()
367 event->pmu_private = pmu; in rapl_pmu_event_init()
549 struct rapl_pmu *pmu = cpu_to_rapl_pmu(cpu); in rapl_cpu_offline() local
556 pmu->cpu = -1; in rapl_cpu_offline()
563 pmu->cpu = target; in rapl_cpu_offline()
564 perf_pmu_migrate_context(pmu->pmu, cpu, target); in rapl_cpu_offline()
571 struct rapl_pmu *pmu = cpu_to_rapl_pmu(cpu); in rapl_cpu_online() local
574 if (!pmu) { in rapl_cpu_online()
575 pmu = kzalloc_node(sizeof(*pmu), GFP_KERNEL, cpu_to_node(cpu)); in rapl_cpu_online()
576 if (!pmu) in rapl_cpu_online()
579 raw_spin_lock_init(&pmu->lock); in rapl_cpu_online()
580 INIT_LIST_HEAD(&pmu->active_list); in rapl_cpu_online()
581 pmu->pmu = &rapl_pmus->pmu; in rapl_cpu_online()
582 pmu->timer_interval = ms_to_ktime(rapl_timer_ms); in rapl_cpu_online()
583 rapl_hrtimer_init(pmu); in rapl_cpu_online()
585 rapl_pmus->pmus[topology_logical_die_id(cpu)] = pmu; in rapl_cpu_online()
597 pmu->cpu = cpu; in rapl_cpu_online()
690 rapl_pmus->pmu.attr_groups = rapl_attr_groups; in init_rapl_pmus()
691 rapl_pmus->pmu.attr_update = rapl_attr_update; in init_rapl_pmus()
692 rapl_pmus->pmu.task_ctx_nr = perf_invalid_context; in init_rapl_pmus()
693 rapl_pmus->pmu.event_init = rapl_pmu_event_init; in init_rapl_pmus()
694 rapl_pmus->pmu.add = rapl_pmu_event_add; in init_rapl_pmus()
695 rapl_pmus->pmu.del = rapl_pmu_event_del; in init_rapl_pmus()
696 rapl_pmus->pmu.start = rapl_pmu_event_start; in init_rapl_pmus()
697 rapl_pmus->pmu.stop = rapl_pmu_event_stop; in init_rapl_pmus()
698 rapl_pmus->pmu.read = rapl_pmu_event_read; in init_rapl_pmus()
699 rapl_pmus->pmu.module = THIS_MODULE; in init_rapl_pmus()
700 rapl_pmus->pmu.capabilities = PERF_PMU_CAP_NO_EXCLUDE; in init_rapl_pmus()
853 ret = perf_pmu_register(&rapl_pmus->pmu, "power", -1); in rapl_pmu_init()
872 perf_pmu_unregister(&rapl_pmus->pmu); in intel_rapl_exit()