From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KxMjb-000385-EQ for qemu-devel@nongnu.org; Tue, 04 Nov 2008 09:18:19 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KxMja-00037K-6h for qemu-devel@nongnu.org; Tue, 04 Nov 2008 09:18:19 -0500 Received: from [199.232.76.173] (port=40893 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KxMja-00037A-1z for qemu-devel@nongnu.org; Tue, 04 Nov 2008 09:18:18 -0500 Received: from savannah.gnu.org ([199.232.41.3]:45281 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KxMjZ-0005zo-Pr for qemu-devel@nongnu.org; Tue, 04 Nov 2008 09:18:17 -0500 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1KxMjX-0000XW-KV for qemu-devel@nongnu.org; Tue, 04 Nov 2008 14:18:16 +0000 Received: from malc by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1KxMjX-0000XR-0H for qemu-devel@nongnu.org; Tue, 04 Nov 2008 14:18:15 +0000 MIME-Version: 1.0 Errors-To: malc Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: malc Message-Id: Date: Tue, 04 Nov 2008 14:18:15 +0000 Subject: [Qemu-devel] [5620] Add safety net against potential infinite loop Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Revision: 5620 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5620 Author: malc Date: 2008-11-04 14:18:13 +0000 (Tue, 04 Nov 2008) Log Message: ----------- Add safety net against potential infinite loop cpu_interrupt might be called while translating the TB, but before it is linked into a potentially infinite loop and becomes env->current_tb. Currently this can (and does) cause huge problems only when using dyntick clock, with other (periodic) clocks host_alarm_handler will eventually be executed resulting in a call to cpu_interrupt which will reset the recursion of running TB and the damage is "only" latency. Modified Paths: -------------- trunk/cpu-exec.c Modified: trunk/cpu-exec.c =================================================================== --- trunk/cpu-exec.c 2008-11-04 13:17:17 UTC (rev 5619) +++ trunk/cpu-exec.c 2008-11-04 14:18:13 UTC (rev 5620) @@ -623,6 +623,14 @@ } spin_unlock(&tb_lock); env->current_tb = tb; + + /* cpu_interrupt might be called while translating the + TB, but before it is linked into a potentially + infinite loop and becomes env->current_tb. Avoid + starting execution if there is a pending interrupt. */ + if (unlikely (env->interrupt_request & CPU_INTERRUPT_EXIT)) + env->current_tb = NULL; + while (env->current_tb) { tc_ptr = tb->tc_ptr; /* execute the generated code */