qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: qemu-devel@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	Peter Crosthwaite <crosthwaite.peter@gmail.com>,
	Richard Henderson <rth@twiddle.net>,
	Eduardo Habkost <ehabkost@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	David Gibson <david@gibson.dropbear.id.au>,
	Alexander Graf <agraf@suse.de>, Riku Voipio <riku.voipio@iki.fi>,
	Bharata B Rao <bharata@linux.vnet.ibm.com>,
	qemu-ppc@nongnu.org
Subject: [Qemu-devel] [PATCH v2 1/6] exec: reduce CONFIG_USER_ONLY ifdeffenery
Date: Mon, 25 Jul 2016 11:59:19 +0200	[thread overview]
Message-ID: <1469440764-61619-2-git-send-email-imammedo@redhat.com> (raw)
In-Reply-To: <1469440764-61619-1-git-send-email-imammedo@redhat.com>

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
---
 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);
     }
-- 
2.7.4

  reply	other threads:[~2016-07-25  9:59 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-25  9:59 [Qemu-devel] [PATCH v2 0/6] Fix migration issues with arbitrary cpu-hot(un)plug Igor Mammedov
2016-07-25  9:59 ` Igor Mammedov [this message]
2016-07-25  9:59 ` [Qemu-devel] [PATCH v2 2/6] exec: don't use cpu_index to detect if cpu_exec_init()'s been called for cpu Igor Mammedov
2016-07-25 10:18   ` David Gibson
2016-07-25  9:59 ` [Qemu-devel] [PATCH v2 3/6] exec: set cpu_index only if it's not been explictly set Igor Mammedov
2016-07-26 18:28   ` Eduardo Habkost
2016-07-27  8:45     ` Igor Mammedov
2016-07-25  9:59 ` [Qemu-devel] [PATCH v2 4/6] qdev: fix object reference leak in case device.realize() fails Igor Mammedov
2016-07-25  9:59 ` [Qemu-devel] [PATCH v2 5/6] pc: init CPUState->cpu_index with index in possible_cpus[] Igor Mammedov
2016-07-25  9:59 ` [Qemu-devel] [PATCH v2 6/6] Revert "pc: Enforce adding CPUs contiguously and removing them in opposite order" Igor Mammedov
2016-07-25 10:22 ` [Qemu-devel] [PATCH v2 0/6] Fix migration issues with arbitrary cpu-hot(un)plug David Gibson
2016-07-26  3:16 ` David Gibson
2016-07-26 15:26   ` Eduardo Habkost
2016-07-26 15:22 ` Michael S. Tsirkin
2016-07-26 18:35 ` Eduardo Habkost
2016-07-27  9:24 ` [Qemu-devel] [PATCH v2 7/6] exec: ensure the only one cpu_index allocation method is used Igor Mammedov
2016-07-28  5:49   ` David Gibson
2016-08-02 11:40   ` Eduardo Habkost

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1469440764-61619-2-git-send-email-imammedo@redhat.com \
    --to=imammedo@redhat.com \
    --cc=agraf@suse.de \
    --cc=bharata@linux.vnet.ibm.com \
    --cc=crosthwaite.peter@gmail.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=ehabkost@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=riku.voipio@iki.fi \
    --cc=rth@twiddle.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).