Skip to contentSkip to conversation

cpu-exec: Clean up 'interrupt_request' reloading in cpu_handle_interrupt()

PATCH Superseded Sergey Fedorov 3 participants 3 messages May 12, 2016

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cpu-exec: Clean up 'interrupt_request' reloading in cpu_handle_interrupt()

From: Sergey Fedorov <[email protected]>

---

This patch applies on top of commit:

    40ae3669fb55 ("cpu-exec: Remove unused 'x86_cpu' and 'env' from cpu_exec()")
from:
    git://github.com/rth7680/qemu.git tcg-next
 cpu-exec.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
cpu-exec.c +4 -3
index 0ea47e997dfa..a7b03f77cf53 100644
@@ -489,9 +489,10 @@ static inline void cpu_handle_interrupt(CPUState *cpu,
                 *last_tb = NULL;
             }
         }
-        /* Don't use the cached interrupt_request value,
-           do_interrupt may have updated the EXITTB flag. */
-        if (cpu->interrupt_request & CPU_INTERRUPT_EXITTB) {
+        /* The target hook may have updated the 'cpu->interrupt_request';
+         * reload the 'interrupt_request' value */
+        interrupt_request = cpu->interrupt_request;
+        if (interrupt_request & CPU_INTERRUPT_EXITTB) {
             cpu->interrupt_request &= ~CPU_INTERRUPT_EXITTB;
             /* ensure that no TB jump will be modified as
                the program flow was changed */
Signature · 1 line
1.9.1
#1 lore raw

cpu-exec.c static inline void cpu_handle_interrupt(CPUState *cpu, · line 490

Quoted 3 lines · Sergey Fedorov
cpu-exec.c +0 -0
@@ -489,9 +489,10 @@ static inline void cpu_handle_interrupt(CPUState *cpu,
                 *last_tb = NULL;
             }

[A]

cpu-exec.c static inline void cpu_handle_interrupt(CPUState *cpu, · line 495

Quoted 8 lines
cpu-exec.c +4 -3
         }
-        /* Don't use the cached interrupt_request value,
-           do_interrupt may have updated the EXITTB flag. */
-        if (cpu->interrupt_request & CPU_INTERRUPT_EXITTB) {
+        /* The target hook may have updated the 'cpu->interrupt_request';
+         * reload the 'interrupt_request' value */
+        interrupt_request = cpu->interrupt_request;
+        if (interrupt_request & CPU_INTERRUPT_EXITTB) {

Actually I suggested reloading it after the only place it could have changed, at A.

r~

#2 lore raw
Quoted 18 lines · Richard Henderson

cpu-exec.c static inline void cpu_handle_interrupt(CPUState · line 491

Quoted 4 lines · Sergey Fedorov
cpu-exec.c +0 -0
@@ -489,9 +489,10 @@ static inline void cpu_handle_interrupt(CPUState
 *cpu,
                 *last_tb = NULL;
             }

[A]

cpu-exec.c static inline void cpu_handle_interrupt(CPUState *cpu, · line 495

Quoted 9 lines
cpu-exec.c +4 -3
         }
-        /* Don't use the cached interrupt_request value,
-           do_interrupt may have updated the EXITTB flag. */
-        if (cpu->interrupt_request & CPU_INTERRUPT_EXITTB) {
+        /* The target hook may have updated the
 'cpu->interrupt_request';
+         * reload the 'interrupt_request' value */
+        interrupt_request = cpu->interrupt_request;
+        if (interrupt_request & CPU_INTERRUPT_EXITTB) {
Quoted 2 lines

Actually I suggested reloading it after the only place it could have changed, at A.

Oops :) Will fix it and resend.

Thanks,
Sergey