From patchwork Thu Jun 18 09:08:13 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aurelien Jarno X-Patchwork-Id: 486231 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 554811401DA for ; Thu, 18 Jun 2015 19:20:26 +1000 (AEST) Received: from localhost ([::1]:51285 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z5Vzk-0001fB-FU for incoming@patchwork.ozlabs.org; Thu, 18 Jun 2015 05:20:24 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38424) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z5Vo6-0006s0-7A for qemu-devel@nongnu.org; Thu, 18 Jun 2015 05:08:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z5Vo1-0008Km-S5 for qemu-devel@nongnu.org; Thu, 18 Jun 2015 05:08:22 -0400 Received: from hall.aurel32.net ([2001:bc8:30d7:101::1]:35409) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z5Vo1-0008KP-LN for qemu-devel@nongnu.org; Thu, 18 Jun 2015 05:08:17 -0400 Received: from weber.rr44.fr ([2001:470:d4ed:0:7e05:7ff:fe0d:f152]) by hall.aurel32.net with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84) (envelope-from ) id 1Z5Vny-0004zb-Or; Thu, 18 Jun 2015 11:08:14 +0200 Received: from aurel32 by weber.rr44.fr with local (Exim 4.85) (envelope-from ) id 1Z5Vnx-0007G1-LA; Thu, 18 Jun 2015 11:08:13 +0200 Date: Thu, 18 Jun 2015 11:08:13 +0200 From: Aurelien Jarno To: Pavel Dovgaluk Message-ID: <20150618090813.GF19635@aurel32.net> References: <20150617124158.3316.54954.stgit@PASHA-ISP> <20150617141901.GE19635@aurel32.net> <001101d0a996$19a72f80$4cf58e80$@Dovgaluk@ispras.ru> <20150618081640.GK931@aurel32.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20150618081640.GK931@aurel32.net> User-Agent: Mutt/1.5.23 (2014-03-12) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:bc8:30d7:101::1 Cc: pbonzini@redhat.com, rth7680@gmail.com, leon.alrae@imgtec.com, qemu-devel@nongnu.org Subject: Re: [Qemu-devel] [PATCH v2 0/3] Fix exceptions handling for MIPS and i386 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 On 2015-06-18 10:16, Aurelien Jarno wrote: > On x86, this patch brings a 5% boot time improvement on MIPS. One of the > reason is that the TCG code generator has a good knowledge about which > TCG ops or helpers can trigger an exception, so it can optimize out part > of the instructions saving the CPU state. I guess that the host CPUs have > also evolved over the time, now being superscalar and out-of-order so > that saving the CPU state can be done "in background". Also it's just a > quick and dirty patch, we can probably even do better. > > All of that to say that I am worried for the performances to see more > paths through the retranslation code, especially on MIPS as it seems to > be costly. That said I haven't really look in details at other targets, > nor hosts. For an i386 guest still on an x86 host, I get a 4% slower boot time by not using retranslation (see patch below). This is not that much compared to the complexity retranslation bring us. diff --git a/target-i386/translate.c b/target-i386/translate.c index 58b1959..de65bba 100644 --- a/target-i386/translate.c +++ b/target-i386/translate.c @@ -8001,6 +8001,9 @@ static inline void gen_intermediate_code_internal(X86CPU *cpu, gen_tb_start(tb); for(;;) { + gen_update_cc_op(dc); + gen_jmp_im(pc_ptr - dc->cs_base); + if (unlikely(!QTAILQ_EMPTY(&cs->breakpoints))) { QTAILQ_FOREACH(bp, &cs->breakpoints, entry) { if (bp->pc == pc_ptr && diff --git a/translate-all.c b/translate-all.c index b6b0e1c..3d4c017 100644 --- a/translate-all.c +++ b/translate-all.c @@ -212,6 +212,8 @@ static int cpu_restore_state_from_tb(CPUState *cpu, TranslationBlock *tb, int64_t ti; #endif + return -1; + #ifdef CONFIG_PROFILER ti = profile_getclock(); #endif