From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([209.51.188.92]:36793) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gi4zG-000802-0i for qemu-devel@nongnu.org; Fri, 11 Jan 2019 17:09:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gi4zF-0006yr-BM for qemu-devel@nongnu.org; Fri, 11 Jan 2019 17:09:10 -0500 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]:43476) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gi4zE-0006yE-R0 for qemu-devel@nongnu.org; Fri, 11 Jan 2019 17:09:09 -0500 Received: by mail-pf1-x442.google.com with SMTP id w73so7557936pfk.10 for ; Fri, 11 Jan 2019 14:09:08 -0800 (PST) References: <20190111220131.27153-1-jcmvbkbc@gmail.com> From: Richard Henderson Message-ID: <2064503c-ed12-de29-59a9-46fa24d22f60@linaro.org> Date: Sat, 12 Jan 2019 09:09:01 +1100 MIME-Version: 1.0 In-Reply-To: <20190111220131.27153-1-jcmvbkbc@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2] target/xtensa: rework zero overhead loops implementation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Filippov , qemu-devel@nongnu.org On 1/12/19 9:01 AM, Max Filippov wrote: > Don't invalidate TB with the end of zero overhead loop when LBEG or LEND > change. Instead encode the distance from the start of the page where the > TB starts to the LEND in the TB cs_base and generate loopback code when > the next PC matches encoded LEND. Distance to a destination within the > same page and up to a maximum instruction length into the next page is > encoded literally, otherwise it's zero. The distance from LEND to LBEG > is also encoded in the cs_base: it's encoded literally when less than > 256 or as 0 otherwise. This allows for TB chaining for the loopback > branch at the end of a loop for the most common loop sizes. > > With this change the resulting emulation speed is about 10% higher in > softmmu mode on uClibc-ng and LTP tests. Emulation speed in linux > user mode is a few percent lower because there's no direct TB chaining > between different memory pages. Testing with lower limit on direct TB > chainig range shows gradual slowdown to ~15% for the block size of 64 > bytes and ~50% for the block size of 32 bytes. > > Signed-off-by: Max Filippov Reviewed-by: Richard Henderson > + /* > + * 0 in the csbase_lend field means that there may not be a loopback > + * for any instruction that starts inside this page. Any other value > + * means that an instruction that ends at this offset from the page > + * start may loop back. Nit: s/may/will/g Using "may" makes it seem like we may have missed a case that should have looped back. r~