[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4610AB6E.8020209@goop.org>
Date: Mon, 02 Apr 2007 00:06:22 -0700
From: Jeremy Fitzhardinge <jeremy@...p.org>
To: Andi Kleen <ak@...e.de>
CC: Andrew Morton <akpm@...ux-foundation.org>,
virtualization@...ts.osdl.org, lkml <linux-kernel@...r.kernel.org>,
Zachary Amsden <zach@...are.com>,
Dan Hecht <dhecht@...are.com>,
john stultz <johnstul@...ibm.com>
Subject: Re: [patch 17/17] Add a sched_clock paravirt_op
Andi Kleen wrote:
> Do you also get a clock for stolen nanoseconds?
>
What you actually get is how many ns the CPU spent in each state.
Stolen is runnable+offline.
> No need for cycles, you could just subtract the stolen ns if you
> can get those.
It just seems like a simpler interface to just allow overriding
sched_clock, rather than exposing sched_clock's internals and fiddling
with those. There's really nothing in the existing sched_clock which
can be profitably reused in the Xen case. VMI can make use of the
cycles_2_ns conversion, which is why I made it available for its use.
To be specific, this is the whole Xen sched_clock function:
/* Xen sched_clock implementation. Returns the number of RUNNING ns */
unsigned long long xen_sched_clock(void)
{
struct vcpu_runstate_info state;
cycle_t now;
unsigned long long ret;
preempt_disable();
now = xen_clocksource_read();
get_runstate_snapshot(&state);
WARN_ON(state.state != RUNSTATE_running);
ret = state.time[RUNSTATE_running] + (now - state.state_entry_time);
preempt_enable();
return ret;
}
J
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists