From: Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
To: "Dong, Eddie" <eddie.dong-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: kvm-devel <kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
Subject: Re: add back pending timer irqs for kernel APIC timer
Date: Mon, 13 Aug 2007 18:19:52 +0300 [thread overview]
Message-ID: <46C07698.2080500@qumranet.com> (raw)
In-Reply-To: <10EA09EFD8728347A513008B6B0DA77A014E8AD7-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
Dong, Eddie wrote:
> Avi Kivity wrote:
>
>>> 2: stop hrtimer when the guest is descheduled to increase
>>> scalibility and remove apic->lock.
>>>
>>>
>> Why is this important? An hrtimer is just an entry on a list, no?
>>
>
> Does it need an IRQ to drive? If we have ten VMs, we got extra 10 IRQs.
>
You're right -- if the host is overloaded, this will generate interrupts
which cannot be handled in time. So it makes sense to disable the
hrtimer if we are preempted and if we are not in hlt sleep (e.g.
involuntary preemption).
>
>> Do you mean, just if the guest is preempted (not during hlt)?
>> Is it so
>> important? We're talking a few thousand wakeups per second.
>>
>
> The majority of wakeup is APIC timer in normal SMP case.
> This is important for deep C state power management. If guest is 1KHZ,
> we may get 10KHZ IRQs if 10 VMs are running.
>
> If it is in HLT, we need to set up an hrtimer or similar to wakeup the
> HLT.
>
So we need the hrtimer anyway. Seems like it's only a win if the host
is overloaded and the guests are running; an idle guest requires an hrtimer.
There is an alternative, if we have multiple vcpus set with the same
frequency we can try to use one hrtimer per cpu for all of them. This
doesn't work for dyntick guests but should work if most guests are the
same type.
>
>>> 3: Use scale + shift like Xen did to make sure no internal overflow
>>> if we run guest contiguously for long time say 2 years.
>>>
>>>
>> hrtimers are in 64-bit nanoseconds. That gives about 160 years.
>>
>>
>
> I assume TSC is better than hrtimer, see next bullet. When we convert
> from TSC to PIT timer, a multiply is a must and we need to carefully
> design
> the scale and factor to not overflow if we stick in 64bits ops.
>
> Notes here: We may not want to use 64bits * 64bits = 128bits as it is
> too expansive. (?)
> This is What Xen did and have some sense if we pay attention to
> performance very much.
>
I think the hrtimer code deals with this, Linux has to deal with a lot
of timers.
>
>>> Above 1-3 is already in Xen and we just need to port.
>>>
>>>
>>> 4: Should we use hrtimer? How efficieny it is?
>>>
>>>
>>>
>>>
>> Sure, hrtimer is the future.
>>
>
> Maybe I am wrong, but the point is that we don't care about accuracy
> since
> we only need an IRQ to interrupt guest at around the guest fire time.
> (A host timer IRQ triggered VM Exit and many callbacks in host which
> should
> exceeds 5K cycles) We can simply use TSC (much efficient IMO) and
> present guest APIC
> freqeuncy = host TSC frequency. This way we don't need to do
> muliple/dividen etc. Anyway it depends on if we can find an much
> efficient timer:-)
> I have no idea here.
>
We need to make sure we are solving the right problem... do you have any
traces which show that timer handling is a performance issue?
--
error compiling committee.c: too many arguments to function
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
prev parent reply other threads:[~2007-08-13 15:19 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-10 15:37 add back pending timer irqs for kernel APIC timer Dong, Eddie
[not found] ` <10EA09EFD8728347A513008B6B0DA77A01E8DA94-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-08-10 15:56 ` Dong, Eddie
[not found] ` <10EA09EFD8728347A513008B6B0DA77A01E8DA9B-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-08-13 11:21 ` Avi Kivity
[not found] ` <46C03EA6.7030709-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-08-13 13:19 ` Dong, Eddie
[not found] ` <10EA09EFD8728347A513008B6B0DA77A014E8AD0-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-08-13 13:25 ` Avi Kivity
[not found] ` <46C05BE0.4060908-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-08-13 13:31 ` Dong, Eddie
[not found] ` <10EA09EFD8728347A513008B6B0DA77A014E8AD3-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-08-13 13:36 ` Dong, Eddie
[not found] ` <10EA09EFD8728347A513008B6B0DA77A014E8AD4-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-08-13 13:38 ` Avi Kivity
2007-08-14 3:24 ` Dong, Eddie
[not found] ` <10EA09EFD8728347A513008B6B0DA77A01E8E40B-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-08-18 10:22 ` Dong, Eddie
[not found] ` <10EA09EFD8728347A513008B6B0DA77A01EE24C4-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-08-19 7:32 ` Avi Kivity
[not found] ` <46C7F204.5010008-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-08-24 7:18 ` Dong, Eddie
[not found] ` <10EA09EFD8728347A513008B6B0DA77A01F84464-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-08-24 13:06 ` Dong, Eddie
2007-08-25 8:40 ` Avi Kivity
[not found] ` <46CFEAF1.4050000-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-08-25 14:20 ` Dong, Eddie
[not found] ` <10EA09EFD8728347A513008B6B0DA77A01F84647-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-08-25 15:02 ` Avi Kivity
2007-08-10 17:03 ` Avi Kivity
[not found] ` <46BC9A7E.5040206-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-08-11 1:05 ` Dong, Eddie
[not found] ` <10EA09EFD8728347A513008B6B0DA77A01E8DACC-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-08-13 8:50 ` Avi Kivity
[not found] ` <46C01B58.8080402-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-08-13 12:01 ` Gregory Haskins
[not found] ` <1187006514.4165.1.camel-5CR4LY5GPkvLDviKLk5550HKjMygAv58XqFh9Ls21Oc@public.gmane.org>
2007-08-13 13:29 ` Dong, Eddie
[not found] ` <10EA09EFD8728347A513008B6B0DA77A014E8AD1-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-08-13 13:36 ` Avi Kivity
[not found] ` <46C05E6B.3080101-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-08-13 14:50 ` Dong, Eddie
[not found] ` <10EA09EFD8728347A513008B6B0DA77A014E8AD7-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-08-13 15:19 ` Avi Kivity [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=46C07698.2080500@qumranet.com \
--to=avi-atkuwr5tajbwk0htik3j/w@public.gmane.org \
--cc=eddie.dong-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox