From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44332) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vl3zm-0000V6-Lb for qemu-devel@nongnu.org; Mon, 25 Nov 2013 16:47:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vl3zg-0005Dt-NA for qemu-devel@nongnu.org; Mon, 25 Nov 2013 16:47:06 -0500 From: Alexander Graf Date: Mon, 25 Nov 2013 22:46:55 +0100 Message-Id: <1385416015-22775-3-git-send-email-agraf@suse.de> In-Reply-To: <1385416015-22775-1-git-send-email-agraf@suse.de> References: <1385416015-22775-1-git-send-email-agraf@suse.de> Subject: [Qemu-devel] [PATCH 1.7 v2 2/2] PPC: BookE: Make FIT/WDT timers at best millisecond grained List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: QEMU Developers Cc: Bharat Bhushan , Stefan Weil , "qemu-ppc@nongnu.org list:PowerPC" , Fabien Chouteau 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 millisecond granularity. This basically restores behavior as it was in QEMU 1.6, where timers could only deal with millisecond 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 --- v1 -> v2: - s/microseconds/milliseconds/g --- 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 56c4196..b421620 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 milliseconds. Anything beyond that just overloads the system. + */ + *next = MAX(*next, now + SCALE_MS); } /* Fire the next timer */ -- 1.8.1.4