Lines Matching refs:pmu
123 struct pmu *pmu; /* pointer to rapl_pmu_class */ member
129 static struct pmu rapl_pmu_class;
203 static void rapl_start_hrtimer(struct rapl_pmu *pmu) in rapl_start_hrtimer() argument
205 hrtimer_start(&pmu->hrtimer, pmu->timer_interval, in rapl_start_hrtimer()
209 static void rapl_stop_hrtimer(struct rapl_pmu *pmu) in rapl_stop_hrtimer() argument
211 hrtimer_cancel(&pmu->hrtimer); in rapl_stop_hrtimer()
216 struct rapl_pmu *pmu = __this_cpu_read(rapl_pmu); in rapl_hrtimer_handle() local
220 if (!pmu->n_active) in rapl_hrtimer_handle()
223 spin_lock_irqsave(&pmu->lock, flags); in rapl_hrtimer_handle()
225 list_for_each_entry(event, &pmu->active_list, active_entry) { in rapl_hrtimer_handle()
229 spin_unlock_irqrestore(&pmu->lock, flags); in rapl_hrtimer_handle()
231 hrtimer_forward_now(hrtimer, pmu->timer_interval); in rapl_hrtimer_handle()
236 static void rapl_hrtimer_init(struct rapl_pmu *pmu) in rapl_hrtimer_init() argument
238 struct hrtimer *hr = &pmu->hrtimer; in rapl_hrtimer_init()
244 static void __rapl_pmu_event_start(struct rapl_pmu *pmu, in __rapl_pmu_event_start() argument
252 list_add_tail(&event->active_entry, &pmu->active_list); in __rapl_pmu_event_start()
256 pmu->n_active++; in __rapl_pmu_event_start()
257 if (pmu->n_active == 1) in __rapl_pmu_event_start()
258 rapl_start_hrtimer(pmu); in __rapl_pmu_event_start()
263 struct rapl_pmu *pmu = __this_cpu_read(rapl_pmu); in rapl_pmu_event_start() local
266 spin_lock_irqsave(&pmu->lock, flags); in rapl_pmu_event_start()
267 __rapl_pmu_event_start(pmu, event); in rapl_pmu_event_start()
268 spin_unlock_irqrestore(&pmu->lock, flags); in rapl_pmu_event_start()
273 struct rapl_pmu *pmu = __this_cpu_read(rapl_pmu); in rapl_pmu_event_stop() local
277 spin_lock_irqsave(&pmu->lock, flags); in rapl_pmu_event_stop()
281 WARN_ON_ONCE(pmu->n_active <= 0); in rapl_pmu_event_stop()
282 pmu->n_active--; in rapl_pmu_event_stop()
283 if (pmu->n_active == 0) in rapl_pmu_event_stop()
284 rapl_stop_hrtimer(pmu); in rapl_pmu_event_stop()
302 spin_unlock_irqrestore(&pmu->lock, flags); in rapl_pmu_event_stop()
307 struct rapl_pmu *pmu = __this_cpu_read(rapl_pmu); in rapl_pmu_event_add() local
311 spin_lock_irqsave(&pmu->lock, flags); in rapl_pmu_event_add()
316 __rapl_pmu_event_start(pmu, event); in rapl_pmu_event_add()
318 spin_unlock_irqrestore(&pmu->lock, flags); in rapl_pmu_event_add()
522 static struct pmu rapl_pmu_class = {
535 struct rapl_pmu *pmu = per_cpu(rapl_pmu, cpu); in rapl_cpu_exit() local
561 perf_pmu_migrate_context(pmu->pmu, cpu, target); in rapl_cpu_exit()
564 rapl_stop_hrtimer(pmu); in rapl_cpu_exit()
593 struct rapl_pmu *pmu = per_cpu(rapl_pmu, cpu); in rapl_cpu_prepare() local
597 if (pmu) in rapl_cpu_prepare()
603 pmu = kzalloc_node(sizeof(*pmu), GFP_KERNEL, cpu_to_node(cpu)); in rapl_cpu_prepare()
604 if (!pmu) in rapl_cpu_prepare()
606 spin_lock_init(&pmu->lock); in rapl_cpu_prepare()
608 INIT_LIST_HEAD(&pmu->active_list); in rapl_cpu_prepare()
610 pmu->pmu = &rapl_pmu_class; in rapl_cpu_prepare()
624 pmu->timer_interval = ms_to_ktime(ms); in rapl_cpu_prepare()
626 rapl_hrtimer_init(pmu); in rapl_cpu_prepare()
629 per_cpu(rapl_pmu, cpu) = pmu; in rapl_cpu_prepare()
637 struct rapl_pmu *pmu = per_cpu(rapl_pmu_to_free, cpu); in rapl_cpu_kfree() local
639 kfree(pmu); in rapl_cpu_kfree()
646 struct rapl_pmu *pmu = per_cpu(rapl_pmu, cpu); in rapl_cpu_dying() local
648 if (!pmu) in rapl_cpu_dying()
653 per_cpu(rapl_pmu_to_free, cpu) = pmu; in rapl_cpu_dying()
709 struct rapl_pmu *pmu; in rapl_pmu_init() local
777 pmu = __this_cpu_read(rapl_pmu); in rapl_pmu_init()
784 ktime_to_ms(pmu->timer_interval)); in rapl_pmu_init()