Commit 0b0c002c authored by Laszlo Ersek's avatar Laszlo Ersek Committed by Konrad Rzeszutek Wilk

xen/time: remove blocked time accounting from xen "clockchip"

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

CC: stable@vger.kernel.org
Signed-off-by: default avatarLaszlo Ersek <lersek@redhat.com>
Signed-off-by: default avatarJohn Haxby <john.haxby@oracle.com>
Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
parent 283c0972
...@@ -37,9 +37,8 @@ static DEFINE_PER_CPU(struct vcpu_runstate_info, xen_runstate); ...@@ -37,9 +37,8 @@ static DEFINE_PER_CPU(struct vcpu_runstate_info, xen_runstate);
/* snapshots of runstate info */ /* snapshots of runstate info */
static DEFINE_PER_CPU(struct vcpu_runstate_info, xen_runstate_snapshot); static DEFINE_PER_CPU(struct vcpu_runstate_info, xen_runstate_snapshot);
/* unused ns of stolen and blocked time */ /* unused ns of stolen time */
static DEFINE_PER_CPU(u64, xen_residual_stolen); static DEFINE_PER_CPU(u64, xen_residual_stolen);
static DEFINE_PER_CPU(u64, xen_residual_blocked);
/* return an consistent snapshot of 64-bit time/counter value */ /* return an consistent snapshot of 64-bit time/counter value */
static u64 get64(const u64 *p) static u64 get64(const u64 *p)
...@@ -116,7 +115,7 @@ static void do_stolen_accounting(void) ...@@ -116,7 +115,7 @@ static void do_stolen_accounting(void)
{ {
struct vcpu_runstate_info state; struct vcpu_runstate_info state;
struct vcpu_runstate_info *snap; struct vcpu_runstate_info *snap;
s64 blocked, runnable, offline, stolen; s64 runnable, offline, stolen;
cputime_t ticks; cputime_t ticks;
get_runstate_snapshot(&state); get_runstate_snapshot(&state);
...@@ -126,7 +125,6 @@ static void do_stolen_accounting(void) ...@@ -126,7 +125,6 @@ static void do_stolen_accounting(void)
snap = &__get_cpu_var(xen_runstate_snapshot); snap = &__get_cpu_var(xen_runstate_snapshot);
/* work out how much time the VCPU has not been runn*ing* */ /* work out how much time the VCPU has not been runn*ing* */
blocked = state.time[RUNSTATE_blocked] - snap->time[RUNSTATE_blocked];
runnable = state.time[RUNSTATE_runnable] - snap->time[RUNSTATE_runnable]; runnable = state.time[RUNSTATE_runnable] - snap->time[RUNSTATE_runnable];
offline = state.time[RUNSTATE_offline] - snap->time[RUNSTATE_offline]; offline = state.time[RUNSTATE_offline] - snap->time[RUNSTATE_offline];
...@@ -142,17 +140,6 @@ static void do_stolen_accounting(void) ...@@ -142,17 +140,6 @@ static void do_stolen_accounting(void)
ticks = iter_div_u64_rem(stolen, NS_PER_TICK, &stolen); ticks = iter_div_u64_rem(stolen, NS_PER_TICK, &stolen);
__this_cpu_write(xen_residual_stolen, stolen); __this_cpu_write(xen_residual_stolen, stolen);
account_steal_ticks(ticks); account_steal_ticks(ticks);
/* Add the appropriate number of ticks of blocked time,
including any left-overs from last time. */
blocked += __this_cpu_read(xen_residual_blocked);
if (blocked < 0)
blocked = 0;
ticks = iter_div_u64_rem(blocked, NS_PER_TICK, &blocked);
__this_cpu_write(xen_residual_blocked, blocked);
account_idle_ticks(ticks);
} }
/* Get the TSC speed from Xen */ /* Get the TSC speed from Xen */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment