* [Qemu-devel] [5620] Add safety net against potential infinite loop
@ 2008-11-04 14:18 malc
2008-11-05 20:18 ` [Qemu-devel] " Jan Kiszka
0 siblings, 1 reply; 3+ messages in thread
From: malc @ 2008-11-04 14:18 UTC (permalink / raw)
To: qemu-devel
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 */
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Qemu-devel] Re: [5620] Add safety net against potential infinite loop
2008-11-04 14:18 [Qemu-devel] [5620] Add safety net against potential infinite loop malc
@ 2008-11-05 20:18 ` Jan Kiszka
2008-11-06 18:19 ` malc
0 siblings, 1 reply; 3+ messages in thread
From: Jan Kiszka @ 2008-11-05 20:18 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 1842 bytes --]
malc wrote:
> 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 */
This somehow breaks single-stepping via gdbstub. Unless you have an
instant idea (or even fix), I will dig for the reasons.
Jan
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 257 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-11-06 18:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-04 14:18 [Qemu-devel] [5620] Add safety net against potential infinite loop malc
2008-11-05 20:18 ` [Qemu-devel] " Jan Kiszka
2008-11-06 18:19 ` malc
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).