Lines Matching refs:cpuc
173 static void intel_pmu_lbr_filter(struct cpu_hw_events *cpuc);
190 struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
204 if (cpuc->lbr_sel)
205 lbr_select = cpuc->lbr_sel->config & x86_pmu.lbr_sel_mask;
206 if (!static_cpu_has(X86_FEATURE_ARCH_LBR) && !pmi && cpuc->lbr_sel)
273 struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
280 cpuc->last_task_ctx = NULL;
281 cpuc->last_log_id = 0;
443 struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
465 if (cpuc->lbr_select)
507 struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
520 if ((ctx == cpuc->last_task_ctx) &&
521 (task_context_opt(ctx)->log_id == cpuc->last_log_id) &&
535 struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
551 if (cpuc->lbr_select)
584 struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
595 cpuc->last_task_ctx = ctx;
596 cpuc->last_log_id = ++task_context_opt(ctx)->log_id;
624 struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
627 if (!cpuc->lbr_users)
661 struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
667 cpuc->lbr_select = 1;
669 cpuc->br_sel = event->hw.branch_reg.reg;
671 if (branch_user_callstack(cpuc->br_sel) && event->ctx->task_ctx_data)
694 cpuc->lbr_pebs_users++;
696 if (!cpuc->lbr_users++ && !event->total_time_running)
703 struct cpu_hw_events *cpuc;
710 cpuc = per_cpu_ptr(&cpu_hw_events, cpu);
712 if (kmem_cache && cpuc->lbr_xsave) {
713 kmem_cache_free(kmem_cache, cpuc->lbr_xsave);
714 cpuc->lbr_xsave = NULL;
722 struct cpu_hw_events *cpuc;
729 cpuc = per_cpu_ptr(&cpu_hw_events, cpu);
731 if (!kmem_cache || cpuc->lbr_xsave)
734 cpuc->lbr_xsave = kmem_cache_alloc_node(kmem_cache,
742 struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
747 if (branch_user_callstack(cpuc->br_sel) &&
752 cpuc->lbr_select = 0;
755 cpuc->lbr_pebs_users--;
756 cpuc->lbr_users--;
757 WARN_ON_ONCE(cpuc->lbr_users < 0);
758 WARN_ON_ONCE(cpuc->lbr_pebs_users < 0);
764 struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
767 (unsigned long *)&cpuc->intel_ctrl_guest_mask);
772 struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
774 if (cpuc->lbr_users && !vlbr_exclude_host())
780 struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
782 if (cpuc->lbr_users && !vlbr_exclude_host())
786 void intel_pmu_lbr_read_32(struct cpu_hw_events *cpuc)
804 cpuc->lbr_entries[i].from = msr_lastbranch.from;
805 cpuc->lbr_entries[i].to = msr_lastbranch.to;
806 cpuc->lbr_entries[i].mispred = 0;
807 cpuc->lbr_entries[i].predicted = 0;
808 cpuc->lbr_entries[i].in_tx = 0;
809 cpuc->lbr_entries[i].abort = 0;
810 cpuc->lbr_entries[i].cycles = 0;
811 cpuc->lbr_entries[i].type = 0;
812 cpuc->lbr_entries[i].reserved = 0;
814 cpuc->lbr_stack.nr = i;
815 cpuc->lbr_stack.hw_idx = tos;
823 void intel_pmu_lbr_read_64(struct cpu_hw_events *cpuc)
833 if (cpuc->lbr_sel) {
834 need_info = !(cpuc->lbr_sel->config & LBR_NO_INFO);
835 if (cpuc->lbr_sel->config & LBR_CALL_STACK)
899 cpuc->lbr_entries[out].from = from;
900 cpuc->lbr_entries[out].to = to;
901 cpuc->lbr_entries[out].mispred = mis;
902 cpuc->lbr_entries[out].predicted = pred;
903 cpuc->lbr_entries[out].in_tx = in_tx;
904 cpuc->lbr_entries[out].abort = abort;
905 cpuc->lbr_entries[out].cycles = cycles;
906 cpuc->lbr_entries[out].type = 0;
907 cpuc->lbr_entries[out].reserved = 0;
910 cpuc->lbr_stack.nr = out;
911 cpuc->lbr_stack.hw_idx = tos;
947 static void intel_pmu_store_lbr(struct cpu_hw_events *cpuc,
957 e = &cpuc->lbr_entries[i];
980 cpuc->lbr_stack.nr = i;
983 static void intel_pmu_arch_lbr_read(struct cpu_hw_events *cpuc)
985 intel_pmu_store_lbr(cpuc, NULL);
988 static void intel_pmu_arch_lbr_read_xsave(struct cpu_hw_events *cpuc)
990 struct x86_perf_task_context_arch_lbr_xsave *xsave = cpuc->lbr_xsave;
993 intel_pmu_store_lbr(cpuc, NULL);
998 intel_pmu_store_lbr(cpuc, xsave->lbr.entries);
1003 struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
1011 if (!cpuc->lbr_users || vlbr_exclude_host() ||
1012 cpuc->lbr_users == cpuc->lbr_pebs_users)
1015 x86_pmu.lbr_read(cpuc);
1017 intel_pmu_lbr_filter(cpuc);
1413 intel_pmu_lbr_filter(struct cpu_hw_events *cpuc)
1416 int br_sel = cpuc->br_sel;
1425 for (i = 0; i < cpuc->lbr_stack.nr; i++) {
1427 from = cpuc->lbr_entries[i].from;
1428 to = cpuc->lbr_entries[i].to;
1429 type = cpuc->lbr_entries[i].type;
1441 type = branch_type(from, to, cpuc->lbr_entries[i].abort);
1443 if (cpuc->lbr_entries[i].in_tx)
1451 cpuc->lbr_entries[i].from = 0;
1456 cpuc->lbr_entries[i].type = common_branch_type(type);
1463 for (i = 0; i < cpuc->lbr_stack.nr; ) {
1464 if (!cpuc->lbr_entries[i].from) {
1466 while (++j < cpuc->lbr_stack.nr)
1467 cpuc->lbr_entries[j-1] = cpuc->lbr_entries[j];
1468 cpuc->lbr_stack.nr--;
1469 if (!cpuc->lbr_entries[i].from)
1478 struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
1482 (cpuc->n_pebs == cpuc->n_large_pebs))
1483 cpuc->lbr_stack.hw_idx = -1ULL;
1485 cpuc->lbr_stack.hw_idx = intel_pmu_lbr_tos();
1487 intel_pmu_store_lbr(cpuc, lbr);
1488 intel_pmu_lbr_filter(cpuc);