LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Zachary Amsden <zach@vmware.com>
To: Andi Kleen <ak@muc.de>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@osdl.org>,
	Rusty Russell <rusty@rustcorp.com.au>,
	Jeremy Fitzhardinge <jeremy@goop.org>,
	Chris Wright <chrisw@sous-sol.org>
Subject: Re: [PATCH 2/11] Sched clock paravirt op
Date: Tue, 06 Feb 2007 14:47:06 -0800	[thread overview]
Message-ID: <45C9056A.8060504@vmware.com> (raw)
In-Reply-To: <20070206123256.GF47229@muc.de>

Andi Kleen wrote:
>>  	.write_msr = native_write_msr,
>>  	.read_tsc = native_read_tsc,
>>  	.read_pmc = native_read_pmc,
>> +	.get_scheduled_cycles = native_read_tsc,
>> +	.get_cpu_khz = native_calculate_cpu_khz,
>>  	.load_tr_desc = native_load_tr_desc,
>>     
> Description missing? 
>   

I missed a title / signed-off on this guy.


Internally, sched_clock runs in units of nanoseconds, not CPU cycles.  
This was wrong in my previous patch.  Fix it so everyone can use the 
same cycles_2_ns code in tsc.c.

Signed-off-by: Zachary Amsden <zach@vmware.com>

> Please write at least two paragraphs or more on each new hook
> you want to add.
>   

Not a new hook; I just changed the name.

> My feeling is that rdtsc should work fine here. If not please explain.
>   

It depends.  Scheduled clock must be in units of available time - stolen 
time is not always evenly distributed.  If you make rdtsc just be 
scheduled clock, that almost works.  But most places that use rdtsc 
expect it to be in cycles of approximate real time, and to leap forward 
if something like SMM comes along and steals time.

Not that this is pretty.  Arguably, the TSC should just run at a fixed 
rate, not progress during stolen time.  This idealized TSC assumption is 
not however how Linux is making use of the TSC today.  TSC is more like 
real time, only in a VM, it can't quite keep up with real time, so it 
gets simulated.

Scheduled (or available) time and real time are good notions.  Stolen 
time is debatable.  But TSC is basically just always wrong.  That's why 
I don't want to overload the rdtsc operation.

Zach

  reply	other threads:[~2007-02-06 22:47 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-06  3:52 Zachary Amsden
2007-02-06  4:00 ` Zachary Amsden
2007-02-06 12:32 ` Andi Kleen
2007-02-06 22:47   ` Zachary Amsden [this message]
2007-02-06 23:23     ` Jeremy Fitzhardinge
2007-02-06 23:42       ` Zachary Amsden
2007-02-06 23:48         ` Jeremy Fitzhardinge
2007-02-06 23:50           ` Zachary Amsden

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=45C9056A.8060504@vmware.com \
    --to=zach@vmware.com \
    --cc=ak@muc.de \
    --cc=akpm@osdl.org \
    --cc=chrisw@sous-sol.org \
    --cc=jeremy@goop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    --subject='Re: [PATCH 2/11] Sched clock paravirt op' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).