[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [Qemu-trivial] [PATCH] tls.h: Enable TLS on FreeBSD
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [Qemu-trivial] [PATCH] tls.h: Enable TLS on FreeBSD |
Date: |
Fri, 28 Jun 2013 17:11:19 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130514 Thunderbird/17.0.6 |
Il 28/06/2013 16:55, Peter Maydell ha scritto:
>>> >> I don't understand what you mean by "no need for it". We are
>>> >> already multithreaded in system mode, so this is simply
>>> >> making FreeBSD do the same thing as Linux.
>> >
>> > cpu_single_env is protected by the BQL unless you're running on KVM.
> That doesn't make it magically not a per-thread variable.
If it were possible to say "make cpu_single_env magically not per-thread
on Linux/TCG", I'd be all for it!
But I _can_ make cpu_single_env not per-thread on FreeBSD/TCG, because
no one needs per-thread cpu_single_env on FreeBSD.
If we could drop support for platforms that lack __thread (or some other
fast TLS mechanism), then it would be another story of course. We would
not have to do things like this for qtest:
while (1) {
cpu_single_env = NULL;
qemu_mutex_unlock_iothread();
do {
int sig;
r = sigwait(&waitset, &sig);
} while (r == -1 && (errno == EAGAIN || errno == EINTR));
if (r == -1) {
perror("sigwait");
exit(1);
}
qemu_mutex_lock_iothread();
cpu_single_env = env;
qemu_wait_io_event_common(cpu);
}
or similarly set cpu_single_env in cpu_exec.
And of course if bsd-user supported 1:1 mapping between guest and host
threads on FreeBSD, cpu_single_env would have to be thread-local.
Paolo
- Re: [Qemu-devel] [PATCH] tls.h: Enable TLS on FreeBSD, (continued)
- Re: [Qemu-devel] [Qemu-trivial] [PATCH] tls.h: Enable TLS on FreeBSD, Michael Tokarev, 2013/06/28
- Re: [Qemu-devel] [Qemu-trivial] [PATCH] tls.h: Enable TLS on FreeBSD, Ed Maste, 2013/06/28
- Re: [Qemu-devel] [Qemu-trivial] [PATCH] tls.h: Enable TLS on FreeBSD, Paolo Bonzini, 2013/06/28
- Re: [Qemu-devel] [Qemu-trivial] [PATCH] tls.h: Enable TLS on FreeBSD, Peter Maydell, 2013/06/28
- Re: [Qemu-devel] [Qemu-trivial] [PATCH] tls.h: Enable TLS on FreeBSD, Ed Maste, 2013/06/28
- Re: [Qemu-devel] [Qemu-trivial] [PATCH] tls.h: Enable TLS on FreeBSD, Paolo Bonzini, 2013/06/28
- Re: [Qemu-devel] [Qemu-trivial] [PATCH] tls.h: Enable TLS on FreeBSD, Peter Maydell, 2013/06/28
- Re: [Qemu-devel] [Qemu-trivial] [PATCH] tls.h: Enable TLS on FreeBSD,
Paolo Bonzini <=
- Re: [Qemu-devel] [Qemu-trivial] [PATCH] tls.h: Enable TLS on FreeBSD, Ed Maste, 2013/06/28
- Re: [Qemu-devel] [Qemu-trivial] [PATCH] tls.h: Enable TLS on FreeBSD, Paolo Bonzini, 2013/06/28