[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CANRm+CxZRCs6h_mffFQsX6N7KFJFFhSADR4vn1J-1OopU+UEAA@mail.gmail.com>
Date: Mon, 17 Feb 2020 21:12:39 +0800
From: Wanpeng Li <kernellwp@...il.com>
To: Paolo Bonzini <pbonzini@...hat.com>
Cc: LKML <linux-kernel@...r.kernel.org>, kvm <kvm@...r.kernel.org>,
Sean Christopherson <sean.j.christopherson@...el.com>,
Wanpeng Li <wanpengli@...cent.com>,
Vitaly Kuznetsov <vkuznets@...hat.com>,
Jim Mattson <jmattson@...gle.com>,
Joerg Roedel <joro@...tes.org>
Subject: Re: [PATCH v3 1/2] KVM: X86: Less kvmclock sync induced vmexits after
VM boots
On Mon, 17 Feb 2020 at 19:23, Paolo Bonzini <pbonzini@...hat.com> wrote:
>
> On 17/02/20 11:36, Wanpeng Li wrote:
> >
> > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> > index fb5d64e..d0ba2d4 100644
> > --- a/arch/x86/kvm/x86.c
> > +++ b/arch/x86/kvm/x86.c
> > @@ -9390,8 +9390,9 @@ void kvm_arch_vcpu_postcreate(struct kvm_vcpu *vcpu)
> > if (!kvmclock_periodic_sync)
> > return;
> >
> > - schedule_delayed_work(&kvm->arch.kvmclock_sync_work,
> > - KVMCLOCK_SYNC_PERIOD);
> > + if (kvm->created_vcpus == 1)
> > + schedule_delayed_work(&kvm->arch.kvmclock_sync_work,
> > + KVMCLOCK_SYNC_PERIOD);
>
> This is called with kvm->lock not held, so you can have
> kvm->created_vcpus == 2 by the time you get here. You can test instead
> "if (vcpu->vcpu_idx == 0)".
Agreed.
Wanpeng
Powered by blists - more mailing lists