[PATCH v2 2/2] KVM: arm64: PMU: Don't overwrite PMUSERENR with vcpu loaded

Marc Zyngier maz at kernel.org
Wed Apr 12 03:22:29 PDT 2023


On Wed, 12 Apr 2023 10:20:05 +0100,
Mark Rutland <mark.rutland at arm.com> wrote:
> 
> On Tue, Apr 11, 2023 at 10:14:10PM -0700, Reiji Watanabe wrote:
> > Uh, right, interrupts are not masked during those windows...
> > 
> > What I am currently considering on this would be disabling
> > IRQs while manipulating the register, and introducing a new flag
> > to indicate whether the PMUSERENR for the guest EL0 is loaded,
> > and having kvm_set_pmuserenr() check the new flag.
> > 
> > The code would be something like below (local_irq_save/local_irq_restore
> > needs to be excluded for NVHE though).

It shouldn't need to be excluded. It should be fairly harmless, unless
I'm missing something really obvious?

> > 
> > What do you think ?
> 
> I'm happy with that; it doesn't change the arm_pmu side of the interface and it
> looks good from a functional perspective.
> 
> I'll have to leave it to Marc and Oliver to say whether they're happy with the
> KVM side.

This looks OK to me. My only ask would be to have a small comment in
the __{de}activate_traps_common() functions to say what this protects
against, because I'll page it out within minutes.

Thanks,

	M.

-- 
Without deviation from the norm, progress is not possible.



More information about the linux-arm-kernel mailing list