accel/tcg/cpu-exec.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
From: Aleksandr Sergeev <sergeev0xef@gmail.com>
In qemu there is a mechanism to cancel execution of tb.
If `cpu->neg.icount_decr` is <0, translation block
will exit in prolog.
E.g. such may happen when RCU thread kicks out vCPU.
If tb is not executed, we shall not raise EXCP_DEBUG,
because no step actually happened.
Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/4766
Signed-off-by: Aleksandr Sergeev <sergeev0xef@gmail.com>
---
accel/tcg/cpu-exec.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
index 9ead35418d..4497701486 100644
--- a/accel/tcg/cpu-exec.c
+++ b/accel/tcg/cpu-exec.c
@@ -478,16 +478,16 @@ cpu_tb_exec(CPUState *cpu, TranslationBlock *itb, int *tb_exit)
last_tb->tc.ptr, pc, lookup_symbol(pc));
}
}
- }
-
- /*
- * If gdb single-step, and we haven't raised another exception,
- * raise a debug exception. Single-step with another exception
- * is handled in cpu_handle_exception.
- */
- if (unlikely(cpu_single_stepping(cpu)) && cpu->exception_index == -1) {
- cpu->exception_index = EXCP_DEBUG;
- cpu_loop_exit(cpu);
+ } else {
+ /*
+ * If gdb single-step, and we haven't raised another exception,
+ * raise a debug exception. Single-step with another exception
+ * is handled in cpu_handle_exception.
+ */
+ if (unlikely(cpu_single_stepping(cpu)) && cpu->exception_index == -1) {
+ cpu->exception_index = EXCP_DEBUG;
+ cpu_loop_exit(cpu);
+ }
}
return last_tb;
--
2.55.0
On 10/28/26 02:23, Aleksandr Sergeev wrote:
> From: Aleksandr Sergeev <sergeev0xef@gmail.com>
>
> In qemu there is a mechanism to cancel execution of tb.
> If `cpu->neg.icount_decr` is <0, translation block
> will exit in prolog.
> E.g. such may happen when RCU thread kicks out vCPU.
>
> If tb is not executed, we shall not raise EXCP_DEBUG,
> because no step actually happened.
>
> Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/4766
> Signed-off-by: Aleksandr Sergeev <sergeev0xef@gmail.com>
> ---
> accel/tcg/cpu-exec.c | 20 ++++++++++----------
> 1 file changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
> index 9ead35418d..4497701486 100644
> --- a/accel/tcg/cpu-exec.c
> +++ b/accel/tcg/cpu-exec.c
> @@ -478,16 +478,16 @@ cpu_tb_exec(CPUState *cpu, TranslationBlock *itb, int *tb_exit)
> last_tb->tc.ptr, pc, lookup_symbol(pc));
> }
> }
> - }
> -
> - /*
> - * If gdb single-step, and we haven't raised another exception,
> - * raise a debug exception. Single-step with another exception
> - * is handled in cpu_handle_exception.
> - */
> - if (unlikely(cpu_single_stepping(cpu)) && cpu->exception_index == -1) {
> - cpu->exception_index = EXCP_DEBUG;
> - cpu_loop_exit(cpu);
> + } else {
> + /*
> + * If gdb single-step, and we haven't raised another exception,
> + * raise a debug exception. Single-step with another exception
> + * is handled in cpu_handle_exception.
> + */
> + if (unlikely(cpu_single_stepping(cpu)) && cpu->exception_index == -1) {
> + cpu->exception_index = EXCP_DEBUG;
> + cpu_loop_exit(cpu);
> + }
> }
>
> return last_tb;
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
And queued to tcg-next.
r~
© 2016 - 2026 Red Hat, Inc.