Lines Matching refs:cpuc

566 	struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
569 if (!cpuc->ds)
583 struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
584 struct debug_store *ds = cpuc->ds;
590 struct perf_event *event = cpuc->events[INTEL_PMC_IDX_FIXED_BTS];
909 static inline bool pebs_needs_sched_cb(struct cpu_hw_events *cpuc)
911 if (cpuc->n_pebs == cpuc->n_pebs_via_pt)
914 return cpuc->n_pebs && (cpuc->n_pebs == cpuc->n_large_pebs);
919 struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
921 if (!sched_in && pebs_needs_sched_cb(cpuc))
925 static inline void pebs_update_threshold(struct cpu_hw_events *cpuc)
927 struct debug_store *ds = cpuc->ds;
931 if (cpuc->n_pebs_via_pt)
939 if (cpuc->n_pebs == cpuc->n_large_pebs) {
941 reserved * cpuc->pebs_record_size;
943 threshold = ds->pebs_buffer_base + cpuc->pebs_record_size;
951 struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
952 u64 pebs_data_cfg = cpuc->pebs_data_cfg;
964 cpuc->pebs_record_size = sz;
1018 pebs_update_state(bool needed_cb, struct cpu_hw_events *cpuc,
1027 bool update = cpuc->n_pebs == 1;
1029 if (needed_cb != pebs_needs_sched_cb(cpuc)) {
1046 if (cpuc->n_pebs == 1) {
1047 cpuc->pebs_data_cfg = 0;
1048 cpuc->pebs_record_size = sizeof(struct pebs_basic);
1054 if (pebs_data_cfg & ~cpuc->pebs_data_cfg) {
1055 cpuc->pebs_data_cfg |= pebs_data_cfg;
1062 pebs_update_threshold(cpuc);
1067 struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
1069 bool needed_cb = pebs_needs_sched_cb(cpuc);
1071 cpuc->n_pebs++;
1073 cpuc->n_large_pebs++;
1075 cpuc->n_pebs_via_pt++;
1077 pebs_update_state(needed_cb, cpuc, event, true);
1082 struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
1087 if (!(cpuc->pebs_enabled & ~PEBS_VIA_PT_MASK))
1088 cpuc->pebs_enabled &= ~PEBS_VIA_PT_MASK;
1093 struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
1095 struct debug_store *ds = cpuc->ds;
1101 cpuc->pebs_enabled |= PEBS_PMI_AFTER_EACH_RECORD;
1103 cpuc->pebs_enabled |= PEBS_OUTPUT_PT;
1110 struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
1112 struct debug_store *ds = cpuc->ds;
1116 cpuc->pebs_enabled |= 1ULL << hwc->idx;
1119 cpuc->pebs_enabled |= 1ULL << (hwc->idx + 32);
1121 cpuc->pebs_enabled |= 1ULL << 63;
1125 if (cpuc->pebs_data_cfg != cpuc->active_pebs_data_cfg) {
1126 wrmsrl(MSR_PEBS_DATA_CFG, cpuc->pebs_data_cfg);
1127 cpuc->active_pebs_data_cfg = cpuc->pebs_data_cfg;
1151 struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
1153 bool needed_cb = pebs_needs_sched_cb(cpuc);
1155 cpuc->n_pebs--;
1157 cpuc->n_large_pebs--;
1159 cpuc->n_pebs_via_pt--;
1161 pebs_update_state(needed_cb, cpuc, event, false);
1166 struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
1169 if (cpuc->n_pebs == cpuc->n_large_pebs &&
1170 cpuc->n_pebs != cpuc->n_pebs_via_pt)
1173 cpuc->pebs_enabled &= ~(1ULL << hwc->idx);
1177 cpuc->pebs_enabled &= ~(1ULL << (hwc->idx + 32));
1179 cpuc->pebs_enabled &= ~(1ULL << 63);
1183 if (cpuc->enabled)
1184 wrmsrl(MSR_IA32_PEBS_ENABLE, cpuc->pebs_enabled);
1191 struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
1193 if (cpuc->pebs_enabled)
1194 wrmsrl(MSR_IA32_PEBS_ENABLE, cpuc->pebs_enabled);
1199 struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
1201 if (cpuc->pebs_enabled)
1207 struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
1208 unsigned long from = cpuc->lbr_entries[0].from;
1209 unsigned long old_to, to = cpuc->lbr_entries[0].to;
1224 if (!cpuc->lbr_stack.nr || !from || !to)
1354 struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
1484 data->br_stack = &cpuc->lbr_stack;
1519 struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
1610 data->br_stack = &cpuc->lbr_stack;
1624 struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
1638 for (at = base; at < top; at += cpuc->pebs_record_size) {
1650 pebs_status = status & cpuc->pebs_enabled;
1741 struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
1765 at += cpuc->pebs_record_size;
1791 struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
1792 struct debug_store *ds = cpuc->ds;
1793 struct perf_event *event = cpuc->events[0]; /* PMC0 only */
1808 if (!test_bit(0, cpuc->active_mask))
1827 static void intel_pmu_pebs_event_update_no_drain(struct cpu_hw_events *cpuc, int size)
1839 for_each_set_bit(bit, (unsigned long *)&cpuc->pebs_enabled, size) {
1840 event = cpuc->events[bit];
1848 struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
1849 struct debug_store *ds = cpuc->ds;
1873 intel_pmu_pebs_event_update_no_drain(cpuc, size);
1881 pebs_status = p->status & cpuc->pebs_enabled;
1900 if (!pebs_status && cpuc->pebs_enabled &&
1901 !(cpuc->pebs_enabled & (cpuc->pebs_enabled-1)))
1902 pebs_status = p->status = cpuc->pebs_enabled;
1937 event = cpuc->events[bit];
1963 struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
1964 struct debug_store *ds = cpuc->ds;
1983 intel_pmu_pebs_event_update_no_drain(cpuc, size);
1987 for (at = base; at < top; at += cpuc->pebs_record_size) {
1990 pebs_status = get_pebs_status(at) & cpuc->pebs_enabled;
2001 event = cpuc->events[bit];