Skip to content
Snippets Groups Projects
  • Pavel Dovgaluk's avatar
    ddf63df7
    replay: implement fair mutex · ddf63df7
    Pavel Dovgaluk authored
    
    In record/replay icount mode main loop thread and vCPU thread
    do not perform simultaneously. They take replay mutex to synchronize
    the actions. Sometimes vCPU thread waits for locking the mutex for
    very long time, because main loop releases the mutex and takes it
    back again. Standard qemu mutex do not provide the ordering
    capabilities.
    
    This patch adds a "queue" for replay mutex. Therefore thread ordering
    becomes more "fair". Threads are executed in the same order as
    they are trying to take the mutex.
    
    Signed-off-by: default avatarPavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>
    Message-Id: <158823802979.28101.9340462887738957616.stgit@pasha-ThinkPad-X280>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    ddf63df7
    History
    replay: implement fair mutex
    Pavel Dovgaluk authored
    
    In record/replay icount mode main loop thread and vCPU thread
    do not perform simultaneously. They take replay mutex to synchronize
    the actions. Sometimes vCPU thread waits for locking the mutex for
    very long time, because main loop releases the mutex and takes it
    back again. Standard qemu mutex do not provide the ordering
    capabilities.
    
    This patch adds a "queue" for replay mutex. Therefore thread ordering
    becomes more "fair". Threads are executed in the same order as
    they are trying to take the mutex.
    
    Signed-off-by: default avatarPavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>
    Message-Id: <158823802979.28101.9340462887738957616.stgit@pasha-ThinkPad-X280>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>