From patchwork Mon Jan 23 07:50:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Pavel Dovgalyuk X-Patchwork-Id: 718409 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 3v6NmN1zdcz9ryr for ; Mon, 23 Jan 2017 18:51:15 +1100 (AEDT) Received: from localhost ([::1]:39635 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cVZPD-0005dv-1q for incoming@patchwork.ozlabs.org; Mon, 23 Jan 2017 02:51:11 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37009) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cVZOV-0005MW-I1 for qemu-devel@nongnu.org; Mon, 23 Jan 2017 02:50:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cVZOR-0003dX-ML for qemu-devel@nongnu.org; Mon, 23 Jan 2017 02:50:27 -0500 Received: from mail.ispras.ru ([83.149.199.45]:34596) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cVZOR-0003dA-Fl for qemu-devel@nongnu.org; Mon, 23 Jan 2017 02:50:23 -0500 Received: from PASHAISP (unknown [85.142.117.226]) by mail.ispras.ru (Postfix) with ESMTPSA id D4E8254006B; Mon, 23 Jan 2017 10:50:20 +0300 (MSK) From: "Pavel Dovgalyuk" To: =?utf-8?Q?'Alex_Benn=C3=A9e'?= References: <000301d259dc$f9d097c0$ed71c740$@ru> <000601d25a95$12b1b9f0$38152dd0$@ru> <20161220102126.GE5602@stefanha-x1.localdomain> <002501d25ab1$af024b00$0d06e100$@ru> <000301d25b4f$20018440$60048cc0$@ru> <000801d26bd9$dca56db0$95f04910$@ru> <87o9zd3jta.fsf@linaro.org> <000e01d26caa$dfdb3150$9f9193f0$@ru> <87mveleiw8.fsf@linaro.org> In-Reply-To: <87mveleiw8.fsf@linaro.org> Date: Mon, 23 Jan 2017 10:50:22 +0300 Message-ID: <000c01d2754d$59a4cd70$0cee6850$@ru> MIME-Version: 1.0 X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: AdJzQ0cZnNFM4WDkS9Wuhg3/SJdPPACCY+0g Content-Language: ru X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 83.149.199.45 Subject: Re: [Qemu-devel] qemu-2.8-rc4 is broken X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: 'Peter Maydell' , 'Stefan Hajnoczi' , 'qemu-devel' , 'Pavel Dovgalyuk' , 'Paolo Bonzini' Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" > From: Alex Bennée [mailto:alex.bennee@linaro.org] > Pavel Dovgalyuk writes: > > >> From: Alex Bennée [mailto:alex.bennee@linaro.org] > > > > Sorry, this is another problem which occurs only in icount replay mode: > > 1. cpu_handle_exception tries to force exception when is cannot occur due to > > running out all the planned instructions: > > } else if (replay_has_exception() > > && cpu->icount_decr.u16.low + cpu->icount_extra == 0) { > > /* try to cause an exception pending in the log */ > > cpu_exec_nocache(cpu, 1, tb_find(cpu, NULL, 0), true); > > *ret = -1; > > return true; > > > > 2. tb_find calls tb_gen_code, which cannot allocate new translation block > > and calls tb_flush (which only queues the flushing) and cpu_loop_exit > > 3. cpu_loop_exit returns to infinite loop of cpu_exec and the condition > > if (cpu_handle_exception(cpu, &ret)) { > > break; > > } > > is checked again causing an infinite loop. > > > > TB cache is not flushed because we never execute that break and real work of tb_flush > > is made outside this loop. > > I think what we need is a: > > > if (cpu->exit_request) > break; Where this exit_request is supposed to be set? > > before the cpu_handle_exception() call to ensure any queued work gets > processed first. Can you give me you current command line so I can > reproduce this and check the fix works? I solved the problem using following patch: Pavel Dovgalyuk --- a/cpu-exec.c +++ b/cpu-exec.c @@ -451,6 +451,10 @@ static inline bool cpu_handle_exception(CPUState *cpu, int *ret) #ifndef CONFIG_USER_ONLY } else if (replay_has_exception() && cpu->icount_decr.u16.low + cpu->icount_extra == 0) { + /* Break the execution loop in case of running out of TB cache. + This is needed to make flushing of the TB cache, because + real flush is queued to be executed outside the cpu loop. */ + cpu->exception_index = EXCP_INTERRUPT; /* try to cause an exception pending in the log */ cpu_exec_nocache(cpu, 1, tb_find(cpu, NULL, 0), true); *ret = -1;