aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/xen/time.c
diff options
context:
space:
mode:
authorJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>2010-07-12 14:49:59 -0400
committerJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>2010-08-04 17:47:29 -0400
commit8a22b9996b001c88f2bfb54c6de6a05fc39e177a (patch)
treefaf40add399c0652c7d2b2cdf0f01d805a91e207 /arch/x86/xen/time.c
parent31de189f7d02da163f77d46a86d9e655a2d83124 (diff)
xen: drop xen_sched_clock in favour of using plain wallclock time
xen_sched_clock only counts unstolen time. In principle this should be useful to the Linux scheduler so that it knows how much time a process actually consumed. But in practice this doesn't work very well as the scheduler expects the sched_clock time to be synchronized between cpus. It also uses sched_clock to measure the time a task spends sleeping, in which case "unstolen time" isn't meaningful. So just use plain xen_clocksource_read to return wallclock nanoseconds for sched_clock. Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Diffstat (limited to 'arch/x86/xen/time.c')
-rw-r--r--arch/x86/xen/time.c39
1 files changed, 0 insertions, 39 deletions
diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c
index 32764b8880b5..e90360ff4a08 100644
--- a/arch/x86/xen/time.c
+++ b/arch/x86/xen/time.c
@@ -155,45 +155,6 @@ static void do_stolen_accounting(void)
155 account_idle_ticks(ticks); 155 account_idle_ticks(ticks);
156} 156}
157 157
158/*
159 * Xen sched_clock implementation. Returns the number of unstolen
160 * nanoseconds, which is nanoseconds the VCPU spent in RUNNING+BLOCKED
161 * states.
162 */
163unsigned long long xen_sched_clock(void)
164{
165 struct vcpu_runstate_info state;
166 cycle_t now;
167 u64 ret;
168 s64 offset;
169
170 /*
171 * Ideally sched_clock should be called on a per-cpu basis
172 * anyway, so preempt should already be disabled, but that's
173 * not current practice at the moment.
174 */
175 preempt_disable();
176
177 now = xen_clocksource_read();
178
179 get_runstate_snapshot(&state);
180
181 WARN_ON(state.state != RUNSTATE_running);
182
183 offset = now - state.state_entry_time;
184 if (offset < 0)
185 offset = 0;
186
187 ret = state.time[RUNSTATE_blocked] +
188 state.time[RUNSTATE_running] +
189 offset;
190
191 preempt_enable();
192
193 return ret;
194}
195
196
197/* Get the TSC speed from Xen */ 158/* Get the TSC speed from Xen */
198unsigned long xen_tsc_khz(void) 159unsigned long xen_tsc_khz(void)
199{ 160{