Re: [PATCH v2 01/18] perf cs-etm: Queue context packets for frontend
From: Leo Yan
Date: Wed Jun 03 2026 - 05:17:57 EST
On Tue, Jun 02, 2026 at 03:26:43PM +0100, James Clark wrote:
[...]
> @@ -614,10 +621,12 @@ 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->el = tidq->prev_packet_el = ocsd_EL_unknown;
> - tidq->thread = machine__findnew_thread(&etm->session->machines.host, -1,
> + 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,
> queue->tid);
> - tidq->prev_packet_thread = machine__idle_thread(&etm->session->machines.host);
> +
Redundant new line.
> tidq->packet = zalloc(sizeof(struct cs_etm_packet));
> if (!tidq->packet)
> @@ -751,20 +760,16 @@ 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.
> + * Track Exception levels for both the previous and current
> + * packets. This is because the previous packet's address is
> + * used for the 'from' IP for branch samples, so the previous EL
> + * must also be used so that sample shows it originates from the
> + * correct EL. Branches can't branch to a different thread, so
> + * no need to track the previous thread.
> */
> 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);
As here no any code for EL swap, the comment above is a bit disconnected
with the code. Can we just remove the comment to avoid confusion?
Otherwise, looks good. Thanks for maturing the patch.
Leo