qemu-stable
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-stable] [PATCH] stream: fix the deadlock bug when stream finis


From: Paolo Bonzini
Subject: Re: [Qemu-stable] [PATCH] stream: fix the deadlock bug when stream finish
Date: Wed, 27 Aug 2014 18:28:23 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0

Il 27/08/2014 17:53, Michael Roth ha scritto:
>> In case VM does IO while we run a stream job.
>> When stream finishes, the stream coroutine drains all IOs before
>> close the unused image, in bdrv_drain_all() it may find
>> a pending request which is submitted by guest IO coroutine.
>> In order to wait the pending req finish, the subsequent aio_poll()
>> call poll() to wait the req. however, if the req is already done by
>> threadpool and is waiting for the callback, there is no chance to switch
>> back to guest IO coroutine to call the callback and so that the stream
>> coroutine waits in poll() all the time.

This is the same bug fixed by this patch;

commit 3c80ca158c96ff902a30883a8933e755988948b1
Author: Stefan Hajnoczi <address@hidden>
Date:   Tue Jul 15 16:44:26 2014 +0200

    thread-pool: avoid deadlock in nested aio_poll() calls

    The thread pool has a race condition if two elements complete before
    thread_pool_completion_bh() runs:
    
      If element A's callback waits for element B using aio_poll() it will
      deadlock since pool->completion_bh is not marked scheduled when the
      nested aio_poll() runs.
    
    Fix this by marking the BH scheduled while thread_pool_completion_bh()
    is executing.  This way any nested aio_poll() loops will enter
    thread_pool_completion_bh() and complete the remaining elements.
    
    Signed-off-by: Stefan Hajnoczi <address@hidden>

Paolo



reply via email to

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