1. 07 6月, 2016 1 次提交
  2. 23 3月, 2016 1 次提交
    • M
      include/qemu/osdep.h: Don't include qapi/error.h · da34e65c
      Markus Armbruster 提交于
      Commit 57cb38b3 included qapi/error.h into qemu/osdep.h to get the
      Error typedef.  Since then, we've moved to include qemu/osdep.h
      everywhere.  Its file comment explains: "To avoid getting into
      possible circular include dependencies, this file should not include
      any other QEMU headers, with the exceptions of config-host.h,
      compiler.h, os-posix.h and os-win32.h, all of which are doing a
      similar job to this file and are under similar constraints."
      qapi/error.h doesn't do a similar job, and it doesn't adhere to
      similar constraints: it includes qapi-types.h.  That's in excess of
      100KiB of crap most .c files don't actually need.
      
      Add the typedef to qemu/typedefs.h, and include that instead of
      qapi/error.h.  Include qapi/error.h in .c files that need it and don't
      get it now.  Include qapi-types.h in qom/object.h for uint16List.
      
      Update scripts/clean-includes accordingly.  Update it further to match
      reality: replace config.h by config-target.h, add sysemu/os-posix.h,
      sysemu/os-win32.h.  Update the list of includes in the qemu/osdep.h
      comment quoted above similarly.
      
      This reduces the number of objects depending on qapi/error.h from "all
      of them" to less than a third.  Unfortunately, the number depending on
      qapi-types.h shrinks only a little.  More work is needed for that one.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      [Fix compilation without the spice devel packages. - Paolo]
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      da34e65c
  3. 16 2月, 2016 1 次提交
  4. 13 1月, 2016 2 次提交
  5. 20 10月, 2014 1 次提交
  6. 22 9月, 2014 2 次提交
    • C
      async: aio_context_new(): Handle event_notifier_init failure · 2f78e491
      Chrysostomos Nanakos 提交于
      On a system with a low limit of open files the initialization
      of the event notifier could fail and QEMU exits without printing any
      error information to the user.
      
      The problem can be easily reproduced by enforcing a low limit of open
      files and start QEMU with enough I/O threads to hit this limit.
      
      The same problem raises, without the creation of I/O threads, while
      QEMU initializes the main event loop by enforcing an even lower limit of
      open files.
      
      This commit adds an error message on failure:
      
       # qemu [...] -object iothread,id=iothread0 -object iothread,id=iothread1
       qemu: Failed to initialize event notifier: Too many open files in system
      Signed-off-by: NChrysostomos Nanakos <cnanakos@grnet.gr>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      2f78e491
    • F
      thread-pool: Convert thread_pool_aiocb_info.cancel to cancel_async · 3391f5e5
      Fam Zheng 提交于
      The .cancel_async shares the same the first half with .cancel: try to
      steal the request if not submitted yet. In this case set the elem to
      THREAD_DONE status and ret to -ECANCELED, which means
      thread_pool_completion_bh will call the cb with -ECANCELED.
      
      If the request is already submitted, do nothing, as we know the normal
      completion will happen in the future.
      
      Testing code update:
      
      Before, done_cb is only called if the request is already submitted by
      thread pool. Now done_cb is always called, even before it is submitted,
      because we emulate bdrv_aio_cancel with bdrv_aio_cancel_async. So also
      update the test criteria accordingly.
      Signed-off-by: NFam Zheng <famz@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      3391f5e5
  7. 09 7月, 2014 1 次提交
  8. 28 5月, 2014 1 次提交
    • F
      aio: Fix use-after-free in cancellation path · 271c0f68
      Fam Zheng 提交于
      The current flow of canceling a thread from THREAD_ACTIVE state is:
      
        1) Caller wants to cancel a request, so it calls thread_pool_cancel.
      
        2) thread_pool_cancel waits on the conditional variable
           elem->check_cancel.
      
        3) The worker thread changes state to THREAD_DONE once the task is
           done, and notifies elem->check_cancel to allow thread_pool_cancel
           to continue execution, and signals the notifier (pool->notifier) to
           allow callback function to be called later. But because of the
           global mutex, the notifier won't get processed until step 4) and 5)
           are done.
      
        4) thread_pool_cancel continues, leaving the notifier signaled, it
           just returns to caller.
      
        5) Caller thinks the request is already canceled successfully, so it
           releases any related data, such as freeing elem->common.opaque.
      
        6) In the next main loop iteration, the notifier handler,
           event_notifier_ready, is called. It finds the canceled thread in
           THREAD_DONE state, so calls elem->common.cb, with an (likely)
           dangling opaque pointer. This is a use-after-free.
      
      Fix it by calling event_notifier_ready before leaving
      thread_pool_cancel.
      
      Test case update: This change will let cancel complete earlier than
      test-thread-pool.c expects, so update the code to check this case: if
      it's already done, done_cb sets .aiocb to NULL, skip calling
      bdrv_aio_cancel on them.
      Reported-by: NUlrich Obergfell <uobergfe@redhat.com>
      Suggested-by: NPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NFam Zheng <famz@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      271c0f68
  9. 23 8月, 2013 1 次提交
  10. 19 8月, 2013 1 次提交
  11. 04 7月, 2013 1 次提交
  12. 15 3月, 2013 1 次提交
    • S
      threadpool: drop global thread pool · c4d9d196
      Stefan Hajnoczi 提交于
      Now that each AioContext has a ThreadPool and the main loop AioContext
      can be fetched with bdrv_get_aio_context(), we can eliminate the concept
      of a global thread pool from thread-pool.c.
      
      The submit functions must take a ThreadPool* argument.
      
      block/raw-posix.c and block/raw-win32.c use
      aio_get_thread_pool(bdrv_get_aio_context(bs)) to fetch the main loop's
      ThreadPool.
      
      tests/test-thread-pool.c must be updated to reflect the new
      thread_pool_submit() function prototypes.
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: NPaolo Bonzini <pbonzini@redhat.com>
      c4d9d196
  13. 19 12月, 2012 1 次提交
  14. 11 12月, 2012 1 次提交
  15. 27 11月, 2012 1 次提交
  16. 26 11月, 2012 1 次提交