From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:33615) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1REbax-0004WT-V2 for qemu-devel@nongnu.org; Fri, 14 Oct 2011 02:50:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1REbaq-0004SW-Rk for qemu-devel@nongnu.org; Fri, 14 Oct 2011 02:50:10 -0400 Date: Fri, 14 Oct 2011 17:46:14 +1100 From: David Gibson Message-ID: <20111014064614.GE4580@truffala.fritz.box> References: <1318569548-8537-1-git-send-email-david@gibson.dropbear.id.au> <20111014063631.GD4580@truffala.fritz.box> <600B92AB-F318-4F7B-BF88-C142BB2676F3@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <600B92AB-F318-4F7B-BF88-C142BB2676F3@suse.de> Subject: Re: [Qemu-devel] [Qemu-ppc] [PATCH] ppcr: Avoid decrementer related kvm exits List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Graf Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org On Fri, Oct 14, 2011 at 08:44:06AM +0200, Alexander Graf wrote: > > On 14.10.2011, at 08:36, David Gibson wrote: > > > On Fri, Oct 14, 2011 at 07:30:09AM +0200, Alexander Graf wrote: > >> > >> On 14.10.2011, at 07:19, 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 > >>> Signed-off-by: David Gibson > >>> --- > >>> 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, > >> > >> Do we ever call store_decr in the kvm case? Isn't that only called > >> from emulated mtdec? > > > > Yes, from cpu_ppc_set_tb_clk(). Anton observed the kvm exits in the > > wild, they're not theoretical. > > > > Agh, which reminds me, I forgot to fixup the git author again. The > > patch should show authorship by Anton Blanchard , > > as in the s-o-b. > > Wouldn't a simple > > if (kvm_enabled()) { > return; > } > > in the beginning of the function make more sense? There's no code > connecting the in-qemu and the in-kvm decrementors atm, so any logic > applying to the in-qemu one is moot for kvm. Uh.. I guess so. I wasn't 100% sure the last bit of code in the function wouldn't have some effect on kvm. But I guess it doesn't; I'll revise. -- 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