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: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH] Make cpu_single_env thread local (Linux only for now)
Date: Wed, 05 Oct 2011 11:21:01 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:6.0.2) Gecko/20110906 Thunderbird/6.0.2

On 10/05/2011 09:52 AM, Jan Kiszka wrote:
Yeah, it probably makes sense to build the abstractions around __thread
so that - one day - we can drop the legacy wrappers.

Just do not prepend "tls__" in the gcc model

Actually I did that on purpose so that people would not forget get_tls. :)

(there is also some inconsistency with prefixes in patch 3).

Yep, the attached v2 actually builds. I also needed a small change to avoid errors with -Wredundant-decls, and I changed it to support arrays with

DECLARE_TLS(int[10], array);

And avoid leading "_" unless
they are dictated by the platform.

Ok, I replaced tls_init_thread with tls_init_main_thread and _tls_init_thread with tls_init_thread.

And patch 3 needs to update darwin-user/main.c as well.

I think the declaration can just be removed.

What is the default priority of constructors BTW? You picked the
highest, will others that do not specify one have the same?

Looks like the prioritized constructors always run _before_ the others, which is good.

$ cat f.c
int f(void) __attribute__((constructor(101)));
int f(void) { write (1, "101\n", 4); }
int h(void) __attribute__((constructor));
int h(void) { write (1, "default\n", 8); }
int g(void) __attribute__((constructor(102)));
int g(void) { write (1, "102\n", 4); }
int main() { write(1, "main\n", 5); }
$ gcc f.c
$ ./a.out
101
102
default
main

If interested people can test the patches more and submit them more formally, I'd be very glad. I wrote it for RCU, but of course that one is not really going to be 1.0 material (even for 9p).

Paolo

Attachment: tls-cpu-single-env.patch
Description: Text Data


reply via email to

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