diff mbox series

[v6,31/73] cpu: convert to cpu_halted

Message ID 20190130004811.27372-32-cota@braap.org (mailing list archive)
State New, archived
Headers show
Series per-CPU locks | expand

Commit Message

Emilio Cota Jan. 30, 2019, 12:47 a.m. UTC
This finishes the conversion to cpu_halted.

Signed-off-by: Emilio G. Cota <cota@braap.org>
---
 cpus.c    | 8 ++++----
 qom/cpu.c | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

Comments

Alex Bennée Feb. 7, 2019, 8:39 p.m. UTC | #1
Emilio G. Cota <cota@braap.org> writes:

> This finishes the conversion to cpu_halted.
>
> Signed-off-by: Emilio G. Cota <cota@braap.org>

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>

> ---
>  cpus.c    | 8 ++++----
>  qom/cpu.c | 2 +-
>  2 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/cpus.c b/cpus.c
> index c4fa3cc876..aee129c0b3 100644
> --- a/cpus.c
> +++ b/cpus.c
> @@ -204,7 +204,7 @@ static bool cpu_thread_is_idle(CPUState *cpu)
>      if (cpu_is_stopped(cpu)) {
>          return true;
>      }
> -    if (!cpu->halted || cpu_has_work(cpu) ||
> +    if (!cpu_halted(cpu) || cpu_has_work(cpu) ||
>          kvm_halt_in_kernel()) {
>          return false;
>      }
> @@ -1686,7 +1686,7 @@ static void *qemu_hax_cpu_thread_fn(void *arg)
>
>      cpu->thread_id = qemu_get_thread_id();
>      cpu->created = true;
> -    cpu->halted = 0;
> +    cpu_halted_set(cpu, 0);
>      current_cpu = cpu;
>
>      hax_init_vcpu(cpu);
> @@ -1845,7 +1845,7 @@ static void *qemu_tcg_cpu_thread_fn(void *arg)
>                   *
>                   * cpu->halted should ensure we sleep in wait_io_event
>                   */
> -                g_assert(cpu->halted);
> +                g_assert(cpu_halted(cpu));
>                  break;
>              case EXCP_ATOMIC:
>                  qemu_mutex_unlock_iothread();
> @@ -2342,7 +2342,7 @@ CpuInfoList *qmp_query_cpus(Error **errp)
>          info->value = g_malloc0(sizeof(*info->value));
>          info->value->CPU = cpu->cpu_index;
>          info->value->current = (cpu == first_cpu);
> -        info->value->halted = cpu->halted;
> +        info->value->halted = cpu_halted(cpu);
>          info->value->qom_path = object_get_canonical_path(OBJECT(cpu));
>          info->value->thread_id = cpu->thread_id;
>  #if defined(TARGET_I386)
> diff --git a/qom/cpu.c b/qom/cpu.c
> index 2c05aa1bca..c5106d5af8 100644
> --- a/qom/cpu.c
> +++ b/qom/cpu.c
> @@ -261,7 +261,7 @@ static void cpu_common_reset(CPUState *cpu)
>      }
>
>      cpu->interrupt_request = 0;
> -    cpu->halted = 0;
> +    cpu_halted_set(cpu, 0);
>      cpu->mem_io_pc = 0;
>      cpu->mem_io_vaddr = 0;
>      cpu->icount_extra = 0;


--
Alex Bennée
Richard Henderson Feb. 20, 2019, 4:21 p.m. UTC | #2
On 1/29/19 4:47 PM, Emilio G. Cota wrote:
> This finishes the conversion to cpu_halted.
> 
> Signed-off-by: Emilio G. Cota <cota@braap.org>
> ---
>  cpus.c    | 8 ++++----
>  qom/cpu.c | 2 +-
>  2 files changed, 5 insertions(+), 5 deletions(-)

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


r~
diff mbox series

Patch

diff --git a/cpus.c b/cpus.c
index c4fa3cc876..aee129c0b3 100644
--- a/cpus.c
+++ b/cpus.c
@@ -204,7 +204,7 @@  static bool cpu_thread_is_idle(CPUState *cpu)
     if (cpu_is_stopped(cpu)) {
         return true;
     }
-    if (!cpu->halted || cpu_has_work(cpu) ||
+    if (!cpu_halted(cpu) || cpu_has_work(cpu) ||
         kvm_halt_in_kernel()) {
         return false;
     }
@@ -1686,7 +1686,7 @@  static void *qemu_hax_cpu_thread_fn(void *arg)
 
     cpu->thread_id = qemu_get_thread_id();
     cpu->created = true;
-    cpu->halted = 0;
+    cpu_halted_set(cpu, 0);
     current_cpu = cpu;
 
     hax_init_vcpu(cpu);
@@ -1845,7 +1845,7 @@  static void *qemu_tcg_cpu_thread_fn(void *arg)
                  *
                  * cpu->halted should ensure we sleep in wait_io_event
                  */
-                g_assert(cpu->halted);
+                g_assert(cpu_halted(cpu));
                 break;
             case EXCP_ATOMIC:
                 qemu_mutex_unlock_iothread();
@@ -2342,7 +2342,7 @@  CpuInfoList *qmp_query_cpus(Error **errp)
         info->value = g_malloc0(sizeof(*info->value));
         info->value->CPU = cpu->cpu_index;
         info->value->current = (cpu == first_cpu);
-        info->value->halted = cpu->halted;
+        info->value->halted = cpu_halted(cpu);
         info->value->qom_path = object_get_canonical_path(OBJECT(cpu));
         info->value->thread_id = cpu->thread_id;
 #if defined(TARGET_I386)
diff --git a/qom/cpu.c b/qom/cpu.c
index 2c05aa1bca..c5106d5af8 100644
--- a/qom/cpu.c
+++ b/qom/cpu.c
@@ -261,7 +261,7 @@  static void cpu_common_reset(CPUState *cpu)
     }
 
     cpu->interrupt_request = 0;
-    cpu->halted = 0;
+    cpu_halted_set(cpu, 0);
     cpu->mem_io_pc = 0;
     cpu->mem_io_vaddr = 0;
     cpu->icount_extra = 0;