On 24/05/19 22:23, Sean Christopherson wrote: > On Mon, May 20, 2019 at 03:03:10PM +0200, Paolo Bonzini wrote: >> On 08/05/19 23:47, Sean Christopherson wrote: >>> + >>> + /* >>> + * The first vCPU to get a stable advancement time "wins" and >>> + * sets the advancement time that is used for *new* vCPUS that >>> + * are created with auto-adjusting enabled. >>> + */ >>> + if (apic->lapic_timer.timer_advance_adjust_done) >>> + (void)cmpxchg(&adjusted_timer_advance_ns, -1, >>> + timer_advance_ns); >> >> This is relatively expensive, so it should only be done after setting >> timer_advance_adjust_done to true. > > That's already the case, or am I missing something? > > This code is inside "if (!apic->lapic_timer.timer_advance_adjust_done)", Right, I missed the outer if from the context. Sorry for the noise. Paolo