Re: [PATCH 1/8] perf cs-etm: Don't flush when packet_queue fills up

From: Leo Yan
Date: Wed Sep 11 2024 - 04:15:01 EST




On 9/10/2024 9:28 PM, Leo Yan wrote:
> On 9/5/2024 11:50 AM, James Clark wrote:
>
> [...]
>
>> cs_etm__flush(), like cs_etm__sample() is an operation that generates a
>> sample and then swaps the current with the previous packet. Calling
>> flush after processing the queues results in two swaps which corrupts
>> the next sample. Therefore it wasn't appropriate to call flush here so
>> remove it.
>
> In the cs_etm__sample(), if the period is not overflow, it is not necessarily
> to generate instruction samples and copy back stack entries. This is why we
> want to call cs_etm__flush() to make sure the last packet can be recorded
> properly for instruction sample with back stacks.
>
> We also need to take account into the case for the end of the session - in
> this case we need to generate samples for the last packet for complete info.
>
> I am wandering should we remove the cs_etm__packet_swap() from cs_etm__sample()?

Sorry for typo. I meant to remove the cs_etm__packet_swap() from cs_etm__flush().

Thanks,
Leo