LKML Archive on
help / color / mirror / Atom feed
From: Zachary Amsden <>
To: Andi Kleen <>
Cc: Linux Kernel Mailing List <>,
	Andrew Morton <>,
	Rusty Russell <>,
	Jeremy Fitzhardinge <>,
	Chris Wright <>
Subject: Re: [PATCH 2/11] Sched clock paravirt op
Date: Tue, 06 Feb 2007 14:47:06 -0800	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

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

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


  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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \ \ \
    --subject='Re: [PATCH 2/11] Sched clock paravirt op' \

* 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).