2017-04-12 14:23-0300, Marcelo Tosatti: > The disablement of interrupts at KVM_SET_CLOCK/KVM_GET_CLOCK > attempts to disable interrupts in that section to protect > the values that are calculated in that section from interrupt interference. > > now_ns is calculated inside the irq protected region, > user_ns.clock is passed from userspace (therefore not susceptible > to interrupt variation). > > About the line > now_ns = __get_kvmclock_ns(kvm); (1) > > Interrupts can happen afterwards local_irq_enable(), > rendering "now_ns" relative to its execution time PLUS > interrupt time. > > Therefore the local_irq_disable() / local_irq_enable() protection is not > necessary (that is: interrupts triggering after local_irq_enable cause > the same problem that the protection is trying to avoid). Makes sense. get_kvmclock_ns() has the same problem and this patch should cover it as well.