Lines Matching refs:cpuc
105 static void intel_pmu_lbr_filter(struct cpu_hw_events *cpuc);
122 struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
136 if (cpuc->lbr_sel)
137 lbr_select = cpuc->lbr_sel->config & x86_pmu.lbr_sel_mask;
138 if (!static_cpu_has(X86_FEATURE_ARCH_LBR) && !pmi && cpuc->lbr_sel)
191 struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
198 cpuc->last_task_ctx = NULL;
199 cpuc->last_log_id = 0;
200 if (!static_cpu_has(X86_FEATURE_ARCH_LBR) && cpuc->lbr_select)
361 struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
384 if (cpuc->lbr_select)
426 struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
439 if ((ctx == cpuc->last_task_ctx) &&
440 (task_context_opt(ctx)->log_id == cpuc->last_log_id) &&
453 struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
470 if (cpuc->lbr_select)
503 struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
514 cpuc->last_task_ctx = ctx;
515 cpuc->last_log_id = ++task_context_opt(ctx)->log_id;
543 struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
546 if (!cpuc->lbr_users)
580 struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
586 cpuc->lbr_select = 1;
588 cpuc->br_sel = event->hw.branch_reg.reg;
590 if (branch_user_callstack(cpuc->br_sel) && event->pmu_ctx->task_ctx_data)
613 cpuc->lbr_pebs_users++;
615 if (!cpuc->lbr_users++ && !event->total_time_running)
622 struct cpu_hw_events *cpuc;
629 cpuc = per_cpu_ptr(&cpu_hw_events, cpu);
631 if (kmem_cache && cpuc->lbr_xsave) {
632 kmem_cache_free(kmem_cache, cpuc->lbr_xsave);
633 cpuc->lbr_xsave = NULL;
641 struct cpu_hw_events *cpuc;
648 cpuc = per_cpu_ptr(&cpu_hw_events, cpu);
650 if (!kmem_cache || cpuc->lbr_xsave)
653 cpuc->lbr_xsave = kmem_cache_alloc_node(kmem_cache,
661 struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
666 if (branch_user_callstack(cpuc->br_sel) &&
671 cpuc->lbr_select = 0;
674 cpuc->lbr_pebs_users--;
675 cpuc->lbr_users--;
676 WARN_ON_ONCE(cpuc->lbr_users < 0);
677 WARN_ON_ONCE(cpuc->lbr_pebs_users < 0);
683 struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
686 (unsigned long *)&cpuc->intel_ctrl_guest_mask);
691 struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
693 if (cpuc->lbr_users && !vlbr_exclude_host())
699 struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
701 if (cpuc->lbr_users && !vlbr_exclude_host()) {
709 void intel_pmu_lbr_read_32(struct cpu_hw_events *cpuc)
712 struct perf_branch_entry *br = cpuc->lbr_entries;
734 cpuc->lbr_stack.nr = i;
735 cpuc->lbr_stack.hw_idx = tos;
743 void intel_pmu_lbr_read_64(struct cpu_hw_events *cpuc)
747 struct perf_branch_entry *br = cpuc->lbr_entries;
753 if (cpuc->lbr_sel) {
754 need_info = !(cpuc->lbr_sel->config & LBR_NO_INFO);
755 if (cpuc->lbr_sel->config & LBR_CALL_STACK)
829 cpuc->lbr_stack.nr = out;
830 cpuc->lbr_stack.hw_idx = tos;
869 static void intel_pmu_store_lbr(struct cpu_hw_events *cpuc,
879 e = &cpuc->lbr_entries[i];
903 cpuc->lbr_stack.nr = i;
906 static void intel_pmu_arch_lbr_read(struct cpu_hw_events *cpuc)
908 intel_pmu_store_lbr(cpuc, NULL);
911 static void intel_pmu_arch_lbr_read_xsave(struct cpu_hw_events *cpuc)
913 struct x86_perf_task_context_arch_lbr_xsave *xsave = cpuc->lbr_xsave;
916 intel_pmu_store_lbr(cpuc, NULL);
921 intel_pmu_store_lbr(cpuc, xsave->lbr.entries);
926 struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
934 if (!cpuc->lbr_users || vlbr_exclude_host() ||
935 cpuc->lbr_users == cpuc->lbr_pebs_users)
938 x86_pmu.lbr_read(cpuc);
940 intel_pmu_lbr_filter(cpuc);
1123 intel_pmu_lbr_filter(struct cpu_hw_events *cpuc)
1126 int br_sel = cpuc->br_sel;
1135 for (i = 0; i < cpuc->lbr_stack.nr; i++) {
1137 from = cpuc->lbr_entries[i].from;
1138 to = cpuc->lbr_entries[i].to;
1139 type = cpuc->lbr_entries[i].type;
1151 type = branch_type(from, to, cpuc->lbr_entries[i].abort);
1153 if (cpuc->lbr_entries[i].in_tx)
1161 cpuc->lbr_entries[i].from = 0;
1166 cpuc->lbr_entries[i].type = common_branch_type(type);
1173 for (i = 0; i < cpuc->lbr_stack.nr; ) {
1174 if (!cpuc->lbr_entries[i].from) {
1176 while (++j < cpuc->lbr_stack.nr)
1177 cpuc->lbr_entries[j-1] = cpuc->lbr_entries[j];
1178 cpuc->lbr_stack.nr--;
1179 if (!cpuc->lbr_entries[i].from)
1188 struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
1192 (cpuc->n_pebs == cpuc->n_large_pebs))
1193 cpuc->lbr_stack.hw_idx = -1ULL;
1195 cpuc->lbr_stack.hw_idx = intel_pmu_lbr_tos();
1197 intel_pmu_store_lbr(cpuc, lbr);
1198 intel_pmu_lbr_filter(cpuc);