From patchwork Mon Jul 25 09:59:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Mammedov X-Patchwork-Id: 9245513 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9348B60757 for ; Mon, 25 Jul 2016 10:03:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8281F25250 for ; Mon, 25 Jul 2016 10:03:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 76DD126E5D; Mon, 25 Jul 2016 10:03:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E0FAC25250 for ; Mon, 25 Jul 2016 10:03:17 +0000 (UTC) Received: from localhost ([::1]:59636 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bRcjF-0003sz-2g for patchwork-qemu-devel@patchwork.kernel.org; Mon, 25 Jul 2016 06:03:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56718) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bRcfg-0001Gu-Is for qemu-devel@nongnu.org; Mon, 25 Jul 2016 05:59:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bRcfd-0007AY-0w for qemu-devel@nongnu.org; Mon, 25 Jul 2016 05:59:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54421) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bRcfc-0007AU-PI; Mon, 25 Jul 2016 05:59:32 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2718285364; Mon, 25 Jul 2016 09:59:32 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u6P9xQ7K008066; Mon, 25 Jul 2016 05:59:29 -0400 From: Igor Mammedov To: qemu-devel@nongnu.org Date: Mon, 25 Jul 2016 11:59:19 +0200 Message-Id: <1469440764-61619-2-git-send-email-imammedo@redhat.com> In-Reply-To: <1469440764-61619-1-git-send-email-imammedo@redhat.com> References: <1469440764-61619-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 25 Jul 2016 09:59:32 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 1/6] exec: reduce CONFIG_USER_ONLY ifdeffenery X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Riku Voipio , Eduardo Habkost , "Michael S. Tsirkin" , Peter Crosthwaite , Alexander Graf , qemu-ppc@nongnu.org, Bharata B Rao , Paolo Bonzini , David Gibson , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Igor Mammedov Reviewed-by: David Gibson --- 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(-) 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); 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 = CPU_GET_CLASS(cpu); -#if defined(CONFIG_USER_ONLY) cpu_list_lock(); -#endif if (cpu->cpu_index == -1) { /* cpu_index was never allocated by this @cpu or was already freed. */ -#if defined(CONFIG_USER_ONLY) cpu_list_unlock(); -#endif return; } QTAILQ_REMOVE(&cpus, cpu, node); cpu_release_index(cpu); cpu->cpu_index = -1; -#if defined(CONFIG_USER_ONLY) cpu_list_unlock(); -#endif if (cc->vmsd != NULL) { vmstate_unregister(NULL, cc->vmsd, cpu); @@ -670,7 +664,7 @@ void cpu_exec_exit(CPUState *cpu) void cpu_exec_init(CPUState *cpu, Error **errp) { - CPUClass *cc = CPU_GET_CLASS(cpu); + CPUClass *cc ATTRIBUTE_UNUSED = CPU_GET_CLASS(cpu); Error *local_err = NULL; cpu->as = NULL; @@ -694,22 +688,17 @@ void cpu_exec_init(CPUState *cpu, Error **errp) object_ref(OBJECT(cpu->memory)); #endif -#if defined(CONFIG_USER_ONLY) cpu_list_lock(); -#endif cpu->cpu_index = 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)) == NULL) { vmstate_register(NULL, cpu->cpu_index, &vmstate_cpu_common, cpu); }