qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@web.de>
To: "Dr. David Alan Gilbert" <david.gilbert@linaro.org>
Cc: peter.maydell@linaro.org, patches@linaro.org,
	qemu-devel@nongnu.org, agraf@suse.de
Subject: Re: [Qemu-devel] [PATCH] Make cpu_single_env thread local (Linux only for now)
Date: Mon, 03 Oct 2011 19:51:42 +0200	[thread overview]
Message-ID: <4E89F62E.1020804@web.de> (raw)
In-Reply-To: <20111003163352.GA22822@davesworkthinkpad>

[-- Attachment #1: Type: text/plain, Size: 1421 bytes --]

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

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 #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

  reply	other threads:[~2011-10-03 17:51 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

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=4E89F62E.1020804@web.de \
    --to=jan.kiszka@web.de \
    --cc=agraf@suse.de \
    --cc=david.gilbert@linaro.org \
    --cc=patches@linaro.org \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /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).