From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41416) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fpSnA-0006BG-1z for qemu-devel@nongnu.org; Tue, 14 Aug 2018 02:26:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fpSn9-00074D-2S for qemu-devel@nongnu.org; Tue, 14 Aug 2018 02:26:56 -0400 References: <20180813163859.17964-1-cota@braap.org> <20180813163859.17964-2-cota@braap.org> From: Paolo Bonzini Message-ID: Date: Tue, 14 Aug 2018 08:26:49 +0200 MIME-Version: 1.0 In-Reply-To: <20180813163859.17964-2-cota@braap.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 1/3] qom: use cpu->in_cpu_list instead of QTAILQ_IN_USE List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Emilio G. Cota" , qemu-devel@nongnu.org Cc: Peter Crosthwaite , Richard Henderson , David Gibson , Alexander Graf , Riku Voipio , Laurent Vivier , qemu-ppc@nongnu.org On 13/08/2018 18:38, Emilio G. Cota wrote: > This paves the way for implementing the CPU list with an RCU QLIST. >=20 > Signed-off-by: Emilio G. Cota > --- > cpus-common.c | 3 ++- > include/qom/cpu.h | 2 ++ > 2 files changed, 4 insertions(+), 1 deletion(-) >=20 > diff --git a/cpus-common.c b/cpus-common.c > index 59f751ecf9..6eaedae60b 100644 > --- a/cpus-common.c > +++ b/cpus-common.c > @@ -85,6 +85,7 @@ void cpu_list_add(CPUState *cpu) > assert(!cpu_index_auto_assigned); > } > QTAILQ_INSERT_TAIL(&cpus, cpu, node); > + cpu->in_cpu_list =3D true; > qemu_mutex_unlock(&qemu_cpu_list_lock); > =20 > finish_safe_work(cpu); > @@ -93,7 +94,7 @@ void cpu_list_add(CPUState *cpu) > void cpu_list_remove(CPUState *cpu) > { > qemu_mutex_lock(&qemu_cpu_list_lock); > - if (!QTAILQ_IN_USE(cpu, node)) { > + if (!cpu->in_cpu_list) { > /* there is nothing to undo since cpu_exec_init() hasn't been = called */ > qemu_mutex_unlock(&qemu_cpu_list_lock); > return; > diff --git a/include/qom/cpu.h b/include/qom/cpu.h > index bd796579ee..aa555e27a7 100644 > --- a/include/qom/cpu.h > +++ b/include/qom/cpu.h > @@ -411,6 +411,8 @@ struct CPUState { > =20 > bool ignore_memory_transaction_failures; > =20 > + bool in_cpu_list; /* protected by qemu_cpu_list_lock */ > + > /* Note that this is accessed at the start of every TB via a negat= ive > offset from AREG0. Leave this field at the end so as to make t= he > (absolute value) offset as small as possible. This reduces cod= e >=20 Reviewwed-by: Paolo Bonzini