hulk inclusion category: bugfix bugzilla: https://atomgit.com/openeuler/kernel/issues/10115 ---------------------------------------- This reverts commit 9db54c8936ab2cbe52a12e56fa215d6ed0f091d9. The commit causes the perf tool build to fail, with the following specific error: util/cs-etm-decoder/cs-etm-decoder.c:551:45: warning: passing argument 1 of 'cs_etm_decoder__buffer_packet' from incompatible pointer type [-Wincompatible-pointer-types] 551 | ret = cs_etm_decoder__buffer_packet(etmq, packet_queue, trace_chan_id, | ^~~~ | | | struct cs_etm_queue * The community stable tree has not yet fixed this issue, so temporarily revert it as a workaround. Fixes: 9db54c8936ab ("perf cs-etm: Queue context packets for frontend") Signed-off-by: Tengda Wu <wutengda2@huawei.com> --- .../perf/util/cs-etm-decoder/cs-etm-decoder.c | 21 +- tools/perf/util/cs-etm.c | 236 +++++++----------- tools/perf/util/cs-etm.h | 8 +- 3 files changed, 102 insertions(+), 163 deletions(-) diff --git a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c index 277da9f767b9..640e383cef44 100644 --- a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c +++ b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c @@ -398,8 +398,6 @@ cs_etm_decoder__buffer_packet(struct cs_etm_packet_queue *packet_queue, packet_queue->packet_buffer[et].flags = 0; packet_queue->packet_buffer[et].exception_number = UINT32_MAX; packet_queue->packet_buffer[et].trace_chan_id = trace_chan_id; - packet_queue->packet_buffer[et].el = ocsd_EL_unknown; - packet_queue->packet_buffer[et].tid = -1; if (packet_queue->packet_count == CS_ETM_PACKET_MAX_BUFFER - 1) return OCSD_RESP_WAIT; @@ -447,7 +445,6 @@ cs_etm_decoder__buffer_range(struct cs_etm_queue *etmq, packet->last_instr_type = elem->last_i_type; packet->last_instr_subtype = elem->last_i_subtype; packet->last_instr_cond = elem->last_instr_cond; - packet->el = elem->context.exception_level; if (elem->last_i_type == OCSD_INSTR_BR || elem->last_i_type == OCSD_INSTR_BR_INDIRECT) packet->last_instr_taken_branch = elem->last_instr_exec; @@ -521,9 +518,7 @@ cs_etm_decoder__set_tid(struct cs_etm_queue *etmq, const ocsd_generic_trace_elem *elem, const uint8_t trace_chan_id) { - struct cs_etm_packet *packet; pid_t tid = -1; - int ret; /* * Process the PE_CONTEXT packets if we have a valid contextID or VMID. @@ -544,18 +539,12 @@ cs_etm_decoder__set_tid(struct cs_etm_queue *etmq, break; } - if (cs_etm__etmq_update_decode_context(etmq, trace_chan_id, - elem->context.exception_level, tid)) + if (cs_etm__etmq_set_tid_el(etmq, tid, trace_chan_id, + elem->context.exception_level)) return OCSD_RESP_FATAL_SYS_ERR; - ret = cs_etm_decoder__buffer_packet(etmq, packet_queue, trace_chan_id, - CS_ETM_CONTEXT); - if (ret != OCSD_RESP_CONT && ret != OCSD_RESP_WAIT) - return ret; - - packet = &packet_queue->packet_buffer[packet_queue->tail]; - packet->tid = tid; - packet->el = elem->context.exception_level; + if (tid == -1) + return OCSD_RESP_CONT; /* * A timestamp is generated after a PE_CONTEXT element so make sure @@ -563,7 +552,7 @@ cs_etm_decoder__set_tid(struct cs_etm_queue *etmq, */ cs_etm_decoder__reset_timestamp(packet_queue); - return ret; + return OCSD_RESP_CONT; } static ocsd_datapath_resp_t cs_etm_decoder__gen_trace_elem_printer( diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c index 86f710912367..8bb3ab848890 100644 --- a/tools/perf/util/cs-etm.c +++ b/tools/perf/util/cs-etm.c @@ -86,22 +86,15 @@ struct cs_etm_traceid_queue { u64 period_instructions; size_t last_branch_pos; union perf_event *event_buf; + struct thread *thread; + struct thread *prev_packet_thread; + ocsd_ex_level prev_packet_el; + ocsd_ex_level el; struct branch_stack *last_branch; struct branch_stack *last_branch_rb; struct cs_etm_packet *prev_packet; struct cs_etm_packet *packet; struct cs_etm_packet_queue packet_queue; - - struct thread *decode_thread; - ocsd_ex_level decode_el; - - /* - * The frontend accesses the EL from '[prev_]packet' because it needs - * previous EL for branch and current EL for instruction samples. It's - * not possible to change thread in a single branch sample so no need to - * store or access the thread through the packet. - */ - struct thread *frontend_thread; }; enum cs_etm_format { @@ -496,11 +489,10 @@ static int cs_etm__init_traceid_queue(struct cs_etm_queue *etmq, queue = &etmq->etm->queues.queue_array[etmq->queue_nr]; tidq->trace_chan_id = trace_chan_id; - tidq->decode_el = ocsd_EL_unknown; - tidq->frontend_thread = machine__findnew_thread(&etm->session->machines.host, -1, - queue->tid); - tidq->decode_thread = machine__findnew_thread(&etm->session->machines.host, -1, + tidq->el = tidq->prev_packet_el = ocsd_EL_unknown; + tidq->thread = machine__findnew_thread(&etm->session->machines.host, -1, queue->tid); + tidq->prev_packet_thread = machine__idle_thread(&etm->session->machines.host); tidq->packet = zalloc(sizeof(struct cs_etm_packet)); if (!tidq->packet) @@ -633,10 +625,21 @@ static void cs_etm__packet_swap(struct cs_etm_auxtrace *etm, /* * Swap PACKET with PREV_PACKET: PACKET becomes PREV_PACKET for * the next incoming packet. + * + * Threads and exception levels are also tracked for both the + * previous and current packets. This is because the previous + * packet is used for the 'from' IP for branch samples, so the + * thread at that time must also be assigned to that sample. + * Across discontinuity packets the thread can change, so by + * tracking the thread for the previous packet the branch sample + * will have the correct info. */ tmp = tidq->packet; tidq->packet = tidq->prev_packet; tidq->prev_packet = tmp; + tidq->prev_packet_el = tidq->el; + thread__put(tidq->prev_packet_thread); + tidq->prev_packet_thread = thread__get(tidq->thread); } } @@ -824,8 +827,8 @@ static void cs_etm__free_traceid_queues(struct cs_etm_queue *etmq) /* Free this traceid_queue from the array */ tidq = etmq->traceid_queues[idx]; - thread__zput(tidq->frontend_thread); - thread__zput(tidq->decode_thread); + thread__zput(tidq->thread); + thread__zput(tidq->prev_packet_thread); zfree(&tidq->event_buf); zfree(&tidq->last_branch); zfree(&tidq->last_branch_rb); @@ -966,43 +969,47 @@ static u8 cs_etm__cpu_mode(struct cs_etm_queue *etmq, u64 address, } } -static u32 __cs_etm__mem_access(struct cs_etm_queue *etmq, - u64 address, size_t size, u8 *buffer, - const ocsd_mem_space_acc_t mem_space, - ocsd_ex_level el, struct thread *thread) +static u32 cs_etm__mem_access(struct cs_etm_queue *etmq, u8 trace_chan_id, + u64 address, size_t size, u8 *buffer, + const ocsd_mem_space_acc_t mem_space) { u8 cpumode; u64 offset; int len; struct addr_location al; struct dso *dso; + struct cs_etm_traceid_queue *tidq; int ret = 0; if (!etmq) return 0; addr_location__init(&al); + tidq = cs_etm__etmq_get_traceid_queue(etmq, trace_chan_id); + if (!tidq) + goto out; /* - * We track EL for the frontend and the backend when receiving context - * and range packets. OpenCSD doesn't distinguish between EL0 and EL1 - * for this mem access callback so we had to do the extra tracking. Skip - * validation if it's any of the 'any' values. + * We've already tracked EL along side the PID in cs_etm__set_thread() + * so double check that it matches what OpenCSD thinks as well. It + * doesn't distinguish between EL0 and EL1 for this mem access callback + * so we had to do the extra tracking. Skip validation if it's any of + * the 'any' values. */ if (!(mem_space == OCSD_MEM_SPACE_ANY || mem_space == OCSD_MEM_SPACE_N || mem_space == OCSD_MEM_SPACE_S)) { if (mem_space & OCSD_MEM_SPACE_EL1N) { /* Includes both non secure EL1 and EL0 */ - assert(el == ocsd_EL1 || el == ocsd_EL0); + assert(tidq->el == ocsd_EL1 || tidq->el == ocsd_EL0); } else if (mem_space & OCSD_MEM_SPACE_EL2) - assert(el == ocsd_EL2); + assert(tidq->el == ocsd_EL2); else if (mem_space & OCSD_MEM_SPACE_EL3) - assert(el == ocsd_EL3); + assert(tidq->el == ocsd_EL3); } - cpumode = cs_etm__cpu_mode(etmq, address, el); + cpumode = cs_etm__cpu_mode(etmq, address, tidq->el); - if (!thread__find_map(thread, cpumode, address, &al)) + if (!thread__find_map(tidq->thread, cpumode, address, &al)) goto out; dso = map__dso(al.map); @@ -1017,7 +1024,7 @@ static u32 __cs_etm__mem_access(struct cs_etm_queue *etmq, map__load(al.map); - len = dso__data_read_offset(dso, maps__machine(thread__maps(thread)), + len = dso__data_read_offset(dso, maps__machine(thread__maps(tidq->thread)), offset, buffer, size); if (len <= 0) { @@ -1037,30 +1044,6 @@ static u32 __cs_etm__mem_access(struct cs_etm_queue *etmq, return ret; } -static u32 cs_etm__frontend_mem_access(struct cs_etm_queue *etmq, - struct cs_etm_traceid_queue *tidq, - struct cs_etm_packet *packet, - u64 address, size_t size, u8 *buffer) -{ - return __cs_etm__mem_access(etmq, address, size, buffer, 0, packet->el, - tidq->frontend_thread); -} - -static u32 cs_etm__decoder_mem_access(struct cs_etm_queue *etmq, u8 trace_chan_id, - u64 address, size_t size, u8 *buffer, - const ocsd_mem_space_acc_t mem_space) -{ - struct cs_etm_traceid_queue *tidq; - - tidq = cs_etm__etmq_get_traceid_queue(etmq, trace_chan_id); - if (!tidq) - return 0; - - return __cs_etm__mem_access(etmq, address, size, buffer, - mem_space, tidq->decode_el, - tidq->decode_thread); -} - static struct cs_etm_queue *cs_etm__alloc_queue(void) { struct cs_etm_queue *etmq = zalloc(sizeof(*etmq)); @@ -1226,13 +1209,12 @@ void cs_etm__reset_last_branch_rb(struct cs_etm_traceid_queue *tidq) } static inline int cs_etm__t32_instr_size(struct cs_etm_queue *etmq, - struct cs_etm_traceid_queue *tidq, - struct cs_etm_packet *packet, u64 addr) + u8 trace_chan_id, u64 addr) { u8 instrBytes[2]; - cs_etm__frontend_mem_access(etmq, tidq, packet, addr, - ARRAY_SIZE(instrBytes), instrBytes); + cs_etm__mem_access(etmq, trace_chan_id, addr, ARRAY_SIZE(instrBytes), + instrBytes, 0); /* * T32 instruction size is indicated by bits[15:11] of the first * 16-bit word of the instruction: 0b11101, 0b11110 and 0b11111 @@ -1261,16 +1243,16 @@ u64 cs_etm__last_executed_instr(const struct cs_etm_packet *packet) } static inline u64 cs_etm__instr_addr(struct cs_etm_queue *etmq, - struct cs_etm_traceid_queue *tidq, - struct cs_etm_packet *packet, + u64 trace_chan_id, + const struct cs_etm_packet *packet, u64 offset) { if (packet->isa == CS_ETM_ISA_T32) { u64 addr = packet->start_addr; while (offset) { - addr += cs_etm__t32_instr_size(etmq, tidq, packet, - addr); + addr += cs_etm__t32_instr_size(etmq, + trace_chan_id, addr); offset--; } return addr; @@ -1361,51 +1343,34 @@ cs_etm__get_trace(struct cs_etm_queue *etmq) return 0; } -/* - * Convert a raw thread number to a thread struct and assign it to **thread. - */ -static int cs_etm__etmq_update_thread(struct cs_etm_queue *etmq, - ocsd_ex_level el, pid_t tid, - struct thread **thread) +static void cs_etm__set_thread(struct cs_etm_queue *etmq, + struct cs_etm_traceid_queue *tidq, pid_t tid, + ocsd_ex_level el) { struct machine *machine = cs_etm__get_machine(etmq, el); - if (!machine || !*thread) - return -EINVAL; - if (tid != -1) { - thread__zput(*thread); - *thread = machine__find_thread(machine, -1, tid); + thread__zput(tidq->thread); + tidq->thread = machine__find_thread(machine, -1, tid); } /* Couldn't find a known thread */ - if (!*thread) - *thread = machine__idle_thread(machine); + if (!tidq->thread) + tidq->thread = machine__idle_thread(machine); - return 0; + tidq->el = el; } -/* - * Set the thread and EL of the decode context which is ahead in time of the - * frontend context. - */ -int cs_etm__etmq_update_decode_context(struct cs_etm_queue *etmq, - u8 trace_chan_id, - ocsd_ex_level el, pid_t tid) +int cs_etm__etmq_set_tid_el(struct cs_etm_queue *etmq, pid_t tid, + u8 trace_chan_id, ocsd_ex_level el) { struct cs_etm_traceid_queue *tidq; - int ret; tidq = cs_etm__etmq_get_traceid_queue(etmq, trace_chan_id); if (!tidq) return -EINVAL; - ret = cs_etm__etmq_update_thread(etmq, el, tid, - &tidq->decode_thread); - if (ret) - return ret; - - tidq->decode_el = el; + cs_etm__set_thread(etmq, tidq, tid, el); return 0; } @@ -1415,8 +1380,8 @@ bool cs_etm__etmq_is_timeless(struct cs_etm_queue *etmq) } static void cs_etm__copy_insn(struct cs_etm_queue *etmq, - struct cs_etm_traceid_queue *tidq, - struct cs_etm_packet *packet, + u64 trace_chan_id, + const struct cs_etm_packet *packet, struct perf_sample *sample) { /* @@ -1433,14 +1398,14 @@ static void cs_etm__copy_insn(struct cs_etm_queue *etmq, * cs_etm__t32_instr_size(). */ if (packet->isa == CS_ETM_ISA_T32) - sample->insn_len = cs_etm__t32_instr_size(etmq, tidq, packet, + sample->insn_len = cs_etm__t32_instr_size(etmq, trace_chan_id, sample->ip); /* Otherwise, A64 and A32 instruction size are always 32-bit. */ else sample->insn_len = 4; - cs_etm__frontend_mem_access(etmq, tidq, packet, sample->ip, - sample->insn_len, (void *)sample->insn); + cs_etm__mem_access(etmq, trace_chan_id, sample->ip, sample->insn_len, + (void *)sample->insn, 0); } u64 cs_etm__convert_sample_time(struct cs_etm_queue *etmq, u64 cs_timestamp) @@ -1467,7 +1432,6 @@ static inline u64 cs_etm__resolve_sample_time(struct cs_etm_queue *etmq, static int cs_etm__synth_instruction_sample(struct cs_etm_queue *etmq, struct cs_etm_traceid_queue *tidq, - struct cs_etm_packet *packet, u64 addr, u64 period) { int ret = 0; @@ -1476,23 +1440,23 @@ static int cs_etm__synth_instruction_sample(struct cs_etm_queue *etmq, struct perf_sample sample = {.ip = 0,}; event->sample.header.type = PERF_RECORD_SAMPLE; - event->sample.header.misc = cs_etm__cpu_mode(etmq, addr, packet->el); + event->sample.header.misc = cs_etm__cpu_mode(etmq, addr, tidq->el); event->sample.header.size = sizeof(struct perf_event_header); /* Set time field based on etm auxtrace config. */ sample.time = cs_etm__resolve_sample_time(etmq, tidq); sample.ip = addr; - sample.pid = thread__pid(tidq->frontend_thread); - sample.tid = thread__tid(tidq->frontend_thread); + sample.pid = thread__pid(tidq->thread); + sample.tid = thread__tid(tidq->thread); sample.id = etmq->etm->instructions_id; sample.stream_id = etmq->etm->instructions_id; sample.period = period; - sample.cpu = packet->cpu; + sample.cpu = tidq->packet->cpu; sample.flags = tidq->prev_packet->flags; sample.cpumode = event->sample.header.misc; - cs_etm__copy_insn(etmq, tidq, packet, &sample); + cs_etm__copy_insn(etmq, tidq->trace_chan_id, tidq->packet, &sample); if (etm->synth_opts.last_branch) sample.branch_stack = tidq->last_branch; @@ -1536,15 +1500,15 @@ static int cs_etm__synth_branch_sample(struct cs_etm_queue *etmq, event->sample.header.type = PERF_RECORD_SAMPLE; event->sample.header.misc = cs_etm__cpu_mode(etmq, ip, - tidq->prev_packet->el); + tidq->prev_packet_el); event->sample.header.size = sizeof(struct perf_event_header); /* Set time field based on etm auxtrace config. */ sample.time = cs_etm__resolve_sample_time(etmq, tidq); sample.ip = ip; - sample.pid = thread__pid(tidq->frontend_thread); - sample.tid = thread__tid(tidq->frontend_thread); + sample.pid = thread__pid(tidq->prev_packet_thread); + sample.tid = thread__tid(tidq->prev_packet_thread); sample.addr = cs_etm__first_executed_instr(tidq->packet); sample.id = etmq->etm->branches_id; sample.stream_id = etmq->etm->branches_id; @@ -1553,7 +1517,8 @@ static int cs_etm__synth_branch_sample(struct cs_etm_queue *etmq, sample.flags = tidq->prev_packet->flags; sample.cpumode = event->sample.header.misc; - cs_etm__copy_insn(etmq, tidq, tidq->prev_packet, &sample); + cs_etm__copy_insn(etmq, tidq->trace_chan_id, tidq->prev_packet, + &sample); /* * perf report cannot handle events without a branch stack @@ -1706,6 +1671,7 @@ static int cs_etm__sample(struct cs_etm_queue *etmq, { struct cs_etm_auxtrace *etm = etmq->etm; int ret; + u8 trace_chan_id = tidq->trace_chan_id; u64 instrs_prev; /* Get instructions remainder from previous packet */ @@ -1791,10 +1757,10 @@ static int cs_etm__sample(struct cs_etm_queue *etmq, * been executed, but PC has not advanced to next * instruction) */ - addr = cs_etm__instr_addr(etmq, tidq, tidq->packet, - offset - 1); + addr = cs_etm__instr_addr(etmq, trace_chan_id, + tidq->packet, offset - 1); ret = cs_etm__synth_instruction_sample( - etmq, tidq, tidq->packet, addr, + etmq, tidq, addr, etm->instructions_sample_period); if (ret) return ret; @@ -1876,7 +1842,7 @@ static int cs_etm__flush(struct cs_etm_queue *etmq, addr = cs_etm__last_executed_instr(tidq->prev_packet); err = cs_etm__synth_instruction_sample( - etmq, tidq, tidq->prev_packet, addr, + etmq, tidq, addr, tidq->period_instructions); if (err) return err; @@ -1931,7 +1897,7 @@ static int cs_etm__end_block(struct cs_etm_queue *etmq, addr = cs_etm__last_executed_instr(tidq->prev_packet); err = cs_etm__synth_instruction_sample( - etmq, tidq, tidq->prev_packet, addr, + etmq, tidq, addr, tidq->period_instructions); if (err) return err; @@ -2020,9 +1986,9 @@ static int cs_etm__get_data_block(struct cs_etm_queue *etmq) return 1; } -static bool cs_etm__is_svc_instr(struct cs_etm_queue *etmq, - struct cs_etm_traceid_queue *tidq, - struct cs_etm_packet *packet, u64 end_addr) +static bool cs_etm__is_svc_instr(struct cs_etm_queue *etmq, u8 trace_chan_id, + struct cs_etm_packet *packet, + u64 end_addr) { /* Initialise to keep compiler happy */ u16 instr16 = 0; @@ -2044,8 +2010,8 @@ static bool cs_etm__is_svc_instr(struct cs_etm_queue *etmq, * so below only read 2 bytes as instruction size for T32. */ addr = end_addr - 2; - cs_etm__frontend_mem_access(etmq, tidq, packet, addr, - sizeof(instr16), (u8 *)&instr16); + cs_etm__mem_access(etmq, trace_chan_id, addr, sizeof(instr16), + (u8 *)&instr16, 0); if ((instr16 & 0xFF00) == 0xDF00) return true; @@ -2060,8 +2026,8 @@ static bool cs_etm__is_svc_instr(struct cs_etm_queue *etmq, * +---------+---------+-------------------------+ */ addr = end_addr - 4; - cs_etm__frontend_mem_access(etmq, tidq, packet, addr, - sizeof(instr32), (u8 *)&instr32); + cs_etm__mem_access(etmq, trace_chan_id, addr, sizeof(instr32), + (u8 *)&instr32, 0); if ((instr32 & 0x0F000000) == 0x0F000000 && (instr32 & 0xF0000000) != 0xF0000000) return true; @@ -2077,8 +2043,8 @@ static bool cs_etm__is_svc_instr(struct cs_etm_queue *etmq, * +-----------------------+---------+-----------+ */ addr = end_addr - 4; - cs_etm__frontend_mem_access(etmq, tidq, packet, addr, - sizeof(instr32), (u8 *)&instr32); + cs_etm__mem_access(etmq, trace_chan_id, addr, sizeof(instr32), + (u8 *)&instr32, 0); if ((instr32 & 0xFFE0001F) == 0xd4000001) return true; @@ -2094,6 +2060,7 @@ static bool cs_etm__is_svc_instr(struct cs_etm_queue *etmq, static bool cs_etm__is_syscall(struct cs_etm_queue *etmq, struct cs_etm_traceid_queue *tidq, u64 magic) { + u8 trace_chan_id = tidq->trace_chan_id; struct cs_etm_packet *packet = tidq->packet; struct cs_etm_packet *prev_packet = tidq->prev_packet; @@ -2108,7 +2075,7 @@ static bool cs_etm__is_syscall(struct cs_etm_queue *etmq, */ if (magic == __perf_cs_etmv4_magic) { if (packet->exception_number == CS_ETMV4_EXC_CALL && - cs_etm__is_svc_instr(etmq, tidq, prev_packet, + cs_etm__is_svc_instr(etmq, trace_chan_id, prev_packet, prev_packet->end_addr)) return true; } @@ -2146,6 +2113,7 @@ static bool cs_etm__is_sync_exception(struct cs_etm_queue *etmq, struct cs_etm_traceid_queue *tidq, u64 magic) { + u8 trace_chan_id = tidq->trace_chan_id; struct cs_etm_packet *packet = tidq->packet; struct cs_etm_packet *prev_packet = tidq->prev_packet; @@ -2171,7 +2139,7 @@ static bool cs_etm__is_sync_exception(struct cs_etm_queue *etmq, * (SMC, HVC) are taken as sync exceptions. */ if (packet->exception_number == CS_ETMV4_EXC_CALL && - !cs_etm__is_svc_instr(etmq, tidq, prev_packet, + !cs_etm__is_svc_instr(etmq, trace_chan_id, prev_packet, prev_packet->end_addr)) return true; @@ -2195,6 +2163,7 @@ static int cs_etm__set_sample_flags(struct cs_etm_queue *etmq, { struct cs_etm_packet *packet = tidq->packet; struct cs_etm_packet *prev_packet = tidq->prev_packet; + u8 trace_chan_id = tidq->trace_chan_id; u64 magic; int ret; @@ -2275,11 +2244,11 @@ static int cs_etm__set_sample_flags(struct cs_etm_queue *etmq, if (prev_packet->flags == (PERF_IP_FLAG_BRANCH | PERF_IP_FLAG_RETURN | PERF_IP_FLAG_INTERRUPT) && - cs_etm__is_svc_instr(etmq, tidq, packet, packet->start_addr)) { + cs_etm__is_svc_instr(etmq, trace_chan_id, + packet, packet->start_addr)) prev_packet->flags = PERF_IP_FLAG_BRANCH | PERF_IP_FLAG_RETURN | PERF_IP_FLAG_SYSCALLRET; - } break; case CS_ETM_DISCONTINUITY: /* @@ -2360,7 +2329,6 @@ static int cs_etm__set_sample_flags(struct cs_etm_queue *etmq, PERF_IP_FLAG_RETURN | PERF_IP_FLAG_INTERRUPT; break; - case CS_ETM_CONTEXT: case CS_ETM_EMPTY: default: break; @@ -2436,19 +2404,6 @@ static int cs_etm__process_traceid_queue(struct cs_etm_queue *etmq, */ cs_etm__sample(etmq, tidq); break; - case CS_ETM_CONTEXT: - /* - * Update context but don't swap packet. Keep the - * previous one for branch source address info, if - * tracing the kernel the context packet will be emitted - * between two ranges. - */ - ret = cs_etm__etmq_update_thread(etmq, tidq->packet->el, - tidq->packet->tid, - &tidq->frontend_thread); - if (ret) - goto out; - break; case CS_ETM_EXCEPTION: case CS_ETM_EXCEPTION_RET: /* @@ -2477,7 +2432,6 @@ static int cs_etm__process_traceid_queue(struct cs_etm_queue *etmq, } } -out: return ret; } @@ -2601,7 +2555,7 @@ static int cs_etm__process_timeless_queues(struct cs_etm_auxtrace *etm, if (!tidq) continue; - if (tid == -1 || thread__tid(tidq->frontend_thread) == tid) + if (tid == -1 || thread__tid(tidq->thread) == tid) cs_etm__run_per_thread_timeless_decoder(etmq); } else cs_etm__run_per_cpu_timeless_decoder(etmq); @@ -3342,7 +3296,7 @@ static int cs_etm__create_queue_decoders(struct cs_etm_queue *etmq) */ if (cs_etm_decoder__add_mem_access_cb(etmq->decoder, 0x0L, ((u64) -1L), - cs_etm__decoder_mem_access)) + cs_etm__mem_access)) goto out_free_decoder; zfree(&t_params); diff --git a/tools/perf/util/cs-etm.h b/tools/perf/util/cs-etm.h index f7b4903d9ef7..7cca37887917 100644 --- a/tools/perf/util/cs-etm.h +++ b/tools/perf/util/cs-etm.h @@ -158,7 +158,6 @@ enum cs_etm_sample_type { CS_ETM_DISCONTINUITY, CS_ETM_EXCEPTION, CS_ETM_EXCEPTION_RET, - CS_ETM_CONTEXT, }; enum cs_etm_isa { @@ -185,8 +184,6 @@ struct cs_etm_packet { u8 last_instr_size; u8 trace_chan_id; int cpu; - int el; - pid_t tid; }; #define CS_ETM_PACKET_MAX_BUFFER 1024 @@ -257,9 +254,8 @@ enum cs_etm_pid_fmt { #include <opencsd/ocsd_if_types.h> int cs_etm__get_cpu(u8 trace_chan_id, int *cpu); enum cs_etm_pid_fmt cs_etm__get_pid_fmt(struct cs_etm_queue *etmq); -int cs_etm__etmq_update_decode_context(struct cs_etm_queue *etmq, - u8 trace_chan_id, ocsd_ex_level el, - pid_t tid); +int cs_etm__etmq_set_tid_el(struct cs_etm_queue *etmq, pid_t tid, + u8 trace_chan_id, ocsd_ex_level el); bool cs_etm__etmq_is_timeless(struct cs_etm_queue *etmq); void cs_etm__etmq_set_traceid_queue_timestamp(struct cs_etm_queue *etmq, u8 trace_chan_id); -- 2.34.1