qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] Make cpu_single_env thread local (Linux only for now)
@ 2011-10-03 16:33 Dr. David Alan Gilbert
  2011-10-03 17:51 ` Jan Kiszka
  0 siblings, 1 reply; 20+ messages in thread
From: Dr. David Alan Gilbert @ 2011-10-03 16:33 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell, agraf, patches

  Make cpu_single_env thread local (Linux only for now)
  * Fixes some user space threading issues (esp those triggered
    by bug 823902)

Against rev d11cf8cc..., tested on ARM user mode, and ARM Vexpress
system mode (with Blue Swirl's fix from yesterday) - only
tested on Linux host.  Lets me run ARM userspace firefox.

Signed-off-by: Dr. David Alan Gilbert <david.gilbert@linaro.org>

diff --git a/cpu-all.h b/cpu-all.h
index 42a5fa0..d895ee6 100644
--- a/cpu-all.h
+++ b/cpu-all.h
@@ -334,7 +334,13 @@ void cpu_dump_statistics(CPUState *env, FILE *f, fprintf_function cpu_fprintf,
 void QEMU_NORETURN cpu_abort(CPUState *env, const char *fmt, ...)
     GCC_FMT_ATTR(2, 3);
 extern CPUState *first_cpu;
+
+#ifdef __linux__
+/* DAG: Only tested thread local on Linux, feel free to add others */
+extern __thread CPUState *cpu_single_env;
+#else
 extern CPUState *cpu_single_env;
+#endif
 
 /* Flags for use in ENV->INTERRUPT_PENDING.
 
diff --git a/exec.c b/exec.c
index d0cbf15..b82d8e4 100644
--- a/exec.c
+++ b/exec.c
@@ -120,7 +120,12 @@ static MemoryRegion *system_io;
 CPUState *first_cpu;
 /* current CPU in the current thread. It is only valid inside
    cpu_exec() */
+#ifdef __linux__
+/* DAG: Only tested thread local on Linux, feel free to add others */
+__thread CPUState *cpu_single_env;
+#else
 CPUState *cpu_single_env;
+#endif
 /* 0 = Do not count executed instructions.
    1 = Precise instruction counting.
    2 = Adaptive rate instruction counting.  */

^ permalink raw reply related	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2011-10-26 16:31 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-03 16:33 [Qemu-devel] [PATCH] Make cpu_single_env thread local (Linux only for now) Dr. David Alan Gilbert
2011-10-03 17:51 ` Jan Kiszka
2011-10-04 15:10   ` Lluís Vilanova
2011-10-04 17:26     ` Jan Kiszka
2011-10-05  7:08       ` Paolo Bonzini
2011-10-05  7:52         ` Jan Kiszka
2011-10-05  9:21           ` Paolo Bonzini
2011-10-07 17:29             ` David Gilbert
2011-10-08 13:41               ` Paolo Bonzini
2011-10-26 14:03             ` Peter Maydell
2011-10-26 14:39               ` Paolo Bonzini
2011-10-26 14:54                 ` Peter Maydell
2011-10-26 14:59                   ` Paolo Bonzini
2011-10-26 15:02                   ` Jan Kiszka
2011-10-26 15:09                     ` Peter Maydell
2011-10-26 15:13                       ` Jan Kiszka
2011-10-26 15:18                         ` Peter Maydell
2011-10-26 16:02                           ` Jan Kiszka
2011-10-26 16:27                             ` Andreas Färber
2011-10-26 16:31                               ` Jan Kiszka

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).