[PATCH v2] KVM: arm64: timers: Convert per-vcpu virtual offset to a global value

Marc Zyngier maz at kernel.org
Tue Feb 28 11:18:38 PST 2023


On Tue, 28 Feb 2023 11:26:07 +0000,
Joey Gouly <joey.gouly at arm.com> wrote:
> 
> Hi Marc,
> 
> On Fri, Feb 24, 2023 at 07:16:40PM +0000, Marc Zyngier wrote:
> > Having a per-vcpu virtual offset is a pain. It needs to be synchronized
> > on each update, and expands badly to a setup where different timers can
> > have different offsets, or have composite offsets (as with NV).
> > 
> > So let's start by replacing the use of the CNTVOFF_EL2 shadow register
> > (which we want to reclaim for NV anyway), and make the virtual timer
> > carry a pointer to a VM-wide offset.
> > 
> > This simplifies the code significantly. It also addresses two terrible bugs:
> > 
> > - The use of CNTVOFF_EL2 leads to some nice offset corruption
> >   when the sysreg gets reset, as reported by Joey.
> > 
> > - The kvm mutex is taken from a vcpu ioctl, which goes against
> >   the locking rules...
> > 
> > Reported-by: Joey Gouly <joey.gouly at arm.com>
> > Reviewed-by: Reiji Watanabe <reijiw at google.com>
> > Signed-off-by: Marc Zyngier <maz at kernel.org>
> > Link: https://lore.kernel.org/r/20230224173915.GA17407@e124191.cambridge.arm.com
> 
> Fixes my mismatched timer offset issues.
> 
> Tested-by: Joey Gouly <joey.gouly at arm.com>

Thanks for having given it a go. Hopefully Oliver will be able to send
this to as a fix shortly.

Thanks,

	M.

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



More information about the linux-arm-kernel mailing list