diff mbox series

[06/35] exec: use cpu_reset_interrupt

Message ID 20180917163103.6113-7-cota@braap.org
State New
Headers show
Series exec: drop BQL from interrupt handling | expand

Commit Message

Emilio Cota Sept. 17, 2018, 4:30 p.m. UTC
From: Paolo Bonzini <pbonzini@redhat.com>

It will be changed to an atomic operation soon.

Cc: Peter Crosthwaite <crosthwaite.peter@gmail.com>
Cc: Richard Henderson <rth@twiddle.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Emilio G. Cota <cota@braap.org>
---
 accel/tcg/cpu-exec.c | 6 +++---
 exec.c               | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

Comments

Richard Henderson Sept. 18, 2018, 8:49 p.m. UTC | #1
On 9/17/18 9:30 AM, Emilio G. Cota wrote:
> From: Paolo Bonzini <pbonzini@redhat.com>
> 
> It will be changed to an atomic operation soon.
> 
> Cc: Peter Crosthwaite <crosthwaite.peter@gmail.com>
> Cc: Richard Henderson <rth@twiddle.net>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> Signed-off-by: Emilio G. Cota <cota@braap.org>
> ---
>  accel/tcg/cpu-exec.c | 6 +++---

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

> diff --git a/exec.c b/exec.c
> index 6826c8337d..0b8e2420cf 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -776,7 +776,7 @@ static int cpu_common_post_load(void *opaque, int version_id)
>  
>      /* 0x01 was CPU_INTERRUPT_EXIT. This line can be removed when the
>         version_id is increased. */
> -    cpu->interrupt_request &= ~0x01;
> +    cpu_reset_interrupt(cpu, 0x01);

I guess this doesn't hurt, although it's irrelevant.
We're in the middle of loadvm and there will not be
concurrent modification.


r~
Philippe Mathieu-Daudé Sept. 19, 2018, 8:59 p.m. UTC | #2
On 9/17/18 6:30 PM, Emilio G. Cota wrote:
> From: Paolo Bonzini <pbonzini@redhat.com>
> 
> It will be changed to an atomic operation soon.
> 
> Cc: Peter Crosthwaite <crosthwaite.peter@gmail.com>
> Cc: Richard Henderson <rth@twiddle.net>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> Signed-off-by: Emilio G. Cota <cota@braap.org>

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

> ---
>  accel/tcg/cpu-exec.c | 6 +++---
>  exec.c               | 2 +-
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
> index 6bcb6d99bd..7ca00725ec 100644
> --- a/accel/tcg/cpu-exec.c
> +++ b/accel/tcg/cpu-exec.c
> @@ -533,7 +533,7 @@ static inline bool cpu_handle_interrupt(CPUState *cpu,
>              interrupt_request &= ~CPU_INTERRUPT_SSTEP_MASK;
>          }
>          if (interrupt_request & CPU_INTERRUPT_DEBUG) {
> -            cpu->interrupt_request &= ~CPU_INTERRUPT_DEBUG;
> +            cpu_reset_interrupt(cpu, CPU_INTERRUPT_DEBUG);
>              cpu->exception_index = EXCP_DEBUG;
>              qemu_mutex_unlock_iothread();
>              return true;
> @@ -542,7 +542,7 @@ static inline bool cpu_handle_interrupt(CPUState *cpu,
>              /* Do nothing */
>          } else if (interrupt_request & CPU_INTERRUPT_HALT) {
>              replay_interrupt();
> -            cpu->interrupt_request &= ~CPU_INTERRUPT_HALT;
> +            cpu_reset_interrupt(cpu, CPU_INTERRUPT_HALT);
>              cpu->halted = 1;
>              cpu->exception_index = EXCP_HLT;
>              qemu_mutex_unlock_iothread();
> @@ -582,7 +582,7 @@ static inline bool cpu_handle_interrupt(CPUState *cpu,
>              interrupt_request = cpu->interrupt_request;
>          }
>          if (interrupt_request & CPU_INTERRUPT_EXITTB) {
> -            cpu->interrupt_request &= ~CPU_INTERRUPT_EXITTB;
> +            cpu_reset_interrupt(cpu, CPU_INTERRUPT_EXITTB);
>              /* ensure that no TB jump will be modified as
>                 the program flow was changed */
>              *last_tb = NULL;
> diff --git a/exec.c b/exec.c
> index 6826c8337d..0b8e2420cf 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -776,7 +776,7 @@ static int cpu_common_post_load(void *opaque, int version_id)
>  
>      /* 0x01 was CPU_INTERRUPT_EXIT. This line can be removed when the
>         version_id is increased. */
> -    cpu->interrupt_request &= ~0x01;
> +    cpu_reset_interrupt(cpu, 0x01);
>      tlb_flush(cpu);
>  
>      /* loadvm has just updated the content of RAM, bypassing the
>
diff mbox series

Patch

diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
index 6bcb6d99bd..7ca00725ec 100644
--- a/accel/tcg/cpu-exec.c
+++ b/accel/tcg/cpu-exec.c
@@ -533,7 +533,7 @@  static inline bool cpu_handle_interrupt(CPUState *cpu,
             interrupt_request &= ~CPU_INTERRUPT_SSTEP_MASK;
         }
         if (interrupt_request & CPU_INTERRUPT_DEBUG) {
-            cpu->interrupt_request &= ~CPU_INTERRUPT_DEBUG;
+            cpu_reset_interrupt(cpu, CPU_INTERRUPT_DEBUG);
             cpu->exception_index = EXCP_DEBUG;
             qemu_mutex_unlock_iothread();
             return true;
@@ -542,7 +542,7 @@  static inline bool cpu_handle_interrupt(CPUState *cpu,
             /* Do nothing */
         } else if (interrupt_request & CPU_INTERRUPT_HALT) {
             replay_interrupt();
-            cpu->interrupt_request &= ~CPU_INTERRUPT_HALT;
+            cpu_reset_interrupt(cpu, CPU_INTERRUPT_HALT);
             cpu->halted = 1;
             cpu->exception_index = EXCP_HLT;
             qemu_mutex_unlock_iothread();
@@ -582,7 +582,7 @@  static inline bool cpu_handle_interrupt(CPUState *cpu,
             interrupt_request = cpu->interrupt_request;
         }
         if (interrupt_request & CPU_INTERRUPT_EXITTB) {
-            cpu->interrupt_request &= ~CPU_INTERRUPT_EXITTB;
+            cpu_reset_interrupt(cpu, CPU_INTERRUPT_EXITTB);
             /* ensure that no TB jump will be modified as
                the program flow was changed */
             *last_tb = NULL;
diff --git a/exec.c b/exec.c
index 6826c8337d..0b8e2420cf 100644
--- a/exec.c
+++ b/exec.c
@@ -776,7 +776,7 @@  static int cpu_common_post_load(void *opaque, int version_id)
 
     /* 0x01 was CPU_INTERRUPT_EXIT. This line can be removed when the
        version_id is increased. */
-    cpu->interrupt_request &= ~0x01;
+    cpu_reset_interrupt(cpu, 0x01);
     tlb_flush(cpu);
 
     /* loadvm has just updated the content of RAM, bypassing the