1. 11 Jun, 2012 1 commit
    • Michael Tokarev's avatar
      consolidate qemu_iovec_memset{,_skip}() into single function and use existing iov_memset() · 3d9b4925
      Michael Tokarev authored
      This patch combines two functions into one, and replaces
      the implementation with already existing iov_memset() from
      iov.c.
      
      The new prototype of qemu_iovec_memset():
        size_t qemu_iovec_memset(qiov, size_t offset, int fillc, size_t bytes)
      It is different from former qemu_iovec_memset_skip(), and
      I want to make other functions to be consistent with it
      too: first how much to skip, second what, and 3rd how many
      of it.  It also returns actual number of bytes filled in,
      which may be less than the requested `bytes' if qiov is
      smaller than offset+bytes, in the same way iov_memset()
      does.
      
      While at it, use utility function iov_memset() from
      iov.h in posix-aio-compat.c, where qiov was used.
      Signed-off-by: default avatarMichael Tokarev <mjt@tls.msk.ru>
      3d9b4925
  2. 19 Apr, 2012 2 commits
  3. 13 Jan, 2012 1 commit
  4. 15 Dec, 2011 1 commit
  5. 14 Dec, 2011 1 commit
  6. 11 Nov, 2011 1 commit
  7. 20 Sep, 2011 2 commits
  8. 23 Aug, 2011 1 commit
    • Avi Kivity's avatar
      posix-aio-compat: fix latency issues · e4ea78ee
      Avi Kivity authored
      In certain circumstances, posix-aio-compat can incur a lot of latency:
       - threads are created by vcpu threads, so if vcpu affinity is set,
         aio threads inherit vcpu affinity.  This can cause many aio threads
         to compete for one cpu.
       - we can create up to max_threads (64) aio threads in one go; since a
         pthread_create can take around 30μs, we have up to 2ms of cpu time
         under a global lock.
      
      Fix by:
       - moving thread creation to the main thread, so we inherit the main
         thread's affinity instead of the vcpu thread's affinity.
       - if a thread is currently being created, and we need to create yet
         another thread, let thread being born create the new thread, reducing
         the amount of time we spend under the main thread.
       - drop the local lock while creating a thread (we may still hold the
         global mutex, though)
      
      Note this doesn't eliminate latency completely; scheduler artifacts or
      lack of host cpu resources can still cause it.  We may want pre-allocated
      threads when this cannot be tolerated.
      
      Thanks to Uli Obergfell of Red Hat for his excellent analysis and suggestions.
      Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      e4ea78ee
  9. 20 Aug, 2011 1 commit
  10. 02 Aug, 2011 2 commits
    • Kevin Wolf's avatar
      posix-aio-compat: Allow read after EOF · ba1d1afd
      Kevin Wolf authored
      In order to be able to transparently replace bdrv_read calls by bdrv_co_read,
      reading beyond EOF must produce zeros instead of short reads for AIO, too.
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      ba1d1afd
    • Kevin Wolf's avatar
      async: Remove AsyncContext · 384acbf4
      Kevin Wolf authored
      The purpose of AsyncContexts was to protect qcow and qcow2 against reentrancy
      during an emulated bdrv_read/write (which includes a qemu_aio_wait() call and
      can run AIO callbacks of different requests if it weren't for AsyncContexts).
      
      Now both qcow and qcow2 are protected by CoMutexes and AsyncContexts can be
      removed.
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      384acbf4
  11. 08 Jun, 2011 1 commit
  12. 18 May, 2011 1 commit
    • Kevin Wolf's avatar
      posix-aio-compat: Fix idle_threads counter · 5be4aab7
      Kevin Wolf authored
      A thread should only be counted as idle when it really is waiting for new
      requests. Without this patch, sometimes too few threads are started as busy
      threads are counted as idle.
      
      Not sure if it makes a difference in practice outside some artificial
      qemu-io/qemu-img tests, but I think the change makes sense in any case.
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      5be4aab7
  13. 07 Mar, 2011 1 commit
  14. 30 Oct, 2010 1 commit
  15. 05 Oct, 2010 1 commit
  16. 21 Sep, 2010 1 commit
  17. 09 Sep, 2010 1 commit
  18. 30 Aug, 2010 1 commit
  19. 28 May, 2010 1 commit
  20. 26 Jan, 2010 1 commit
  21. 03 Dec, 2009 2 commits
  22. 30 Oct, 2009 1 commit
  23. 27 Oct, 2009 3 commits
  24. 26 Sep, 2009 1 commit
  25. 12 Sep, 2009 2 commits
  26. 11 Sep, 2009 1 commit
  27. 27 Aug, 2009 1 commit
    • Christoph Hellwig's avatar
      raw-posix: refactor AIO support · 9ef91a67
      Christoph Hellwig authored
      Currently the raw-posix.c code contains a lot of knowledge about the
      asynchronous I/O scheme that is mostly implemented in posix-aio-compat.c.
      All this code does not really belong here and is getting a bit in the
      way of implementing native AIO on Linux.
      
      So instead move all the guts of the AIO implementation into
      posix-aio-compat.c (which might need a better name, btw).
      
      There's now a very small interface between the AIO providers and raw-posix.c:
      
       - an init routine is called from raw_open_common to return an AIO context
         for this drive.  An AIO implementation may either re-use one context
         for all drives, or use a different one for each as the Linux native
         AIO support will do.
       - an submit routine is called from the aio_reav/writev methods to submit
         an AIO request
      
      There are no indirect calls involved in this interface as we need to
      decide which one to call manually.  We will only call the Linux AIO native
      init function if we were requested to by vl.c, and we will only call
      the native submit function if we are asked to and the request is properly
      aligned.  That's also the reason why the alignment check actually does
      the inverse move and now goes into raw-posix.c.
      
      The old posix-aio-compat.h headers is removed now that most of it's
      content is private to posix-aio-compat.c, and instead we add a new
      block/raw-posix-aio.h headers is created containing only the tiny interface
      between raw-posix.c and the AIO implementation.
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarAnthony Liguori <aliguori@us.ibm.com>
      9ef91a67
  28. 27 Jul, 2009 1 commit
  29. 08 May, 2009 1 commit
  30. 07 Apr, 2009 2 commits
  31. 28 Mar, 2009 1 commit
    • aliguori's avatar
      new scsi-generic abstraction, use SG_IO (Christoph Hellwig) · 221f715d
      aliguori authored
      Okay, I started looking into how to handle scsi-generic I/O in the
      new world order.
      
      I think the best is to use the SG_IO ioctl instead of the read/write
      interface as that allows us to support scsi passthrough on disk/cdrom
      devices, too.  See Hannes patch on the kvm list from August for an
      example.
      
      Now that we always do ioctls we don't need another abstraction than
      bdrv_ioctl for the synchronous requests for now, and for asynchronous
      requests I've added a aio_ioctl abstraction keeping it simple.
      
      Long-term we might want to move the ops to a higher-level abstraction
      and let the low-level code fill out the request header, but I'm lazy
      enough to leave that to the people trying to support scsi-passthrough
      on a non-Linux OS.
      
      Tested lightly by issuing various sg_ commands from sg3-utils in a guest
      to a host CDROM device.
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarAnthony Liguori <aliguori@us.ibm.com>
      
      
      git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6895 c046a42c-6fe2-441c-8c8c-71466251a162
      221f715d
  32. 20 Feb, 2009 1 commit