aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/xen/time.c17
1 files changed, 2 insertions, 15 deletions
diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c
index aec0b14b6d76..a690868be837 100644
--- a/arch/x86/xen/time.c
+++ b/arch/x86/xen/time.c
@@ -37,9 +37,8 @@ static DEFINE_PER_CPU(struct vcpu_runstate_info, xen_runstate);
37/* snapshots of runstate info */ 37/* snapshots of runstate info */
38static DEFINE_PER_CPU(struct vcpu_runstate_info, xen_runstate_snapshot); 38static DEFINE_PER_CPU(struct vcpu_runstate_info, xen_runstate_snapshot);
39 39
40/* unused ns of stolen and blocked time */ 40/* unused ns of stolen time */
41static DEFINE_PER_CPU(u64, xen_residual_stolen); 41static DEFINE_PER_CPU(u64, xen_residual_stolen);
42static DEFINE_PER_CPU(u64, xen_residual_blocked);
43 42
44/* return an consistent snapshot of 64-bit time/counter value */ 43/* return an consistent snapshot of 64-bit time/counter value */
45static u64 get64(const u64 *p) 44static u64 get64(const u64 *p)
@@ -116,7 +115,7 @@ static void do_stolen_accounting(void)
116{ 115{
117 struct vcpu_runstate_info state; 116 struct vcpu_runstate_info state;
118 struct vcpu_runstate_info *snap; 117 struct vcpu_runstate_info *snap;
119 s64 blocked, runnable, offline, stolen; 118 s64 runnable, offline, stolen;
120 cputime_t ticks; 119 cputime_t ticks;
121 120
122 get_runstate_snapshot(&state); 121 get_runstate_snapshot(&state);
@@ -126,7 +125,6 @@ static void do_stolen_accounting(void)
126 snap = &__get_cpu_var(xen_runstate_snapshot); 125 snap = &__get_cpu_var(xen_runstate_snapshot);
127 126
128 /* work out how much time the VCPU has not been runn*ing* */ 127 /* work out how much time the VCPU has not been runn*ing* */
129 blocked = state.time[RUNSTATE_blocked] - snap->time[RUNSTATE_blocked];
130 runnable = state.time[RUNSTATE_runnable] - snap->time[RUNSTATE_runnable]; 128 runnable = state.time[RUNSTATE_runnable] - snap->time[RUNSTATE_runnable];
131 offline = state.time[RUNSTATE_offline] - snap->time[RUNSTATE_offline]; 129 offline = state.time[RUNSTATE_offline] - snap->time[RUNSTATE_offline];
132 130
@@ -142,17 +140,6 @@ static void do_stolen_accounting(void)
142 ticks = iter_div_u64_rem(stolen, NS_PER_TICK, &stolen); 140 ticks = iter_div_u64_rem(stolen, NS_PER_TICK, &stolen);
143 __this_cpu_write(xen_residual_stolen, stolen); 141 __this_cpu_write(xen_residual_stolen, stolen);
144 account_steal_ticks(ticks); 142 account_steal_ticks(ticks);
145
146 /* Add the appropriate number of ticks of blocked time,
147 including any left-overs from last time. */
148 blocked += __this_cpu_read(xen_residual_blocked);
149
150 if (blocked < 0)
151 blocked = 0;
152
153 ticks = iter_div_u64_rem(blocked, NS_PER_TICK, &blocked);
154 __this_cpu_write(xen_residual_blocked, blocked);
155 account_idle_ticks(ticks);
156} 143}
157 144
158/* Get the TSC speed from Xen */ 145/* Get the TSC speed from Xen */