public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Dor Laor <dor.laor@qumranet.com>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Jan Kiszka <jan.kiszka@siemens.com>,
	"David S. Ahern" <daahern@cisco.com>,
	Glauber Costa <gcosta@redhat.com>,
	kvm-devel <kvm@vger.kernel.org>
Subject: Re: kvm guest loops_per_jiffy miscalibration under host load
Date: Wed, 23 Jul 2008 01:00:20 +0300	[thread overview]
Message-ID: <48865874.10900@qumranet.com> (raw)
In-Reply-To: <20080722124929.GA24724@dmt.cnet>

Marcelo Tosatti wrote:
> On Tue, Jul 22, 2008 at 10:22:00AM +0200, Jan Kiszka wrote:
>   
>>> The in-kernel PIT rearms relative to host clock, so the frequency is
>>> more reliable (next_expiration = prev_expiration + count).
>>>       
>> The same happens under plain QEMU:
>>
>> static void pit_irq_timer_update(PITChannelState *s, int64_t current_time);
>>
>> static void pit_irq_timer(void *opaque)
>> {
>>     PITChannelState *s = opaque;
>>
>>     pit_irq_timer_update(s, s->next_transition_time);
>> }
>>     
>
> True. I misread "current_time".
>
>   
>> To my experience QEMU's PIT is suffering from lost ticks under load
>> (when some delay gets larger than 2*period).
>>     
>
> Yes, with clock=pit on RHEL4 its quite noticeable. Even with -tdf. The
>   
Note that -tdf works only when you use userspace irqchip too, then it 
should work.
> in-kernel timer seems immune to that under the load I was testing.
>
>   
In the long run we should try to remove the in kernel pit. Currently it 
does handle pit
irq coalescing problem that leads to time drift.
The problem is that its not yet 100% production level, migration with it 
has some issues and
basically we should try not to duplicate userspace code unless there is 
no good reason (like performance).

There are floating patches by Glen Natapov for the pit and virtual rtc 
to prevent time drifts.
Hope they'll get accepted by qemu.
>> I recently played a bit with QEMU new icount feature. Than one tracks
>> the guest progress based on a virtual instruction pointer, derives the
>> QEMU's virtual clock from it, but also tries to keep that clock in sync
>> with the host by periodically adjusting its scaling factor (kind of
>> virtual CPU frequency tuning to keep the TSC in sync with real time).
>> Works quite nicely, but my feeling is that the adjustment is not 100%
>> stable yet.
>>
>> Maybe such pattern could be applied on kvm as well with tsc_vmexit -
>> tsc_vmentry serving as "guest progress counter" (instead of icount which
>> depends on QEMU's code translator).
>>     
>
> I see. Do you have patches around?
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>   


  parent reply	other threads:[~2008-07-22 22:01 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-22  3:25 kvm guest loops_per_jiffy miscalibration under host load Marcelo Tosatti
2008-07-22  8:22 ` Jan Kiszka
2008-07-22 12:49   ` Marcelo Tosatti
2008-07-22 15:54     ` Jan Kiszka
2008-07-22 22:00     ` Dor Laor [this message]
2008-07-22 19:56 ` David S. Ahern
2008-07-23  2:57   ` David S. Ahern
2008-07-29 14:58   ` Marcelo Tosatti
2008-07-29 16:06     ` PIT/ntp/timekeeping [was Re: kvm guest loops_per_jiffy miscalibration under host load] David S. Ahern
2008-07-29 17:29       ` David S. Ahern
  -- strict thread matches above, loose matches on Subject: below --
2008-07-02 16:40 kvm guest loops_per_jiffy miscalibration under host load Marcelo Tosatti
2008-07-03 13:17 ` Glauber Costa
2008-07-04 22:51   ` Marcelo Tosatti
2008-07-07  1:56   ` Anthony Liguori
2008-07-07 18:27     ` Glauber Costa
2008-07-07 18:48       ` Marcelo Tosatti
2008-07-07 19:21         ` Anthony Liguori
2008-07-07 19:32           ` Glauber Costa
2008-07-07 21:35             ` Glauber Costa
2008-07-11 21:18               ` David S. Ahern
2008-07-12 14:10                 ` Marcelo Tosatti
2008-07-12 19:28                   ` David S. Ahern
2008-07-07 18:17 ` Daniel P. Berrange

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=48865874.10900@qumranet.com \
    --to=dor.laor@qumranet.com \
    --cc=daahern@cisco.com \
    --cc=gcosta@redhat.com \
    --cc=jan.kiszka@siemens.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    /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