From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58448) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a3o53-0002f4-Ma for qemu-devel@nongnu.org; Tue, 01 Dec 2015 11:47:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a3o4z-0006EI-IP for qemu-devel@nongnu.org; Tue, 01 Dec 2015 11:47:05 -0500 Received: from mail-qg0-x22f.google.com ([2607:f8b0:400d:c04::22f]:33881) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a3o4z-0006E3-EV for qemu-devel@nongnu.org; Tue, 01 Dec 2015 11:47:01 -0500 Received: by qgeb1 with SMTP id b1so9839621qge.1 for ; Tue, 01 Dec 2015 08:47:01 -0800 (PST) Sender: Richard Henderson References: <1448986767-28016-1-git-send-email-rth@twiddle.net> From: Richard Henderson Message-ID: <565DCF01.4040305@twiddle.net> Date: Tue, 1 Dec 2015 08:46:57 -0800 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH for-2.5] tcg: Increase the highwater reservation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: QEMU Developers , Aurelien Jarno On 12/01/2015 08:28 AM, Peter Maydell wrote: > On 1 December 2015 at 16:19, Richard Henderson wrote: >> If there are a lot of guest memory ops in the TB, the amount of >> code generated by tcg_out_tb_finalize could be well more than 1k. >> In the short term, increase the reservation larger than any TB >> seen in practice. >> >> Reported-by: Aurelien Jarno >> Signed-off-by: Richard Henderson >> --- >> >> Reported and discussed with Aurelien on IRC yesterday. This seems >> to be the easiest fix for the upcoming release. I will fix this >> properly (by modifying every backend's finalize routines) for 2.6. > > What would be the result of our hitting this bug? A segfault, writing to the guard page for the code_gen buffer. > I ask because > there's a report on qemu-discuss about a qemu-i386-on-ARM-host > bug: http://lists.nongnu.org/archive/html/qemu-discuss/2015-11/msg00042.html > and the debug log (http://www.mediafire.com/download/ge611be9vbebbw7/qemu.log) > suggests we're segfaulting in translation on the TB shortly > after we (successfully) translate a TB whose final 'out' size > is 1100 and which has 64 guest writes in it. So I'm wondering > if that's actually the same bug this is fixing... It's plausible. The maximum 32-bit memory op for arm requires 9 insns in the slow path. Times 64 that's 2304 bytes, which exceeds the current highwater buffer space. The new 64k buffer allows for 1820 (arm backend) writes before exceeding the highwater buffer. Which is significantly more than TCG_MAX_INSNS (512), though not even close to OPC_MAX_SIZE (170240), which would require > 6MB in highwater space. r~