From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LjXXP-0007YT-Tc for qemu-devel@nongnu.org; Tue, 17 Mar 2009 07:32:51 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LjXXL-0007Wq-8q for qemu-devel@nongnu.org; Tue, 17 Mar 2009 07:32:51 -0400 Received: from [199.232.76.173] (port=36387 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LjXXL-0007Wm-5x for qemu-devel@nongnu.org; Tue, 17 Mar 2009 07:32:47 -0400 Received: from gecko.sbs.de ([194.138.37.40]:21566) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LjXXK-00067L-Ml for qemu-devel@nongnu.org; Tue, 17 Mar 2009 07:32:47 -0400 Received: from mail2.sbs.de (localhost [127.0.0.1]) by gecko.sbs.de (8.12.11.20060308/8.12.11) with ESMTP id n2HBWiDT009713 for ; Tue, 17 Mar 2009 12:32:44 +0100 Received: from [139.25.109.167] (mchn012c.mchp.siemens.de [139.25.109.167] (may be forged)) by mail2.sbs.de (8.12.11.20060308/8.12.11) with ESMTP id n2HBWh4t020581 for ; Tue, 17 Mar 2009 12:32:44 +0100 Message-ID: <49BF8A5B.7070706@siemens.com> Date: Tue, 17 Mar 2009 12:32:43 +0100 From: Jan Kiszka MIME-Version: 1.0 References: <49BF86FC.4060206@redhat.com> In-Reply-To: <49BF86FC.4060206@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: branches are expensive Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Avi Kivity wrote: > Steffen Liebergeld wrote: >> Hi, >> >> while measuring the execution of an ARM guest, I encountered that >> branches are >> extremely expensive in terms of executed host instructions. A single ARM >> branch takes 148 to 152 host instructions. In my setup host and guest >> use the >> ARM instruction set architecture. >> >> My question is what makes branches so expensive? What code is run when >> executing a branch? Other instructions are translated to 14 to 40 >> instructions. >> > > I'm no tcg guru, but if branches are not chained, you'd need an > expensive lookup to find the next translation block. If branches are > chained they'll probably be much faster. That is probably the reason. You can check to generated host code and compare it to the guest code via -d in_asm,out_asm (or via the monitor: log in_asm,out_asm), logs will be written /tmp/qemu.log by default. The ratio of direct (chained) jumps is given via "info jit". Jan -- Siemens AG, Corporate Technology, CT SE 2 Corporate Competence Center Embedded Linux