diff options
author | Frederic Weisbecker <fweisbec@gmail.com> | 2013-07-12 13:02:30 -0400 |
---|---|---|
committer | Frederic Weisbecker <fweisbec@gmail.com> | 2013-08-12 18:40:44 -0400 |
commit | 2d854e5738cded368a0759f85b1197f5c044513d (patch) | |
tree | 14d2353e1dd594e9b695c250e3955c1da1eaf102 /kernel/context_tracking.c | |
parent | fbb00b568bc93073452d2a0f9f06e7c33d16eece (diff) |
context_tracing: Fix guest accounting with native vtime
1) If context tracking is enabled with native vtime accounting (which
combo is useless except for dev testing), we call vtime_guest_enter()
and vtime_guest_exit() on host <-> guest switches. But those are stubs
in this configurations. As a result, cputime is not correctly flushed
on kvm context switches.
2) If context tracking runs but is disabled on some CPUs, those
CPUs end up calling __guest_enter/__guest_exit which in turn
call vtime_account_system(). We don't want to call this because we
run in tick based accounting for these CPUs.
Refactor the guest_enter/guest_exit code such that all combinations
finally work.
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Li Zhong <zhong@linux.vnet.ibm.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Kevin Hilman <khilman@linaro.org>
Diffstat (limited to 'kernel/context_tracking.c')
-rw-r--r-- | kernel/context_tracking.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/kernel/context_tracking.c b/kernel/context_tracking.c index 942835c12ae5..1f47119c5b09 100644 --- a/kernel/context_tracking.c +++ b/kernel/context_tracking.c | |||
@@ -141,12 +141,13 @@ void user_exit(void) | |||
141 | local_irq_restore(flags); | 141 | local_irq_restore(flags); |
142 | } | 142 | } |
143 | 143 | ||
144 | #ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN | ||
144 | void guest_enter(void) | 145 | void guest_enter(void) |
145 | { | 146 | { |
146 | if (vtime_accounting_enabled()) | 147 | if (vtime_accounting_enabled()) |
147 | vtime_guest_enter(current); | 148 | vtime_guest_enter(current); |
148 | else | 149 | else |
149 | __guest_enter(); | 150 | current->flags |= PF_VCPU; |
150 | } | 151 | } |
151 | EXPORT_SYMBOL_GPL(guest_enter); | 152 | EXPORT_SYMBOL_GPL(guest_enter); |
152 | 153 | ||
@@ -155,9 +156,10 @@ void guest_exit(void) | |||
155 | if (vtime_accounting_enabled()) | 156 | if (vtime_accounting_enabled()) |
156 | vtime_guest_exit(current); | 157 | vtime_guest_exit(current); |
157 | else | 158 | else |
158 | __guest_exit(); | 159 | current->flags &= ~PF_VCPU; |
159 | } | 160 | } |
160 | EXPORT_SYMBOL_GPL(guest_exit); | 161 | EXPORT_SYMBOL_GPL(guest_exit); |
162 | #endif /* CONFIG_VIRT_CPU_ACCOUNTING_GEN */ | ||
161 | 163 | ||
162 | 164 | ||
163 | /** | 165 | /** |