Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1373023

Re: [PATCH] kvm: x86: make lapic hrtimer pinned

From Yang Zhang <yang.zhang.wz@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH] kvm: x86: make lapic hrtimer pinned
Date 2016-04-07 04:10 +0200
Message-ID <rl7yq-52s-13@gated-at.bofh.it> (permalink)
References <rkjBF-lz-25@gated-at.bofh.it> <rkjUZ-Jj-9@gated-at.bofh.it> <rksvg-7iO-7@gated-at.bofh.it> <rkByz-6bC-23@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 2016/4/5 23:54, Radim Krčmář wrote:
> 2016-04-05 14:18+0800, Yang Zhang:
>> On 2016/4/5 5:00, Rik van Riel wrote:
>>> Given that delivering a timer to a guest seems to
>>> involve trapping from the guest to the host, anyway,
>>> I don't see a downside to your patch.
>>>
>>> If that is ever changed (eg. allowing delivery of
>>> a timer interrupt to a VCPU without trapping to the
>>> host), we may want to revisit this.
>>
>> Posted interrupt helps in this case. Currently, KVM doesn't use PI for lapic
>> timer is due to same affinity for lapic timer and VCPU. Now, we can change
>> to use PI for lapic timer. The only concern is what's frequency of timer
>> migration in upstream Linux? If it is frequently, will it bring additional
>> cost?
>
> It's a scheduler bug if the timer migration frequency would matter. :)
> Additional costs arise when the timer and VCPU are on two different
> CPUs.  (e.g. if both CPUs are in deep C-state, we wasted one wakeup;
> the timer would sometimes needs to send an interrupt.)

Yes, it's possible. But the premise is VCPU is pinned to other CPU. 
Normally, the VCPU will wake up on the same CPU where timer interrupt is 
stay if CPU is idle.

>
> Fine tuned KVM could benefit from having the lapic timer backend on a
> different physical core, but the general case would need some experience
> to decide.
>
> I think that we'd still want to have timer interrupts on the same
> physical core if the host didn't have PI, and the fraction of timers
> that can be injected without a guest entry is important to decide
> whether PI can make the effort worthwhile.

Agree. I can do some experiences to see how much improvement we can get.

>
> The biggest benefit might come from handling multiple lapic timers in
> one host interrupt.

This is should be another story.We need to align multiple lapic timers 
into one timer firstly.:)

-- 
best regards
yang

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] kvm: x86: make lapic hrtimer pinned Luiz Capitulino <lcapitulino@redhat.com> - 2016-04-04 22:50 +0200
  Re: [PATCH] kvm: x86: make lapic hrtimer pinned Rik van Riel <riel@redhat.com> - 2016-04-04 23:10 +0200
    Re: [PATCH] kvm: x86: make lapic hrtimer pinned Yang Zhang <yang.zhang.wz@gmail.com> - 2016-04-05 08:20 +0200
      Re: [PATCH] kvm: x86: make lapic hrtimer pinned Luiz Capitulino <lcapitulino@redhat.com> - 2016-04-05 14:50 +0200
      Re: [PATCH] kvm: x86: make lapic hrtimer pinned Radim Krčmář <rkrcmar@redhat.com> - 2016-04-05 18:00 +0200
        Re: [PATCH] kvm: x86: make lapic hrtimer pinned Yang Zhang <yang.zhang.wz@gmail.com> - 2016-04-07 04:10 +0200
  Re: [PATCH] kvm: x86: make lapic hrtimer pinned Paolo Bonzini <pbonzini@redhat.com> - 2016-04-05 12:10 +0200

csiph-web