From patchwork Sat Nov 23 03:53:41 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 293622 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 7EAC52C011C for ; Sat, 23 Nov 2013 14:54:37 +1100 (EST) Received: from localhost ([::1]:42123 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vk4Ig-00056w-1D for incoming@patchwork.ozlabs.org; Fri, 22 Nov 2013 22:54:30 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40033) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vk4IC-0004tz-N3 for qemu-devel@nongnu.org; Fri, 22 Nov 2013 22:54:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vk4I0-0002LX-4A for qemu-devel@nongnu.org; Fri, 22 Nov 2013 22:54:00 -0500 Received: from cantor2.suse.de ([195.135.220.15]:47093 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vk4Hz-0002In-Tu; Fri, 22 Nov 2013 22:53:48 -0500 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 6E0F1A79B0; Sat, 23 Nov 2013 04:53:46 +0100 (CET) From: Alexander Graf To: QEMU Developers Date: Sat, 23 Nov 2013 04:53:41 +0100 Message-Id: <1385178821-1891-3-git-send-email-agraf@suse.de> X-Mailer: git-send-email 1.7.12.4 In-Reply-To: <1385178821-1891-1-git-send-email-agraf@suse.de> References: <1385178821-1891-1-git-send-email-agraf@suse.de> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x X-Received-From: 195.135.220.15 Cc: Bharat Bhushan , "qemu-ppc@nongnu.org list:PowerPC" , Fabien Chouteau Subject: [Qemu-devel] [PATCH 2/2] PPC: BookE: Make FIT/WDT timers at best microsecond grained 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 The default granularity for the FIT timer on 440 is on every 0x1000th transition of TB from 0 to 1. Translated that means 48828 times a second. Since interrupts are quite expensive for 440 and we don't really care about the accuracy of the FIT to that significance, let's force FIT and WDT to at best microsecond granularity. This basically restores behavior as it was in QEMU 1.6, where timers could only deal with microsecond granularities at all. This patch greatly improves performance with the 440 target and restores roughly the same performance level that QEMU 1.6 had for me. Signed-off-by: Alexander Graf --- hw/ppc/ppc_booke.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hw/ppc/ppc_booke.c b/hw/ppc/ppc_booke.c index 28cf9fd..3038acc 100644 --- a/hw/ppc/ppc_booke.c +++ b/hw/ppc/ppc_booke.c @@ -174,6 +174,12 @@ static void booke_update_fixed_timer(CPUPPCState *env, if (*next == now) { (*next)++; + } else { + /* + * There's no point to fake any granularity that's more fine grained + * than microseconds. Anything beyond that just overloads the system. + */ + *next = MAX(*next, now + SCALE_MS); } /* Fire the next timer */