Lines Matching defs:cpuc

616 	struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
622 if (!test_bit(idx, cpuc->active_mask))
647 struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
652 if (!cpuc->enabled)
655 cpuc->n_added = 0;
656 cpuc->enabled = 0;
664 struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
668 struct hw_perf_event *hwc = &cpuc->events[idx]->hw;
670 if (!test_bit(idx, cpuc->active_mask))
867 int x86_schedule_events(struct cpu_hw_events *cpuc, int n, int *assign)
878 x86_pmu.start_scheduling(cpuc);
881 cpuc->event_constraint[i] = NULL;
882 c = x86_pmu.get_event_constraints(cpuc, i, cpuc->event_list[i]);
883 cpuc->event_constraint[i] = c;
893 hwc = &cpuc->event_list[i]->hw;
894 c = cpuc->event_constraint[i];
927 if (is_ht_workaround_enabled() && !cpuc->is_fake &&
928 READ_ONCE(cpuc->excl_cntrs->exclusive_present))
931 unsched = perf_assign_events(cpuc->event_constraint, n, wmin,
947 e = cpuc->event_list[i];
950 x86_pmu.commit_scheduling(cpuc, i, assign[i]);
954 e = cpuc->event_list[i];
966 x86_pmu.put_event_constraints(cpuc, e);
971 x86_pmu.stop_scheduling(cpuc);
980 static int collect_events(struct cpu_hw_events *cpuc, struct perf_event *leader, bool dogrp)
988 n = cpuc->n_events;
993 cpuc->event_list[n] = leader;
1007 cpuc->event_list[n] = event;
1014 struct cpu_hw_events *cpuc, int i)
1018 hwc->idx = cpuc->assign[i];
1020 hwc->last_tag = ++cpuc->tags[i];
1037 struct cpu_hw_events *cpuc,
1040 return hwc->idx == cpuc->assign[i] &&
1042 hwc->last_tag == cpuc->tags[i];
1049 struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
1052 int i, added = cpuc->n_added;
1057 if (cpuc->enabled)
1060 if (cpuc->n_added) {
1061 int n_running = cpuc->n_events - cpuc->n_added;
1069 event = cpuc->event_list[i];
1079 match_prev_assignment(hwc, cpuc, i))
1095 for (i = 0; i < cpuc->n_events; i++) {
1096 event = cpuc->event_list[i];
1099 if (!match_prev_assignment(hwc, cpuc, i))
1100 x86_assign_hw_event(event, cpuc, i);
1109 cpuc->n_added = 0;
1113 cpuc->enabled = 1;
1203 struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
1210 n0 = cpuc->n_events;
1211 ret = n = collect_events(cpuc, event, false);
1227 if (cpuc->txn_flags & PERF_PMU_TXN_ADD)
1230 ret = x86_pmu.schedule_events(cpuc, n, assign);
1237 memcpy(cpuc->assign, assign, n*sizeof(int));
1244 cpuc->n_events = n;
1245 cpuc->n_added += n - n0;
1246 cpuc->n_txn += n - n0;
1263 struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
1279 cpuc->events[idx] = event;
1280 __set_bit(idx, cpuc->active_mask);
1281 __set_bit(idx, cpuc->running);
1290 struct cpu_hw_events *cpuc;
1300 cpuc = &per_cpu(cpu_hw_events, cpu);
1322 pr_info("CPU#%d: active: %016llx\n", cpu, *(u64 *)cpuc->active_mask);
1348 struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
1351 if (__test_and_clear_bit(hwc->idx, cpuc->active_mask)) {
1353 cpuc->events[hwc->idx] = NULL;
1370 struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
1386 if (cpuc->txn_flags & PERF_PMU_TXN_ADD)
1394 for (i = 0; i < cpuc->n_events; i++) {
1395 if (event == cpuc->event_list[i])
1399 if (WARN_ON_ONCE(i == cpuc->n_events)) /* called ->del() without ->add() ? */
1403 if (i >= cpuc->n_events - cpuc->n_added)
1404 --cpuc->n_added;
1407 x86_pmu.put_event_constraints(cpuc, event);
1410 while (++i < cpuc->n_events) {
1411 cpuc->event_list[i-1] = cpuc->event_list[i];
1412 cpuc->event_constraint[i-1] = cpuc->event_constraint[i];
1414 --cpuc->n_events;
1431 struct cpu_hw_events *cpuc;
1436 cpuc = this_cpu_ptr(&cpu_hw_events);
1449 if (!test_bit(idx, cpuc->active_mask)) {
1455 if (__test_and_clear_bit(idx, cpuc->running))
1460 event = cpuc->events[idx];
1525 struct cpu_hw_events *cpuc = &per_cpu(cpu_hw_events, cpu);
1529 cpuc->kfree_on_online[i] = NULL;
1544 struct cpu_hw_events *cpuc = &per_cpu(cpu_hw_events, cpu);
1548 kfree(cpuc->kfree_on_online[i]);
1549 cpuc->kfree_on_online[i] = NULL;
1906 struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
1908 WARN_ON_ONCE(cpuc->txn_flags); /* txn already in flight */
1910 cpuc->txn_flags = txn_flags;
1926 struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
1928 WARN_ON_ONCE(!cpuc->txn_flags); /* no txn in flight */
1930 txn_flags = cpuc->txn_flags;
1931 cpuc->txn_flags = 0;
1953 struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
1957 WARN_ON_ONCE(!cpuc->txn_flags); /* no txn in flight */
1959 if (cpuc->txn_flags & ~PERF_PMU_TXN_ADD) {
1960 cpuc->txn_flags = 0;
1964 n = cpuc->n_events;
1969 ret = x86_pmu.schedule_events(cpuc, n, assign);
1977 memcpy(cpuc->assign, assign, n*sizeof(int));
1979 cpuc->txn_flags = 0;
1991 static void free_fake_cpuc(struct cpu_hw_events *cpuc)
1993 kfree(cpuc->shared_regs);
1994 kfree(cpuc);
1999 struct cpu_hw_events *cpuc;
2002 cpuc = kzalloc(sizeof(*cpuc), GFP_KERNEL);
2003 if (!cpuc)
2008 cpuc->shared_regs = allocate_shared_regs(cpu);
2009 if (!cpuc->shared_regs)
2012 cpuc->is_fake = 1;
2013 return cpuc;
2015 free_fake_cpuc(cpuc);