[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] Status of multithreading in user mode
From: |
Laurent Vivier |
Subject: |
Re: [Qemu-devel] Status of multithreading in user mode |
Date: |
Wed, 24 Feb 2016 12:27:20 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 |
Le 23/02/2016 17:40, Cecilia Gonzalez-Alvarez a écrit :
> Hi all,
Hi Cecilia,
> I'm planning to use Qemu as a functional simulation frontend for a
> multicore simulator.
>
> Although later plans include full-system simulation, I'd like to start,
> for the sake of simplicity, with the individual simulation of
> applications in user mode.
>
> I'm interested in targets x86_64 and AArch64, and my general question
> is: how is the status of multithreading in user mode for those targets?
> Concretely, can we trust that running multiple threads on qemu-x86_64
> and qemu-aarch64 will be reliable most of the time?
>
> Going through the mailing list I have the feeling that multithreading
> and user mode is a recurring issue.
>
> I've done some experiments with the latest Qemu from the repository
> (2.5.50) and although user mode for both architectures is mostly working
> well, it fails with this particular example for qemu-x86_64:
> http://users.elis.ugent.be/~cgonzlez/fft.c
>
> Compiled with GCC 4.8.4:
> gcc -mno-sse4 -mno-sse4.1 -mno-sse4.2 -mno-sse4a -mno-avx -mno-avx2
> -c -o fft.o fft.c
> gcc fft.o -lm -static -pthread -o fft
> and executed with 32 threads:
> qemu-x86_64 fft -p32
> sometimes, randomly, stalls on a sys_futex.
>
> I don't know if this is a very concrete bug that I should report
> somewhere else; my main concern is to know if threading support in user
> mode is almost fully implemented and stable with just some random and
> unimportant bugs.
ARM has some atomic operations implemented by stopping all other CPU
threads (see linux-user/main.c, do_strex_a64()). But I don't think
locked operations have been implemented for x86_64.
And Michael has found a bug in the futex implementation in linux-user mode.
You can find a fix here:
https://github.com/vivier/qemu-m68k/commit/236f512f1c020e2d774216a9beb1466c260a89e2
This is not the original fix from Michael, but the idea is here and he
did all the work.
Laurent