Emilio G. Cota <c...@braap.org> writes:

> Cc: Cornelia Huck <coh...@redhat.com>
> Cc: Christian Borntraeger <borntrae...@de.ibm.com>
> Cc: Alexander Graf <ag...@suse.de>
> Cc: David Hildenbrand <da...@redhat.com>
> Cc: qemu-s3...@nongnu.org
> Reviewed-by: Richard Henderson <richard.hender...@linaro.org>
> Signed-off-by: Emilio G. Cota <c...@braap.org>
> ---
<snip>
>
>  static unsigned s390_count_running_cpus(void)
> @@ -340,10 +340,12 @@ unsigned int s390_cpu_halt(S390CPU *cpu)
>      CPUState *cs = CPU(cpu);
>      trace_cpu_halt(cs->cpu_index);
>
> -    if (!cs->halted) {
> -        cs->halted = 1;
> +    cpu_mutex_lock(cs);
> +    if (!cpu_halted(cs)) {
> +        cpu_halted_set(cs, 1);
>          cs->exception_index = EXCP_HLT;
>      }
> +    cpu_mutex_unlock(cs);
>
>      return s390_count_running_cpus();
>  }
> @@ -353,10 +355,12 @@ void s390_cpu_unhalt(S390CPU *cpu)
>      CPUState *cs = CPU(cpu);
>      trace_cpu_unhalt(cs->cpu_index);
>
> -    if (cs->halted) {
> -        cs->halted = 0;
> +    cpu_mutex_lock(cs);
> +    if (cpu_halted(cs)) {
> +        cpu_halted_set(cs, 0);
>          cs->exception_index = -1;
>      }
> +    cpu_mutex_unlock(cs);

I think this locking is superfluous as you already added locking when
you introduced the helper.

<snip>

Otherwise:

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

--
Alex Bennée

Reply via email to