[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PATCH] ppcr: Avoid decrementer related kvm exits
From: |
David Gibson |
Subject: |
[Qemu-ppc] [PATCH] ppcr: Avoid decrementer related kvm exits |
Date: |
Fri, 14 Oct 2011 16:19:08 +1100 |
In __cpu_ppc_store_decr(), we set up a regular timer used to trigger
decrementer interrupts. This is necessary to implement the decrementer
properly under TCG, but is unnecessary under KVM (true for both Book3S-PR
and Book3S-HV KVM variants), because the kernel handles generating and
delivering decrementer exceptions.
Under kvm, in fact, the timer causes expensive and unnecessary exits from
kvm to qemu. This patch, therefore, disables setting the timer when kvm
is in use.
Signed-off-by: Anton Blanchard <address@hidden>
Signed-off-by: David Gibson <address@hidden>
---
hw/ppc.c | 25 ++++++++++++++-----------
1 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/hw/ppc.c b/hw/ppc.c
index 25b59dd..87aa4e5 100644
--- a/hw/ppc.c
+++ b/hw/ppc.c
@@ -658,21 +658,24 @@ static void __cpu_ppc_store_decr (CPUState *env, uint64_t
*nextp,
int is_excp)
{
ppc_tb_t *tb_env = env->tb_env;
- uint64_t now, next;
LOG_TB("%s: %08" PRIx32 " => %08" PRIx32 "\n", __func__,
decr, value);
- now = qemu_get_clock_ns(vm_clock);
- next = now + muldiv64(value, get_ticks_per_sec(), tb_env->decr_freq);
- if (is_excp) {
- next += *nextp - now;
- }
- if (next == now) {
- next++;
+ if (!kvm_enabled()) {
+ uint64_t now, next;
+
+ now = qemu_get_clock_ns(vm_clock);
+ next = now + muldiv64(value, get_ticks_per_sec(), tb_env->decr_freq);
+ if (is_excp) {
+ next += *nextp - now;
+ }
+ if (next == now) {
+ next++;
+ }
+ *nextp = next;
+ /* Adjust timer */
+ qemu_mod_timer(timer, next);
}
- *nextp = next;
- /* Adjust timer */
- qemu_mod_timer(timer, next);
/* If we set a negative value and the decrementer was positive, raise an
* exception.
--
1.7.6.3
- [Qemu-ppc] [PATCH] ppcr: Avoid decrementer related kvm exits,
David Gibson <=