From patchwork Mon Oct 17 05:25:02 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 120090 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id A5C4BB6F8B for ; Mon, 17 Oct 2011 16:25:32 +1100 (EST) Received: from localhost ([::1]:44831 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RFfhX-0000h5-S4 for incoming@patchwork.ozlabs.org; Mon, 17 Oct 2011 01:25:27 -0400 Received: from eggs.gnu.org ([140.186.70.92]:53684) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RFfhO-0000gk-2r for qemu-devel@nongnu.org; Mon, 17 Oct 2011 01:25:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RFfhI-0003Ry-Vr for qemu-devel@nongnu.org; Mon, 17 Oct 2011 01:25:17 -0400 Received: from ozlabs.org ([203.10.76.45]:51720) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RFfhI-0003Rs-Bs; Mon, 17 Oct 2011 01:25:12 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 9E756B6F97; Mon, 17 Oct 2011 16:25:09 +1100 (EST) From: David Gibson To: agraf@sus.de Date: Mon, 17 Oct 2011 16:25:02 +1100 Message-Id: <1318829102-30631-1-git-send-email-david@gibson.dropbear.id.au> X-Mailer: git-send-email 1.7.6.3 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 203.10.76.45 Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH] ppc: Avoid decrementer related kvm exits X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 | 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) {