On Tue, 30 Mar 2021 14:34:23 +0100, Suzuki K Poulose suzuki.poulose@arm.com wrote:
On 30/03/2021 13:15, Marc Zyngier wrote:
On Tue, 30 Mar 2021 12:12:49 +0100, Suzuki K Poulose suzuki.poulose@arm.com wrote:
[...]
May be we could do this check at kvm_arch_vcpu_load()/put() ?
That would extend the tracing blackout period enormously, wouldn't it? I'm not sure that's the best thing to do...
Sorry for not making this clear. We could check if the SPE/TRBE is available on this CPU (including the PMB/TRB_IDR bits and a set a flag in the VCPU on every kvm_arch_vcpu_load() and cleared on put. The actual switching code could check this flag and check if the unit is enabled and then do the actual save/restore as we do below. (We may be able to even check if unit is enabled there, need to double check this.)
Ah, gotcha. Yes, this seems like a reasonable thing to do. We have the per-vcpu debug flags already, and you could piggy-back on that.
Thanks,
M.