[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-stable] [Qemu-devel] [PATCH] coroutine: add ./configure --disa
From: |
Stefan Weil |
Subject: |
Re: [Qemu-stable] [Qemu-devel] [PATCH] coroutine: add ./configure --disable-coroutine-pool |
Date: |
Tue, 01 Oct 2013 07:51:24 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Thunderbird/24.0 |
Am 30.09.2013 11:06, schrieb Stefan Hajnoczi:
> On Fri, Sep 27, 2013 at 06:49:18PM +0200, Stefan Weil wrote:
>> Am 27.09.2013 11:11, schrieb Stefan Hajnoczi:
>>> On Fri, Sep 27, 2013 at 07:20:21AM +0200, Stefan Weil wrote:
>>>> Am 11.09.2013 16:42, schrieb Stefan Hajnoczi:
>>>>> The 'gthread' coroutine backend was written before the freelist (aka
>>>>> pool) existed in qemu-coroutine.c.
>>>>>
>>>>> This means that every thread is expected to exit when its coroutine
>>>>> terminates. It is not possible to reuse threads from a pool.
>>>>>
>>>>> This patch automatically disables the pool when 'gthread' is used. This
>>>>> allows the 'gthread' backend to work again (for example,
>>>>> tests/test-coroutine completes successfully instead of hanging).
>>>>>
>>>>> I considered implementing thread reuse but I don't want quirks like CPU
>>>>> affinity differences due to coroutine threads being recycled. The
>>>>> 'gthread' backend is a reference backend and it's therefore okay to skip
>>>>> the pool optimization.
>>>>>
>>>>> Note this patch also makes it easy to toggle the pool for benchmarking
>>>>> purposes:
>>>>>
>>>>> ./configure --with-coroutine-backend=ucontext \
>>>>> --disable-coroutine-pool
>>>>>
>>>>> Reported-by: Gabriel Kerneis <address@hidden>
>>>>> Signed-off-by: Stefan Hajnoczi <address@hidden>
>>>>> ---
>>>>> configure | 24 ++++++++++++++++++++++++
>>>>> qemu-coroutine.c | 34 +++++++++++++++++++---------------
>>>>> 2 files changed, 43 insertions(+), 15 deletions(-)
>>>>>
>>>> This patch is important for QEMU 1.5 as well, but needs some
>>>> modifications there.
>>>> A recent bug report for MinGW shows that the win32 coroutine needs it, too.
>>> coroutine-win32.c is designed to support reuse:
>>>
>>> static void CALLBACK coroutine_trampoline(void *co_)
>>> {
>>> Coroutine *co = co_;
>>>
>>> while (true) {
>>> co->entry(co->entry_arg);
>>> qemu_coroutine_switch(co, co->caller, COROUTINE_TERMINATE);
>>> }
>>> }
>>>
>>> We return from qemu_coroutine_switch() when the fiber is reused and
>>> simply run another iteration of the while loop.
>>>
>>> Why do you say win32 coroutines should disable the pool?
>>>
>>> Stefan
>> QEMU MinGW binaries with coroutine pool simply crash, and disabling the
>> pool helps
>> for the moment until we have a better fix. That's a regression which was
>> introduced
>> with a patch which added the pool for win32.
>>
>> See this discussion thread for more details:
>> http://lists.nongnu.org/archive/html/qemu-devel/2013-09/msg04195.html
> I'd like to fix the win32 coroutine backend.
>
> In your email you said it can be reproduced under wine on Linux. I
> wasn't able to reproduce it with this command-line:
>
> $ wine qemu-system-x86_64.exe -m 1024 -vnc :1 -L ../pc-bios -hda ../test.img
>
> Stefan: Do you have a ./configure and QEMU command-line which reproduces
> the assertion failure under wine?
>
> Stefan
Here is my current test environment:
* Debian wheezy x86_64 host (running on a KVM server)
* latest QEMU sources
$ ./configure' '--cross-prefix=i686-w64-mingw32-'
'--enable-trace-backend=stderr' --target-list=i386-softmmu && make
# Get Debian installer CDROM mini.iso.
$ wine i386-softmmu/qemu-system-i386 -L pc-bios -cdrom /var/tmp/mini.iso
-sdl # or -vnc :1
=> Assertion in qemu-coroutine-lock.c:99.
I also tested a similar scenario on an ASUS netbook with Ubuntu some
days ago and got the same result.
Regards,
Stefan
- Re: [Qemu-stable] [Qemu-devel] [PATCH] coroutine: add ./configure --disable-coroutine-pool,
Stefan Weil <=