public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo-X9Un+BFzKDI@public.gmane.org>
To: Dan Hecht <dhecht-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>
Cc: Zachary Amsden <zach-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>,
	jeremy-TSDbQ3PG+2Y@public.gmane.org,
	avi-i/T1Zxg06OZWk0Htik3J/w@public.gmane.org,
	kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Glauber de Oliveira Costa
	<gcosta-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	Glauber de Oliveira Costa
	<glauber-aMxvdZfKFXomYvmMESoHnA@public.gmane.org>,
	--cc-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	Garrett Smith <garrett-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>
Subject: Re: [PATCH] raise tsc clocksource rating
Date: Tue, 30 Oct 2007 08:14:35 +0100	[thread overview]
Message-ID: <20071030071435.GA17074@elte.hu> (raw)
In-Reply-To: <47266B90.8000008-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>


* Dan Hecht <dhecht-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org> wrote:

>> but if there's a perfect TSC available (there is such hardware) then 
>> the TSC _is_ the best clocksource. Paravirt now turns it off 
>> unconditionally in essence.
>
> Not really.  In the case hardware TSC is perfect, the paravirt time 
> counter can be implemented directly in terms of hardware TSC; there is 
> no loss in optimization.  This is done transparently.  And virtual TSC 
> can be implemented this way too.

Of course if you duplicate all (or part) of the TSC clocksource driver 
in the paravirt guest code then the "paravirt clocksource" is at least 
as good as the TSC. But that argument is playing word-games, _of course_ 
if you use the same (or similar) code it's at least as good. The real 
question are clocksources that communicate out to the hypervisor, and 
hence have higher overhead than a native, TSC based clocksource - and 
clocksources that use the TSC in a broken way.

> The real improvement that a paravirt clocksource offers over the TSC 
> clocksource is that the guest does not need to measure the TSC 
> frequency itself against some other constant frequency source (which 
> is problematic on a virtual machine). [...]

hey, you need not tell me, i've implemented a hyper-clocksource driver 
myself. But calibration is a boot only issue and there's no reason why 
calibration _has_ to be fragile. For example we could easily extend the 
TSC clocksource driver to not calibrate in the guest but take 
calibration information from the host. It's in essence a trivial and 
obvious extension to calibration. That way we get the highest possible 
performance _and_ we share much of the clocksource driver with the host.

also, the way the TSC is used by guests like Xen is fundamentally 
fragile on SMP. So i have a good reason to distrust the approach of 
hypervisors to timekeeping. The maintenance problem to me is that 
everyone in the paravirt space is busy coding away in their own (often 
broken) direction, replicating the essence of the TSC clocksource driver 
4 times over again and again, with subtle bugs in each variant, even in 
cases where the TSC readout can be trusted perfectly well. 
"Consolidation" and "sharing code" is not a particularly strong point of 
the paravirt projects ;-) (ok, KVM is a notable exception there.)

anyway, i do agree that this patch is wrong currently, mainly due to TSC 
calibration not being reliable in guest-space at the moment - but the 
whole concept of putting a separate clocksource driver into each 
paravirt guest, even in the case where the TSC is perfect, is madness. 
That code, once the hardware gets sane (and there are good signs for 
that), and once calibration can be passed from host to guest reliably, 
_will_ be consolidated, because it makes perfect technical sense.

	Ingo

-------------------------------------------------------------------------
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/

  parent reply	other threads:[~2007-10-30  7:14 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-29 23:10 [PATCH] raise tsc clocksource rating Glauber de Oliveira Costa
     [not found] ` <11936994092607-git-send-email-gcosta-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2007-10-29 22:17   ` Thomas Gleixner
2007-10-29 22:36     ` Ingo Molnar
2007-10-30  1:26     ` john stultz
     [not found]     ` <alpine.LFD.0.9999.0710292315280.3186-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2007-10-30  2:39       ` Rusty Russell
     [not found]         ` <200710301339.23628.rusty-8n+1lVoiYb80n/F98K4Iww@public.gmane.org>
2007-10-30  7:37           ` Ingo Molnar
     [not found]             ` <20071030073736.GA21843-X9Un+BFzKDI@public.gmane.org>
2007-10-30 10:52               ` Rusty Russell
2007-10-30 12:13               ` Glauber de Oliveira Costa
2007-10-29 22:42   ` Zachary Amsden
     [not found]     ` <1193697734.9793.86.camel-cxY/u30q8FloTgUnLF1by8fTvwmfpRNyZeezCHUQhQ4@public.gmane.org>
2007-10-29 22:45       ` Jeremy Fitzhardinge
2007-10-29 22:48     ` Ingo Molnar
     [not found]       ` <20071029224852.GA27547-X9Un+BFzKDI@public.gmane.org>
2007-10-29 22:52         ` Jeremy Fitzhardinge
2007-10-29 22:55           ` Ingo Molnar
     [not found]             ` <20071029225528.GA31293-X9Un+BFzKDI@public.gmane.org>
2007-10-29 23:17               ` Jeremy Fitzhardinge
     [not found]                 ` <47266A00.4040408-TSDbQ3PG+2Y@public.gmane.org>
2007-10-29 23:21                   ` Ingo Molnar
     [not found]                     ` <20071029232140.GA10518-X9Un+BFzKDI@public.gmane.org>
2007-10-29 23:33                       ` Jeremy Fitzhardinge
2007-10-30  0:45                     ` Ian Pratt
     [not found]                       ` <8A87A9A84C201449A0C56B728ACF491E34C5F5-sZfJFUT1i4lUWNNKjvdVWtlxNDNUtst69dF7HbQ/qKg@public.gmane.org>
2007-10-30  7:19                         ` Ingo Molnar
2007-10-29 22:55         ` Zachary Amsden
2007-10-29 23:02           ` Ingo Molnar
2007-10-29 23:13             ` Zachary Amsden
     [not found]               ` <1193699638.9793.97.camel-cxY/u30q8FloTgUnLF1by8fTvwmfpRNyZeezCHUQhQ4@public.gmane.org>
2007-10-29 23:17                 ` Ingo Molnar
2007-10-30 12:02                 ` Glauber de Oliveira Costa
     [not found]                   ` <47271D4A.8030707-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2007-10-30 17:58                     ` Zachary Amsden
     [not found]             ` <20071029230213.GA1982-X9Un+BFzKDI@public.gmane.org>
2007-10-29 23:24               ` Dan Hecht
     [not found]                 ` <47266B90.8000008-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>
2007-10-30  4:24                   ` Avi Kivity
2007-10-30  7:14                   ` Ingo Molnar [this message]
     [not found]           ` <1193698505.9793.90.camel-cxY/u30q8FloTgUnLF1by8fTvwmfpRNyZeezCHUQhQ4@public.gmane.org>
2007-10-30 11:59             ` Glauber de Oliveira Costa
2007-10-30  0:17   ` H. Peter Anvin

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=20071030071435.GA17074@elte.hu \
    --to=mingo-x9un+bfzkdi@public.gmane.org \
    --cc=--cc-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=avi-i/T1Zxg06OZWk0Htik3J/w@public.gmane.org \
    --cc=dhecht-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org \
    --cc=garrett-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org \
    --cc=gcosta-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=glauber-aMxvdZfKFXomYvmMESoHnA@public.gmane.org \
    --cc=jeremy-TSDbQ3PG+2Y@public.gmane.org \
    --cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=zach-pghWNbHTmq7QT0dZR+AlfA@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