[PATCH] KVM: arm64: Disable TRBE Trace Buffer Unit when running in guest context
Leo Yan
leo.yan at arm.com
Wed Feb 25 04:09:56 PST 2026
Hi Will,
[ + Yabin ]
Thanks for Suzuki's reminding, I should mention that Yabin reported
another lockup issue caused by missing CPU PM support in TRBE driver.
We have a patch series to fix the issue:
https://lore.kernel.org/linux-arm-kernel/20251119-arm_coresight_path_power_management_improvement-v5-16-f615a301ad0b@arm.com/
Besides your fix the translation regime issue, I'd also suggest applying
the CoreSight PM patch series to fix lockup caused by CPU idle.
I have a supplement for the context switch, please see the comment below.
On Thu, Feb 19, 2026 at 06:58:03PM +0000, Leo Yan wrote:
[...]
> Based on these conclusions, let me summarize the flow:
>
> // Prohibit trace
> TRFCR_EL1 = 0;
>
> // No new program-flow trace
> isb();
>
> // Trace operation and trace unit are flushed
> tsb_csync(); // Executes twice if ARM64_WORKAROUND_TSB_FLUSH_FAILURE!
>
> // Disable trace unit
> TRCPRGCTLR.EN = 0b0
We conclude that no need to disable and re-enable the trace unit
(TRCPRGCTLR.EN) during a KVM context switch.
Here are the details:
I initially proposed controlling the TRCPRGCTLR.EN bit during switch.
This would allow the trace unit to generate ASYNC packets, which I
assumed would be convenient for decoding, since the decoder can
recognize ASYNC packets rather than decoder is to be reset if any
discontinuity occurs.
After review, during a VM context switch, the trace unit can guarantee
a single continuous stream when switching back to the host. There is no
discontinuity in trace stream. Therefore, we don't need to touch
TRCPRGCTLR.EN bit to generate ASYNC packets.
I hope this is reasonable to you.
Thanks,
Leo
More information about the linux-arm-kernel
mailing list