From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37663) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bQR3M-0006s1-GI for qemu-devel@nongnu.org; Thu, 21 Jul 2016 23:23:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bQR3L-0003t6-70 for qemu-devel@nongnu.org; Thu, 21 Jul 2016 23:23:08 -0400 Date: Fri, 22 Jul 2016 11:30:39 +1000 From: David Gibson Message-ID: <20160722013039.GB15941@voom.fritz.box> References: <1469116479-233280-1-git-send-email-imammedo@redhat.com> <1469116479-233280-2-git-send-email-imammedo@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="oC1+HKm2/end4ao3" Content-Disposition: inline In-Reply-To: <1469116479-233280-2-git-send-email-imammedo@redhat.com> Subject: Re: [Qemu-devel] [PATCH 1/8] exec: reduce CONFIG_USER_ONLY ifdeffenery List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Igor Mammedov Cc: qemu-devel@nongnu.org, Paolo Bonzini , Peter Crosthwaite , Richard Henderson , Eduardo Habkost , "Michael S. Tsirkin" , Alexander Graf , Riku Voipio , Bharata B Rao , qemu-ppc@nongnu.org --oC1+HKm2/end4ao3 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jul 21, 2016 at 05:54:32PM +0200, Igor Mammedov wrote: > Signed-off-by: Igor Mammedov Reviewed-by: David Gibson I think this is long overdue. > --- > bsd-user/qemu.h | 2 -- > include/exec/exec-all.h | 12 ++++++++++++ > linux-user/qemu.h | 2 -- > exec.c | 17 +++-------------- > 4 files changed, 15 insertions(+), 18 deletions(-) >=20 > diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h > index 6ccc544..2b2b918 100644 > --- a/bsd-user/qemu.h > +++ b/bsd-user/qemu.h > @@ -209,8 +209,6 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong = old_size, > abi_ulong new_addr); > int target_msync(abi_ulong start, abi_ulong len, int flags); > extern unsigned long last_brk; > -void cpu_list_lock(void); > -void cpu_list_unlock(void); > #if defined(CONFIG_USE_NPTL) > void mmap_fork_start(void); > void mmap_fork_end(int child); > diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h > index acda7b6..d008296 100644 > --- a/include/exec/exec-all.h > +++ b/include/exec/exec-all.h > @@ -56,6 +56,18 @@ TranslationBlock *tb_gen_code(CPUState *cpu, > target_ulong pc, target_ulong cs_base, > uint32_t flags, > int cflags); > +#if defined(CONFIG_USER_ONLY) > +void cpu_list_lock(void); > +void cpu_list_unlock(void); > +#else > +static inline void cpu_list_unlock(void) > +{ > +} > +static inline void cpu_list_lock(void) > +{ > +} > +#endif > + > void cpu_exec_init(CPUState *cpu, Error **errp); > void QEMU_NORETURN cpu_loop_exit(CPUState *cpu); > void QEMU_NORETURN cpu_loop_exit_restore(CPUState *cpu, uintptr_t pc); > diff --git a/linux-user/qemu.h b/linux-user/qemu.h > index cdf23a7..bef465d 100644 > --- a/linux-user/qemu.h > +++ b/linux-user/qemu.h > @@ -419,8 +419,6 @@ int target_msync(abi_ulong start, abi_ulong len, int = flags); > extern unsigned long last_brk; > extern abi_ulong mmap_next_start; > abi_ulong mmap_find_vma(abi_ulong, abi_ulong); > -void cpu_list_lock(void); > -void cpu_list_unlock(void); > void mmap_fork_start(void); > void mmap_fork_end(int child); > =20 > diff --git a/exec.c b/exec.c > index 60cf46a..2f57c62 100644 > --- a/exec.c > +++ b/exec.c > @@ -642,23 +642,17 @@ void cpu_exec_exit(CPUState *cpu) > { > CPUClass *cc =3D CPU_GET_CLASS(cpu); > =20 > -#if defined(CONFIG_USER_ONLY) > cpu_list_lock(); > -#endif > if (cpu->cpu_index =3D=3D -1) { > /* cpu_index was never allocated by this @cpu or was already fre= ed. */ > -#if defined(CONFIG_USER_ONLY) > cpu_list_unlock(); > -#endif > return; > } > =20 > QTAILQ_REMOVE(&cpus, cpu, node); > cpu_release_index(cpu); > cpu->cpu_index =3D -1; > -#if defined(CONFIG_USER_ONLY) > cpu_list_unlock(); > -#endif > =20 > if (cc->vmsd !=3D NULL) { > vmstate_unregister(NULL, cc->vmsd, cpu); > @@ -670,7 +664,7 @@ void cpu_exec_exit(CPUState *cpu) > =20 > void cpu_exec_init(CPUState *cpu, Error **errp) > { > - CPUClass *cc =3D CPU_GET_CLASS(cpu); > + CPUClass *cc ATTRIBUTE_UNUSED =3D CPU_GET_CLASS(cpu); > Error *local_err =3D NULL; > =20 > cpu->as =3D NULL; > @@ -694,22 +688,17 @@ void cpu_exec_init(CPUState *cpu, Error **errp) > object_ref(OBJECT(cpu->memory)); > #endif > =20 > -#if defined(CONFIG_USER_ONLY) > cpu_list_lock(); > -#endif > cpu->cpu_index =3D cpu_get_free_index(&local_err); > if (local_err) { > error_propagate(errp, local_err); > -#if defined(CONFIG_USER_ONLY) > cpu_list_unlock(); > -#endif > return; > } > QTAILQ_INSERT_TAIL(&cpus, cpu, node); > -#if defined(CONFIG_USER_ONLY) > - (void) cc; > cpu_list_unlock(); > -#else > + > +#ifndef CONFIG_USER_ONLY > if (qdev_get_vmsd(DEVICE(cpu)) =3D=3D NULL) { > vmstate_register(NULL, cpu->cpu_index, &vmstate_cpu_common, cpu); > } --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --oC1+HKm2/end4ao3 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJXkXc+AAoJEGw4ysog2bOSolkP/0mGXF9vIHMN09LKXcEeDRAk 4rv2BiBHj0t5RPv2MkT3JzOM0735yySdRBXoEdYWwSO/5NUrrD3SXqcFGoNTcPd5 fYzJ7QqGGC2P8+PmKExSmGH/HPxk8pLhvIoHVpr07csSiH0BgFCaPFSwK6SgfdeU aPkxszG8Kpij/I1K1qmaH6YFr2cFJNSRXUhdtgyCVL7Xwv+K/NMRVB9xUWz1RQud 0+3OLLzQS+hs7ehk+W3Qf88xy0gS8Qsm2uebluNUUmEBhCe0AfoNLGSN3ML1BXm5 gOMX8+8gF3LOqchpYQcYMqkbpOq7FlgFSCjCLLRp9sVxlIre4Po2YH7CNeNpLrGD e7gKhZzjgKGSjIOvtHzi2YXge+CIFh2K2a8nAGwjuy0qpgM50pGiU1x2mo6/YBUT TpwLD2VKBPZkdowlOAKldlF+vYez7sMK/wpPHdRZzDerck8pH79Tpw+PTMAl+kGa L/SjapPYbqzLdxjnO3mbxDEnz4B+QIAnKhW6jv7hx1rS9VVFJkhoYzaORmVJCJsY +934bUIXW4GmBWc4UiLDuOXWEC6RZ03mwqhPXUtaC8FCrwhvQ7zhaKYreIJk9DLv Qv8oCzFbUOz6j8tSOnh+O+0dKg0uABaQ+dvsQl6t0ziirU8LUZi6352eivIAmFQR FOm+tFRDflUfgN8Dgatr =oVg9 -----END PGP SIGNATURE----- --oC1+HKm2/end4ao3--