[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANRm+CwwUO9Snyvuhyg8zbLf9DRhQ8RhRddkrdu+wRjF8v5tdw@mail.gmail.com>
Date: Thu, 23 Apr 2020 17:54:19 +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>,
Vitaly Kuznetsov <vkuznets@...hat.com>,
Wanpeng Li <wanpengli@...cent.com>,
Jim Mattson <jmattson@...gle.com>,
Joerg Roedel <joro@...tes.org>,
Haiwei Li <lihaiwei@...cent.com>
Subject: Re: [PATCH v2 4/5] KVM: X86: TSCDEADLINE MSR emulation fastpath
On Thu, 23 Apr 2020 at 17:39, Paolo Bonzini <pbonzini@...hat.com> wrote:
>
> On 23/04/20 11:01, Wanpeng Li wrote:
> > +
> > +void kvm_set_lapic_tscdeadline_msr(struct kvm_vcpu *vcpu, u64 data)
> > +{
> > + if (__kvm_set_lapic_tscdeadline_msr(vcpu, data))
> > + start_apic_timer(vcpu->arch.apic);
> > +}
> > +
> > +int kvm_set_lapic_tscdeadline_msr_fast(struct kvm_vcpu *vcpu, u64 data)
> > +{
> > + struct kvm_lapic *apic = vcpu->arch.apic;
> > +
> > + if (__kvm_set_lapic_tscdeadline_msr(vcpu, data)) {
> > + atomic_set(&apic->lapic_timer.pending, 0);
> > + if (start_hv_timer(apic))
> > + return tscdeadline_expired_timer_fast(vcpu);
> > + }
> > +
> > + return 1;
> > }
> >
> > +static int tscdeadline_expired_timer_fast(struct kvm_vcpu *vcpu)
> > +{
> > + if (kvm_check_request(KVM_REQ_PENDING_TIMER, vcpu)) {
> > + kvm_clear_request(KVM_REQ_PENDING_TIMER, vcpu);
> > + kvm_inject_apic_timer_irqs_fast(vcpu);
> > + atomic_set(&vcpu->arch.apic->lapic_timer.pending, 0);
> > + }
> > +
> > + return 0;
> > +}
>
> This could also be handled in apic_timer_expired. For example you can
> add an argument from_timer_fn and do
>
> if (!from_timer_fn) {
> WARN_ON(kvm_get_running_vcpu() != vcpu);
> kvm_inject_apic_timer_irqs_fast(vcpu);
> return;
> }
>
> if (kvm_use_posted_timer_interrupt(apic->vcpu)) {
> ...
> }
> atomic_inc(&apic->lapic_timer.pending);
> kvm_set_pending_timer(vcpu);
>
> and then you don't need kvm_set_lapic_tscdeadline_msr_fast and
I guess you mean don't need tscdeadline_expired_timer_fast().
Wanpeng
Powered by blists - more mailing lists