qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] Make cpu_single_env thread local (Linux only fo


From: Jan Kiszka
Subject: Re: [Qemu-devel] [PATCH] Make cpu_single_env thread local (Linux only for now)
Date: Mon, 03 Oct 2011 19:51:42 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666

On 2011-10-03 18:33, Dr. David Alan Gilbert wrote:
>   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 <address@hidden>
> 
> 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

We need this for all platforms in order to skip qemu_global_mutex while
manipulating some CPUState. And leaving some platforms with non-TLS will
eventually break them when code is added that assumes TLS.

However, it's not unlikely that some weird platforms / ancient
toolchains still have problems with __thread - even on Linux. We may
want to play safe and use pthread_key on POSIX.

Jan

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]