diff options
author | Laszlo Ersek <lersek@redhat.com> | 2011-10-18 16:42:59 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-07-21 21:21:27 -0400 |
commit | ac9349c428f94f636e3ca4d5d92cf048dd819518 (patch) | |
tree | 2fa66a31da039cfa675d2f1a04af66c809105bf8 | |
parent | 587562a77c7ab453d16f6b6bb02951bd66c44982 (diff) |
xen/time: remove blocked time accounting from xen "clockchip"
commit 0b0c002c340e78173789f8afaa508070d838cf3d upstream.
... because the "clock_event_device framework" already accounts for idle
time through the "event_handler" function pointer in
xen_timer_interrupt().
The patch is intended as the completion of [1]. It should fix the double
idle times seen in PV guests' /proc/stat [2]. It should be orthogonal to
stolen time accounting (the removed code seems to be isolated).
The approach may be completely misguided.
[1] https://lkml.org/lkml/2011/10/6/10
[2] http://lists.xensource.com/archives/html/xen-devel/2010-08/msg01068.html
John took the time to retest this patch on top of v3.10 and reported:
"idle time is correctly incremented for pv and hvm for the normal
case, nohz=off and nohz=idle." so lets put this patch in.
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: John Haxby <john.haxby@oracle.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | arch/x86/xen/time.c | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c index 3d88bfdf9e1c..13e8935e2eab 100644 --- a/arch/x86/xen/time.c +++ b/arch/x86/xen/time.c | |||
@@ -36,9 +36,8 @@ static DEFINE_PER_CPU(struct vcpu_runstate_info, xen_runstate); | |||
36 | /* snapshots of runstate info */ | 36 | /* snapshots of runstate info */ |
37 | static DEFINE_PER_CPU(struct vcpu_runstate_info, xen_runstate_snapshot); | 37 | static DEFINE_PER_CPU(struct vcpu_runstate_info, xen_runstate_snapshot); |
38 | 38 | ||
39 | /* unused ns of stolen and blocked time */ | 39 | /* unused ns of stolen time */ |
40 | static DEFINE_PER_CPU(u64, xen_residual_stolen); | 40 | static DEFINE_PER_CPU(u64, xen_residual_stolen); |
41 | static DEFINE_PER_CPU(u64, xen_residual_blocked); | ||
42 | 41 | ||
43 | /* return an consistent snapshot of 64-bit time/counter value */ | 42 | /* return an consistent snapshot of 64-bit time/counter value */ |
44 | static u64 get64(const u64 *p) | 43 | static u64 get64(const u64 *p) |
@@ -115,7 +114,7 @@ static void do_stolen_accounting(void) | |||
115 | { | 114 | { |
116 | struct vcpu_runstate_info state; | 115 | struct vcpu_runstate_info state; |
117 | struct vcpu_runstate_info *snap; | 116 | struct vcpu_runstate_info *snap; |
118 | s64 blocked, runnable, offline, stolen; | 117 | s64 runnable, offline, stolen; |
119 | cputime_t ticks; | 118 | cputime_t ticks; |
120 | 119 | ||
121 | get_runstate_snapshot(&state); | 120 | get_runstate_snapshot(&state); |
@@ -125,7 +124,6 @@ static void do_stolen_accounting(void) | |||
125 | snap = &__get_cpu_var(xen_runstate_snapshot); | 124 | snap = &__get_cpu_var(xen_runstate_snapshot); |
126 | 125 | ||
127 | /* work out how much time the VCPU has not been runn*ing* */ | 126 | /* work out how much time the VCPU has not been runn*ing* */ |
128 | blocked = state.time[RUNSTATE_blocked] - snap->time[RUNSTATE_blocked]; | ||
129 | runnable = state.time[RUNSTATE_runnable] - snap->time[RUNSTATE_runnable]; | 127 | runnable = state.time[RUNSTATE_runnable] - snap->time[RUNSTATE_runnable]; |
130 | offline = state.time[RUNSTATE_offline] - snap->time[RUNSTATE_offline]; | 128 | offline = state.time[RUNSTATE_offline] - snap->time[RUNSTATE_offline]; |
131 | 129 | ||
@@ -141,17 +139,6 @@ static void do_stolen_accounting(void) | |||
141 | ticks = iter_div_u64_rem(stolen, NS_PER_TICK, &stolen); | 139 | ticks = iter_div_u64_rem(stolen, NS_PER_TICK, &stolen); |
142 | __this_cpu_write(xen_residual_stolen, stolen); | 140 | __this_cpu_write(xen_residual_stolen, stolen); |
143 | account_steal_ticks(ticks); | 141 | account_steal_ticks(ticks); |
144 | |||
145 | /* Add the appropriate number of ticks of blocked time, | ||
146 | including any left-overs from last time. */ | ||
147 | blocked += __this_cpu_read(xen_residual_blocked); | ||
148 | |||
149 | if (blocked < 0) | ||
150 | blocked = 0; | ||
151 | |||
152 | ticks = iter_div_u64_rem(blocked, NS_PER_TICK, &blocked); | ||
153 | __this_cpu_write(xen_residual_blocked, blocked); | ||
154 | account_idle_ticks(ticks); | ||
155 | } | 142 | } |
156 | 143 | ||
157 | /* Get the TSC speed from Xen */ | 144 | /* Get the TSC speed from Xen */ |