Lines Matching refs:spe

79 	struct arm_spe			*spe;  member
95 static void arm_spe_dump(struct arm_spe *spe __maybe_unused, in arm_spe_dump()
134 static void arm_spe_dump_event(struct arm_spe *spe, unsigned char *buf, in arm_spe_dump_event() argument
138 arm_spe_dump(spe, buf, len); in arm_spe_dump_event()
148 queue = &speq->spe->queues.queue_array[speq->queue_nr]; in arm_spe_get_trace()
164 int fd = perf_data__fd(speq->spe->session->data); in arm_spe_get_trace()
186 static struct arm_spe_queue *arm_spe__alloc_queue(struct arm_spe *spe, in arm_spe__alloc_queue() argument
200 speq->spe = spe; in arm_spe__alloc_queue()
224 static inline u8 arm_spe_cpumode(struct arm_spe *spe, u64 ip) in arm_spe_cpumode() argument
226 return ip >= spe->kernel_start ? in arm_spe_cpumode()
231 static void arm_spe_set_pid_tid_cpu(struct arm_spe *spe, in arm_spe_set_pid_tid_cpu() argument
237 tid = machine__get_current_tid(spe->machine, speq->cpu); in arm_spe_set_pid_tid_cpu()
245 speq->thread = machine__find_thread(spe->machine, -1, in arm_spe_set_pid_tid_cpu()
258 struct arm_spe *spe = speq->spe; in arm_spe_set_tid() local
259 int err = machine__set_current_tid(spe->machine, speq->cpu, -1, tid); in arm_spe_set_tid()
264 arm_spe_set_pid_tid_cpu(spe, &spe->queues.queue_array[speq->queue_nr]); in arm_spe_set_tid()
269 static void arm_spe_prep_sample(struct arm_spe *spe, in arm_spe_prep_sample() argument
276 if (!spe->timeless_decoding) in arm_spe_prep_sample()
277 sample->time = tsc_to_perf_time(record->timestamp, &spe->tc); in arm_spe_prep_sample()
280 sample->cpumode = arm_spe_cpumode(spe, sample->ip); in arm_spe_prep_sample()
298 arm_spe_deliver_synth_event(struct arm_spe *spe, in arm_spe_deliver_synth_event() argument
305 if (spe->synth_opts.inject) { in arm_spe_deliver_synth_event()
306 ret = arm_spe__inject_event(event, sample, spe->sample_type); in arm_spe_deliver_synth_event()
311 ret = perf_session__deliver_synth_event(spe->session, event, sample); in arm_spe_deliver_synth_event()
321 struct arm_spe *spe = speq->spe; in arm_spe__synth_mem_sample() local
326 arm_spe_prep_sample(spe, speq, event, &sample); in arm_spe__synth_mem_sample()
334 return arm_spe_deliver_synth_event(spe, speq, event, &sample); in arm_spe__synth_mem_sample()
340 struct arm_spe *spe = speq->spe; in arm_spe__synth_branch_sample() local
345 arm_spe_prep_sample(spe, speq, event, &sample); in arm_spe__synth_branch_sample()
351 return arm_spe_deliver_synth_event(spe, speq, event, &sample); in arm_spe__synth_branch_sample()
409 struct arm_spe *spe = speq->spe; in arm_spe_sample() local
415 if (spe->sample_flc) { in arm_spe_sample()
417 err = arm_spe__synth_mem_sample(speq, spe->l1d_miss_id, in arm_spe_sample()
424 err = arm_spe__synth_mem_sample(speq, spe->l1d_access_id, in arm_spe_sample()
431 if (spe->sample_llc) { in arm_spe_sample()
433 err = arm_spe__synth_mem_sample(speq, spe->llc_miss_id, in arm_spe_sample()
440 err = arm_spe__synth_mem_sample(speq, spe->llc_access_id, in arm_spe_sample()
447 if (spe->sample_tlb) { in arm_spe_sample()
449 err = arm_spe__synth_mem_sample(speq, spe->tlb_miss_id, in arm_spe_sample()
456 err = arm_spe__synth_mem_sample(speq, spe->tlb_access_id, in arm_spe_sample()
463 if (spe->sample_branch && (record->type & ARM_SPE_BRANCH_MISS)) { in arm_spe_sample()
464 err = arm_spe__synth_branch_sample(speq, spe->branch_miss_id); in arm_spe_sample()
469 if (spe->sample_remote_access && in arm_spe_sample()
471 err = arm_spe__synth_mem_sample(speq, spe->remote_access_id, in arm_spe_sample()
477 if (spe->sample_memory && arm_spe__is_memory_event(record->type)) { in arm_spe_sample()
478 err = arm_spe__synth_mem_sample(speq, spe->memory_id, data_src); in arm_spe_sample()
488 struct arm_spe *spe = speq->spe; in arm_spe_run_decoder() local
492 if (!spe->kernel_start) in arm_spe_run_decoder()
493 spe->kernel_start = machine__kernel_start(spe->machine); in arm_spe_run_decoder()
520 if (!spe->timeless_decoding && record->context_id != (u64)-1) { in arm_spe_run_decoder()
525 spe->use_ctx_pkt_for_pid = true; in arm_spe_run_decoder()
556 if (!spe->timeless_decoding && speq->timestamp >= *timestamp) { in arm_spe_run_decoder()
565 static int arm_spe__setup_queue(struct arm_spe *spe, in arm_spe__setup_queue() argument
575 speq = arm_spe__alloc_queue(spe, queue_nr); in arm_spe__setup_queue()
588 if (spe->timeless_decoding) in arm_spe__setup_queue()
603 ret = auxtrace_heap__add(&spe->heap, queue_nr, speq->timestamp); in arm_spe__setup_queue()
612 static int arm_spe__setup_queues(struct arm_spe *spe) in arm_spe__setup_queues() argument
617 for (i = 0; i < spe->queues.nr_queues; i++) { in arm_spe__setup_queues()
618 ret = arm_spe__setup_queue(spe, &spe->queues.queue_array[i], i); in arm_spe__setup_queues()
626 static int arm_spe__update_queues(struct arm_spe *spe) in arm_spe__update_queues() argument
628 if (spe->queues.new_data) { in arm_spe__update_queues()
629 spe->queues.new_data = false; in arm_spe__update_queues()
630 return arm_spe__setup_queues(spe); in arm_spe__update_queues()
636 static bool arm_spe__is_timeless_decoding(struct arm_spe *spe) in arm_spe__is_timeless_decoding() argument
639 struct evlist *evlist = spe->session->evlist; in arm_spe__is_timeless_decoding()
654 static int arm_spe_process_queues(struct arm_spe *spe, u64 timestamp) in arm_spe_process_queues() argument
664 if (!spe->heap.heap_cnt) in arm_spe_process_queues()
667 if (spe->heap.heap_array[0].ordinal >= timestamp) in arm_spe_process_queues()
670 queue_nr = spe->heap.heap_array[0].queue_nr; in arm_spe_process_queues()
671 queue = &spe->queues.queue_array[queue_nr]; in arm_spe_process_queues()
674 auxtrace_heap__pop(&spe->heap); in arm_spe_process_queues()
676 if (spe->heap.heap_cnt) { in arm_spe_process_queues()
677 ts = spe->heap.heap_array[0].ordinal + 1; in arm_spe_process_queues()
688 if (!spe->use_ctx_pkt_for_pid) in arm_spe_process_queues()
689 arm_spe_set_pid_tid_cpu(spe, queue); in arm_spe_process_queues()
693 auxtrace_heap__add(&spe->heap, queue_nr, ts); in arm_spe_process_queues()
698 ret = auxtrace_heap__add(&spe->heap, queue_nr, ts); in arm_spe_process_queues()
709 static int arm_spe_process_timeless_queues(struct arm_spe *spe, pid_t tid, in arm_spe_process_timeless_queues() argument
712 struct auxtrace_queues *queues = &spe->queues; in arm_spe_process_timeless_queues()
717 struct auxtrace_queue *queue = &spe->queues.queue_array[i]; in arm_spe_process_timeless_queues()
722 arm_spe_set_pid_tid_cpu(spe, queue); in arm_spe_process_timeless_queues()
729 static int arm_spe_context_switch(struct arm_spe *spe, union perf_event *event, in arm_spe_context_switch() argument
745 return machine__set_current_tid(spe->machine, cpu, pid, tid); in arm_spe_context_switch()
755 struct arm_spe *spe = container_of(session->auxtrace, in arm_spe_process_event() local
767 timestamp = perf_time_to_tsc(sample->time, &spe->tc); in arm_spe_process_event()
771 if (timestamp || spe->timeless_decoding) { in arm_spe_process_event()
772 err = arm_spe__update_queues(spe); in arm_spe_process_event()
777 if (spe->timeless_decoding) { in arm_spe_process_event()
779 err = arm_spe_process_timeless_queues(spe, in arm_spe_process_event()
784 err = arm_spe_process_queues(spe, timestamp); in arm_spe_process_event()
788 if (!spe->use_ctx_pkt_for_pid && in arm_spe_process_event()
791 err = arm_spe_context_switch(spe, event, sample); in arm_spe_process_event()
801 struct arm_spe *spe = container_of(session->auxtrace, struct arm_spe, in arm_spe_process_auxtrace_event() local
804 if (!spe->data_queued) { in arm_spe_process_auxtrace_event()
818 err = auxtrace_queues__add_event(&spe->queues, session, event, in arm_spe_process_auxtrace_event()
826 arm_spe_dump_event(spe, buffer->data, in arm_spe_process_auxtrace_event()
839 struct arm_spe *spe = container_of(session->auxtrace, struct arm_spe, in arm_spe_flush() local
849 ret = arm_spe__update_queues(spe); in arm_spe_flush()
853 if (spe->timeless_decoding) in arm_spe_flush()
854 return arm_spe_process_timeless_queues(spe, -1, in arm_spe_flush()
857 ret = arm_spe_process_queues(spe, MAX_TIMESTAMP); in arm_spe_flush()
861 if (!spe->use_ctx_pkt_for_pid) in arm_spe_flush()
882 struct arm_spe *spe = container_of(session->auxtrace, struct arm_spe, in arm_spe_free_events() local
884 struct auxtrace_queues *queues = &spe->queues; in arm_spe_free_events()
896 struct arm_spe *spe = container_of(session->auxtrace, struct arm_spe, in arm_spe_free() local
899 auxtrace_heap__free(&spe->heap); in arm_spe_free()
902 free(spe); in arm_spe_free()
908 struct arm_spe *spe = container_of(session->auxtrace, struct arm_spe, auxtrace); in arm_spe_evsel_is_auxtrace() local
910 return evsel->core.attr.type == spe->pmu_type; in arm_spe_evsel_is_auxtrace()
970 arm_spe_synth_events(struct arm_spe *spe, struct perf_session *session) in arm_spe_synth_events() argument
980 if (evsel->core.attr.type == spe->pmu_type) { in arm_spe_synth_events()
997 if (spe->timeless_decoding) in arm_spe_synth_events()
1002 spe->sample_type = attr.sample_type; in arm_spe_synth_events()
1018 if (spe->synth_opts.flc) { in arm_spe_synth_events()
1019 spe->sample_flc = true; in arm_spe_synth_events()
1025 spe->l1d_miss_id = id; in arm_spe_synth_events()
1033 spe->l1d_access_id = id; in arm_spe_synth_events()
1038 if (spe->synth_opts.llc) { in arm_spe_synth_events()
1039 spe->sample_llc = true; in arm_spe_synth_events()
1045 spe->llc_miss_id = id; in arm_spe_synth_events()
1053 spe->llc_access_id = id; in arm_spe_synth_events()
1058 if (spe->synth_opts.tlb) { in arm_spe_synth_events()
1059 spe->sample_tlb = true; in arm_spe_synth_events()
1065 spe->tlb_miss_id = id; in arm_spe_synth_events()
1073 spe->tlb_access_id = id; in arm_spe_synth_events()
1078 if (spe->synth_opts.branches) { in arm_spe_synth_events()
1079 spe->sample_branch = true; in arm_spe_synth_events()
1085 spe->branch_miss_id = id; in arm_spe_synth_events()
1090 if (spe->synth_opts.remote_access) { in arm_spe_synth_events()
1091 spe->sample_remote_access = true; in arm_spe_synth_events()
1097 spe->remote_access_id = id; in arm_spe_synth_events()
1102 if (spe->synth_opts.mem) { in arm_spe_synth_events()
1103 spe->sample_memory = true; in arm_spe_synth_events()
1108 spe->memory_id = id; in arm_spe_synth_events()
1121 struct arm_spe *spe; in arm_spe_process_auxtrace_info() local
1128 spe = zalloc(sizeof(struct arm_spe)); in arm_spe_process_auxtrace_info()
1129 if (!spe) in arm_spe_process_auxtrace_info()
1132 err = auxtrace_queues__init(&spe->queues); in arm_spe_process_auxtrace_info()
1136 spe->session = session; in arm_spe_process_auxtrace_info()
1137 spe->machine = &session->machines.host; /* No kvm support */ in arm_spe_process_auxtrace_info()
1138 spe->auxtrace_type = auxtrace_info->type; in arm_spe_process_auxtrace_info()
1139 spe->pmu_type = auxtrace_info->priv[ARM_SPE_PMU_TYPE]; in arm_spe_process_auxtrace_info()
1141 spe->timeless_decoding = arm_spe__is_timeless_decoding(spe); in arm_spe_process_auxtrace_info()
1153 spe->tc.time_shift = tc->time_shift; in arm_spe_process_auxtrace_info()
1154 spe->tc.time_mult = tc->time_mult; in arm_spe_process_auxtrace_info()
1155 spe->tc.time_zero = tc->time_zero; in arm_spe_process_auxtrace_info()
1158 spe->tc.time_cycles = tc->time_cycles; in arm_spe_process_auxtrace_info()
1159 spe->tc.time_mask = tc->time_mask; in arm_spe_process_auxtrace_info()
1160 spe->tc.cap_user_time_zero = tc->cap_user_time_zero; in arm_spe_process_auxtrace_info()
1161 spe->tc.cap_user_time_short = tc->cap_user_time_short; in arm_spe_process_auxtrace_info()
1164 spe->auxtrace.process_event = arm_spe_process_event; in arm_spe_process_auxtrace_info()
1165 spe->auxtrace.process_auxtrace_event = arm_spe_process_auxtrace_event; in arm_spe_process_auxtrace_info()
1166 spe->auxtrace.flush_events = arm_spe_flush; in arm_spe_process_auxtrace_info()
1167 spe->auxtrace.free_events = arm_spe_free_events; in arm_spe_process_auxtrace_info()
1168 spe->auxtrace.free = arm_spe_free; in arm_spe_process_auxtrace_info()
1169 spe->auxtrace.evsel_is_auxtrace = arm_spe_evsel_is_auxtrace; in arm_spe_process_auxtrace_info()
1170 session->auxtrace = &spe->auxtrace; in arm_spe_process_auxtrace_info()
1178 spe->synth_opts = *session->itrace_synth_opts; in arm_spe_process_auxtrace_info()
1180 itrace_synth_opts__set_default(&spe->synth_opts, false); in arm_spe_process_auxtrace_info()
1182 err = arm_spe_synth_events(spe, session); in arm_spe_process_auxtrace_info()
1186 err = auxtrace_queues__process_index(&spe->queues, session); in arm_spe_process_auxtrace_info()
1190 if (spe->queues.populated) in arm_spe_process_auxtrace_info()
1191 spe->data_queued = true; in arm_spe_process_auxtrace_info()
1196 auxtrace_queues__free(&spe->queues); in arm_spe_process_auxtrace_info()
1199 free(spe); in arm_spe_process_auxtrace_info()