From: Jan Kiszka <jan.kiszka@siemens.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
"agraf@suse.de" <agraf@suse.de>,
"Dr. David Alan Gilbert" <david.gilbert@linaro.org>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
"patches@linaro.org" <patches@linaro.org>
Subject: Re: [Qemu-devel] [PATCH] Make cpu_single_env thread local (Linux only for now)
Date: Wed, 26 Oct 2011 17:13:25 +0200 [thread overview]
Message-ID: <4EA82395.20408@siemens.com> (raw)
In-Reply-To: <CAFEAcA8AUVmWAQ55E2gSs_CDqMn2-C=r1XAZbdO_Q93LfEQx5Q@mail.gmail.com>
On 2011-10-26 17:09, Peter Maydell wrote:
> On 26 October 2011 16:02, Jan Kiszka <jan.kiszka@siemens.com> wrote:
>> On 2011-10-26 16:54, Peter Maydell wrote:
>>> On 26 October 2011 15:39, Paolo Bonzini <pbonzini@redhat.com> wrote:
>>>> On 10/26/2011 04:03 PM, Peter Maydell wrote:
>>>>>
>>>>> For the record (since I think we only talked about this on IRC):
>>>>> * the POSIX TLS fallback code doesn't work on Linux hosts for
>>>>> linux-user emulation (the constructor is never called to set up
>>>>> the TLS for the main thread, probably something to do with our
>>>>> custom linker script, since it does work OK for system emulation)
>>>>> * if I recall correctly from IRC it doesn't compile on OpenBSD
>>>>>
>>>>> so for 1.0 perhaps we need to fall back to a simpler set of patches
>>>>> that just avoid the regression in thread support for linux-user ?
>>>>
>>>> I agree.
>>>
>>> I was thinking something like a trivial qemu-tls.h which does
>>>
>>> #ifdef __linux__
>>> #define DECLARE_TLS(type, x) extern DEFINE_TLS(type, x)
>>> #define DEFINE_TLS(type, x) __thread __typeof__(type) tls__##x
>>> #define get_tls(x) tls__##x
>>> #else
>>> /* Dummy implementations -- we can get away with this because system
>>> * mode is effectively single-threaded for our current limited use of
>>> * TLS, and the only -user mode which supports multiple threads is
>>> * linux-user.
>>
>> We will use it in system mode as well, e.g. when I'll push away the
>> global lock from KVM entry/exits. So let's state that it is only
>> interesting on Linux hosts for now.
>>
>> Otherwise, this looks good.
>
> The point of the comment is that you can't use this facility in
> system mode until we've added the non-Linux support (because you'd
> break Win32 &c). So fixing and committing the non-Linux support is
> a prerequisite for anything like the global lock moves. I can be
> a bit more explicit about that if you like:
>
> /* Dummy implementations -- we can get away with this because system
> * mode is effectively single-threaded for our current limited use of
> * TLS, and the only -user mode which supports multiple threads is
> * linux-user.
> * This means you cannot use this for any variables which will
> * actually be accessed by more than one thread in system mode
> * until the implementations for Win32 and POSIX systems without
> * __thread have been added!
> *
> * TODO: add implementations via Win32 .tls sections and
> * POSIX pthread_getspecific.
> */
>
> -- PMM
My point is that it is fine to use for per-vcpu variables because:
- they are single-threaded in TCG mode
- they are multi-threaded in KVM mode, but that's only affecting Linux
hosts for which this TLS wrapper is already usable
Jan
--
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
next prev parent reply other threads:[~2011-10-26 15:13 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
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 [this message]
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=4EA82395.20408@siemens.com \
--to=jan.kiszka@siemens.com \
--cc=agraf@suse.de \
--cc=david.gilbert@linaro.org \
--cc=patches@linaro.org \
--cc=pbonzini@redhat.com \
--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).