Received: from [140.186.70.92] (port=49975 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q4WM5-0004PY-5a for qemu-devel@nongnu.org; Tue, 29 Mar 2011 06:40:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q4WM4-0002fC-1B for qemu-devel@nongnu.org; Tue, 29 Mar 2011 06:40:57 -0400 Received: from cantor2.suse.de ([195.135.220.15]:34134 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q4WM3-0002ej-Nl for qemu-devel@nongnu.org; Tue, 29 Mar 2011 06:40:55 -0400 Subject: Re: [Qemu-devel] [PATCH 16/17] s390x: translate engine for s390x CPU Mime-Version: 1.0 (Apple Message framework v1082) Content-Type: text/plain; charset=us-ascii From: Alexander Graf In-Reply-To: Date: Tue, 29 Mar 2011 12:40:52 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: <0FDBD405-AF62-45EB-9A24-1E4454FFEEF3@suse.de> References: <1300982333-12802-1-git-send-email-agraf@suse.de> <1300982333-12802-17-git-send-email-agraf@suse.de> <12C85935-908B-4740-8E1B-DDB3B57B124A@suse.de> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: QEMU-devel Developers , Aurelien Jarno , Richard Henderson On 29.03.2011, at 11:56, Peter Maydell wrote: > On 29 March 2011 10:25, Alexander Graf wrote: >> On 29.03.2011, at 11:17, Peter Maydell wrote: >>> On 29 March 2011 09:55, Alexander Graf wrote: >>>> On 28.03.2011, at 17:40, Peter Maydell wrote: >>>>> Doesn't this take you over MAX_OP_PER_INSTR for some cases? >>>>=20 >>>> I haven't encountered any case where it does. >>>=20 >>> Really? MAX_OP_PER_INSTR's only 96, so if you have 16 registers >>> in your loop then it only needs 6 ops per register to hit that, >>> and the op 0x96 case looks like it must generate more than that. >>>=20 >>> I have an item on my todo list to see if I can add an assert() >>> check for this limit, because there are cases for Neon load/stores >>> that apparently hit it. >>=20 >> Hrm - might be useful to increase MAX_OP_PER_INSTR then, no? >=20 > The TCG README suggests that 20 ops is the point at which it's > better to use a helper function. I don't know if that advice > still holds true or not. Well, the amount of stores / loads stays the same throughout a helper or = not. The main reason to not use a "heavy" helper is that all the = register values need to be flushed out, adding quite substantial = overhead for the stores/loads on those. When flushing them, tcg also = loses its ability to predict which values are used, so dead code = elimination is moot. So yes, complex operations that could be optimized by a C compiler = should go into helpers - preferably if they only use input and output = values that get passed as registers. As soon as they touch memory or env = though, the world isn't as great anymore :(. >=20 >>>> The user code needs to know where it jumps back to, while the >>>> exception generation code needs to get the exact position it was >>>> in to generate some more metadata. >>>=20 >>> Ah. For ARM we do this by advancing env->regs[15] in = linux-user/main.c >>> cpu_loop() when we get an EXCP_SWI. It looks like we do it that way >>> for MIPS and SPARC at least too, so I guess it would be better for >>> s390 to follow that pattern. >>=20 >> Unfortunately, it's not that easy as there are 2 different ways of >> issuing an SVC (actual SVC and EXECUTE instruction), both of which >> having different instruction lengths. So we really need to keep the >> information in the instruction decoder :( >=20 > Does a Linux kernel running on a real s/390 system have to deal with > the distinction in its SVC entrypoint? An s390 kernel gets the size information as interrupt parameter, so it = can simply calculate the NIP from that. Alex