[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
- [Qemu-devel] [RFC v4 48/71] mips: convert to cpu_interrupt_request, (continued)
- [Qemu-devel] [RFC v4 48/71] mips: convert to cpu_interrupt_request, Emilio G. Cota, 2018/10/25
- [Qemu-devel] [RFC v4 31/71] ppc: use cpu_reset_interrupt, Emilio G. Cota, 2018/10/25
- [Qemu-devel] [RFC v4 43/71] sh4: convert to cpu_interrupt_request, Emilio G. Cota, 2018/10/25
- [Qemu-devel] [RFC v4 70/71] cpus-common: move exclusive_idle higher in the file, Emilio G. Cota, 2018/10/25
- [Qemu-devel] [RFC v4 24/71] s390x: convert to cpu_halted, Emilio G. Cota, 2018/10/25
- Re: [Qemu-devel] [RFC v4 24/71] s390x: convert to cpu_halted,
Alex Bennée <=
- [Qemu-devel] [RFC v4 53/71] sparc: convert to cpu_interrupt_request, Emilio G. Cota, 2018/10/25
- [Qemu-devel] [RFC v4 55/71] unicore32: convert to cpu_interrupt_request, Emilio G. Cota, 2018/10/25
- [Qemu-devel] [RFC v4 47/71] m68k: convert to cpu_interrupt_request, Emilio G. Cota, 2018/10/25
- [Qemu-devel] [RFC v4 51/71] alpha: convert to cpu_interrupt_request, Emilio G. Cota, 2018/10/25