All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] ppc: Avoid decrementer related kvm exits
@ 2011-10-17  5:26 David Gibson
  2011-10-20 17:08 ` Alexander Graf
  0 siblings, 1 reply; 3+ messages in thread
From: David Gibson @ 2011-10-17  5:26 UTC (permalink / raw)
  To: agraf; +Cc: qemu-ppc, qemu-devel

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 <anton@au1.ibm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
 hw/ppc.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/hw/ppc.c b/hw/ppc.c
index 25b59dd..d29af0b 100644
--- a/hw/ppc.c
+++ b/hw/ppc.c
@@ -662,6 +662,12 @@ static void __cpu_ppc_store_decr (CPUState *env, uint64_t *nextp,
 
     LOG_TB("%s: %08" PRIx32 " => %08" PRIx32 "\n", __func__,
                 decr, value);
+
+    if (kvm_enabled()) {
+        /* KVM handles decrementer exceptions, we don't need our own timer */
+        return;
+    }
+
     now = qemu_get_clock_ns(vm_clock);
     next = now + muldiv64(value, get_ticks_per_sec(), tb_env->decr_freq);
     if (is_excp) {
-- 
1.7.6.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] ppc: Avoid decrementer related kvm exits
  2011-10-17  5:26 [Qemu-devel] [PATCH] ppc: Avoid decrementer related kvm exits David Gibson
@ 2011-10-20 17:08 ` Alexander Graf
  2011-10-21  1:13   ` [Qemu-devel] [Qemu-ppc] " David Gibson
  0 siblings, 1 reply; 3+ messages in thread
From: Alexander Graf @ 2011-10-20 17:08 UTC (permalink / raw)
  To: David Gibson; +Cc: qemu-ppc, qemu-devel


On 16.10.2011, at 22:26, David Gibson wrote:

> 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 <anton@au1.ibm.com>
> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>

Thanks, applied to ppc-next.


Alex

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [Qemu-ppc] [PATCH] ppc: Avoid decrementer related kvm exits
  2011-10-20 17:08 ` Alexander Graf
@ 2011-10-21  1:13   ` David Gibson
  0 siblings, 0 replies; 3+ messages in thread
From: David Gibson @ 2011-10-21  1:13 UTC (permalink / raw)
  To: Alexander Graf; +Cc: qemu-ppc, qemu-devel

On Thu, Oct 20, 2011 at 10:08:36AM -0700, Alexander Graf wrote:
> 
> On 16.10.2011, at 22:26, David Gibson wrote:
> 
> > 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 <anton@au1.ibm.com>
> > Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
> 
> Thanks, applied to ppc-next.

I think you've forgotten to push out the new ppc-next again..

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-10-21  2:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-17  5:26 [Qemu-devel] [PATCH] ppc: Avoid decrementer related kvm exits David Gibson
2011-10-20 17:08 ` Alexander Graf
2011-10-21  1:13   ` [Qemu-devel] [Qemu-ppc] " David Gibson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.