Received: from eggs.gnu.org ([2001:4830:134:3::10]:35743) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f4QmQ-00057r-1H for qemu-devel@nongnu.org; Fri, 06 Apr 2018 08:47:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f4QmP-0003Z7-0Z for qemu-devel@nongnu.org; Fri, 06 Apr 2018 08:47:46 -0400 Sender: Richard Henderson References: <20180406123838.21249-1-peter.maydell@linaro.org> From: Richard Henderson Message-ID: <09df8088-4afe-5642-d6dd-12ca0afb8a62@twiddle.net> Date: Fri, 6 Apr 2018 22:47:10 +1000 MIME-Version: 1.0 In-Reply-To: <20180406123838.21249-1-peter.maydell@linaro.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH for-2.12] cpus.c: ensure running CPU recalculates icount deadlines on timer expiry List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell , qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, patches@linaro.org, Paolo Bonzini , =?UTF-8?Q?Alex_Benn=c3=a9e?= , "Emilio G. Cota" , Pavel Dovgalyuk On 04/06/2018 10:38 PM, Peter Maydell wrote: > When we run in TCG icount mode, we calculate the number of instructions > to execute using tcg_get_icount_limit(), which ensures that we stop > execution at the next timer deadline. However there is a bug where > currently we do not recalculate that limit if the guest reprograms > a timer so that the next deadline moves closer, and so we will > continue execution until the original limit and fire the timer > later than we should. > > Fix this bug in qemu_timer_notify_cb(): if we are currently running > a VCPU in icount mode, we simply need to kick it out of the main > loop and back to tcg_cpu_exec(), where it will recalculate the > icount limit. If we are not currently running a VCPU, then we > retain the existing logic for waking up a halted CPU. > > Cc: qemu-stable@nongnu.org > Fixes: https://bugs.launchpad.net/qemu/+bug/1754038 > Signed-off-by: Peter Maydell > --- > Thanks to Paolo for tracking down which function needed fixing! Seconded. Reviewed-by: Richard Henderson r~