On Tue, Feb 28, 2023 at 07:18:38PM +0000, Marc Zyngier wrote: > On Tue, 28 Feb 2023 11:26:07 +0000, > Joey Gouly <joey.gouly@xxxxxxx> 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@xxxxxxx> > > > Reviewed-by: Reiji Watanabe <reijiw@xxxxxxxxxx> > > > Signed-off-by: Marc Zyngier <maz@xxxxxxxxxx> > > > Link: https://lore.kernel.org/r/20230224173915.GA17407@xxxxxxxxxxxxxxxxxxxxxxxxx > > > > Fixes my mismatched timer offset issues. > > > > Tested-by: Joey Gouly <joey.gouly@xxxxxxx> > > Thanks for having given it a go. Hopefully Oliver will be able to send > this to as a fix shortly. Absolutely, I have this queued up. Thanks for testing the patch Joey. Want to see if I can get push access to the kvmarm repository in time, otherwise I'll send a pull to you Marc. -- Thanks, Oliver