[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 13/23] cpu-exec: avoid cpu_loop_exit in cpu_handle_in
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 13/23] cpu-exec: avoid cpu_loop_exit in cpu_handle_interrupt |
Date: |
Thu, 16 Feb 2017 15:31:37 +0100 |
The siglongjmp goes straight back to the beginning of cpu_exec's
outermost loop. We do not need a siglongjmp, we can simply
leave the inner TB execution loop.
Signed-off-by: Paolo Bonzini <address@hidden>
---
cpu-exec.c | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)
diff --git a/cpu-exec.c b/cpu-exec.c
index d50625b..ed2fbc6 100644
--- a/cpu-exec.c
+++ b/cpu-exec.c
@@ -461,7 +461,7 @@ static inline bool cpu_handle_exception(CPUState *cpu, int
*ret)
return false;
}
-static inline void cpu_handle_interrupt(CPUState *cpu,
+static inline bool cpu_handle_interrupt(CPUState *cpu,
TranslationBlock **last_tb)
{
CPUClass *cc = CPU_GET_CLASS(cpu);
@@ -475,7 +475,7 @@ static inline void cpu_handle_interrupt(CPUState *cpu,
if (interrupt_request & CPU_INTERRUPT_DEBUG) {
cpu->interrupt_request &= ~CPU_INTERRUPT_DEBUG;
cpu->exception_index = EXCP_DEBUG;
- cpu_loop_exit(cpu);
+ return true;
}
if (replay_mode == REPLAY_MODE_PLAY && !replay_has_interrupt()) {
/* Do nothing */
@@ -484,7 +484,7 @@ static inline void cpu_handle_interrupt(CPUState *cpu,
cpu->interrupt_request &= ~CPU_INTERRUPT_HALT;
cpu->halted = 1;
cpu->exception_index = EXCP_HLT;
- cpu_loop_exit(cpu);
+ return true;
}
#if defined(TARGET_I386)
else if (interrupt_request & CPU_INTERRUPT_INIT) {
@@ -494,13 +494,13 @@ static inline void cpu_handle_interrupt(CPUState *cpu,
cpu_svm_check_intercept_param(env, SVM_EXIT_INIT, 0);
do_cpu_init(x86_cpu);
cpu->exception_index = EXCP_HALTED;
- cpu_loop_exit(cpu);
+ return true;
}
#else
else if (interrupt_request & CPU_INTERRUPT_RESET) {
replay_interrupt();
cpu_reset(cpu);
- cpu_loop_exit(cpu);
+ return true;
}
#endif
/* The target hook has 3 exit conditions:
@@ -526,8 +526,10 @@ static inline void cpu_handle_interrupt(CPUState *cpu,
if (unlikely(atomic_read(&cpu->exit_request) || replay_has_interrupt())) {
atomic_set(&cpu->exit_request, 0);
cpu->exception_index = EXCP_INTERRUPT;
- cpu_loop_exit(cpu);
+ return true;
}
+
+ return false;
}
static inline void cpu_loop_exec_tb(CPUState *cpu, TranslationBlock *tb,
@@ -625,7 +627,7 @@ int cpu_exec(CPUState *cpu)
for(;;) {
/* prepare setjmp context for exception handling */
if (sigsetjmp(cpu->jmp_env, 0) == 0) {
- TranslationBlock *tb, *last_tb = NULL;
+ TranslationBlock *last_tb = NULL;
int tb_exit = 0;
/* if an exception is pending, we execute it here */
@@ -633,14 +635,13 @@ int cpu_exec(CPUState *cpu)
break;
}
- for(;;) {
- cpu_handle_interrupt(cpu, &last_tb);
- tb = tb_find(cpu, last_tb, tb_exit);
+ while (!cpu_handle_interrupt(cpu, &last_tb)) {
+ TranslationBlock *tb = tb_find(cpu, last_tb, tb_exit);
cpu_loop_exec_tb(cpu, tb, &last_tb, &tb_exit, &sc);
/* Try to align the host and virtual clocks
if the guest is in advance */
align_clocks(&sc, cpu);
- } /* for(;;) */
+ }
} else {
#if defined(__clang__) || !QEMU_GNUC_PREREQ(4, 6)
/* Some compilers wrongly smash all local variables after
--
1.8.3.1
- [Qemu-devel] [PULL 02/23] ioapic: fix error report value of def version, (continued)
- [Qemu-devel] [PULL 02/23] ioapic: fix error report value of def version, Paolo Bonzini, 2017/02/16
- [Qemu-devel] [PULL 03/23] kvm/ioapic: correct kvm ioapic version, Paolo Bonzini, 2017/02/16
- [Qemu-devel] [PULL 04/23] test-vmstate: remove yield_until_fd_readable, Paolo Bonzini, 2017/02/16
- [Qemu-devel] [PULL 05/23] qemu-char: socket backend: disconnect on write error, Paolo Bonzini, 2017/02/16
- [Qemu-devel] [PULL 06/23] apic: reset apic_delivered global variable on machine reset, Paolo Bonzini, 2017/02/16
- [Qemu-devel] [PULL 07/23] char: drop data written to a disconnected pty, Paolo Bonzini, 2017/02/16
- [Qemu-devel] [PULL 09/23] gdbstub: Fix vCont behaviour, Paolo Bonzini, 2017/02/16
- [Qemu-devel] [PULL 08/23] move vm_start to cpus.c, Paolo Bonzini, 2017/02/16
- [Qemu-devel] [PULL 10/23] hw/char/mcf_uart: QOMify the ColdFire UART, Paolo Bonzini, 2017/02/16
- [Qemu-devel] [PULL 11/23] cpu-exec: fix icount out-of-bounds access, Paolo Bonzini, 2017/02/16
- [Qemu-devel] [PULL 13/23] cpu-exec: avoid cpu_loop_exit in cpu_handle_interrupt,
Paolo Bonzini <=
- [Qemu-devel] [PULL 12/23] cpu-exec: tighten barrier on TCG_EXIT_REQUESTED, Paolo Bonzini, 2017/02/16
- [Qemu-devel] [PULL 14/23] cpu-exec: avoid repeated sigsetjmp on interrupts, Paolo Bonzini, 2017/02/16
- [Qemu-devel] [PULL 16/23] qemu-doc: Clarify that -vga std is now the default, Paolo Bonzini, 2017/02/16
- [Qemu-devel] [PULL 15/23] cpu-exec: remove outermost infinite loop, Paolo Bonzini, 2017/02/16
- [Qemu-devel] [PULL 17/23] qemu-nbd: Implement socket activation., Paolo Bonzini, 2017/02/16
- [Qemu-devel] [PULL 18/23] vl: Move the cpu_synchronize_all_post_init() after generic devices initialization, Paolo Bonzini, 2017/02/16
- [Qemu-devel] [PULL 19/23] Makefile: avoid leaving the temporary QEMU_PKGVERSION header file, Paolo Bonzini, 2017/02/16
- [Qemu-devel] [PULL 20/23] i386/cpu: add crash-information QOM property, Paolo Bonzini, 2017/02/16
- [Qemu-devel] [PULL 21/23] report guest crash information in GUEST_PANICKED event, Paolo Bonzini, 2017/02/16