qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC v4 24/71] s390x: convert to cpu_halted


From: Alex Bennée
Subject: Re: [Qemu-devel] [RFC v4 24/71] s390x: convert to cpu_halted
Date: Wed, 31 Oct 2018 16:13:05 +0000
User-agent: mu4e 1.1.0; emacs 26.1.50

Emilio G. Cota <address@hidden> writes:

> Cc: Cornelia Huck <address@hidden>
> Cc: Christian Borntraeger <address@hidden>
> Cc: Alexander Graf <address@hidden>
> Cc: David Hildenbrand <address@hidden>
> Cc: address@hidden
> Reviewed-by: Richard Henderson <address@hidden>
> Signed-off-by: Emilio G. Cota <address@hidden>
> ---
<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 <address@hidden>

--
Alex Bennée



reply via email to

[Prev in Thread] Current Thread [Next in Thread]