1. 27 3月, 2013 17 次提交
  2. 17 3月, 2013 1 次提交
  3. 16 3月, 2013 1 次提交
    • D
      Fix TAGS creation · b1999e87
      David Gibson 提交于
      Currently the Makefile creates TAGS for emacs with the command:
          find "$(SRC_PATH)" -name '*.[hc]' -print0 | xargs -0 etags
      That works only if xargs ends up invoking etags just once.  If xargs runs
      etags several times, as it will if there are enough files, then the later
      invocations will overwrite the output from the earlier invocations.  This
      patch uses the etags --append option to fix the bug.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Message-id: 1363057048-21534-1-git-send-email-david@gibson.dropbear.id.au
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      b1999e87
  4. 15 3月, 2013 21 次提交
    • A
      Merge remote-tracking branch 'stefanha/block' into staging · dc0b0616
      Anthony Liguori 提交于
      # By Stefan Hajnoczi (14) and others
      # Via Stefan Hajnoczi
      * stefanha/block: (28 commits)
        blockdev: Fix up copyright and permission notice
        qemu-iotests: use -nographic in test case 007
        qemu-iotests: add tests for rebasing zero clusters
        dataplane: fix hang introduced by AioContext transition
        coroutine: use AioContext for CoQueue BH
        threadpool: drop global thread pool
        block: add bdrv_get_aio_context()
        aio: add a ThreadPool instance to AioContext
        threadpool: add thread_pool_new() and thread_pool_free()
        threadpool: move globals into struct ThreadPool
        main-loop: add qemu_get_aio_context()
        sheepdog: set io_flush handler in do_co_req
        sheepdog: use non-blocking fd in coroutine context
        qcow2: make is_allocated return true for zero clusters
        qcow2: drop unnecessary flush in qcow2_update_snapshot_refcount()
        qcow2: drop flush in update_cluster_refcount()
        qcow2: flush in qcow2_update_snapshot_refcount()
        qcow2: set L2 cache dependency in qcow2_alloc_bytes()
        qcow2: flush refcount cache correctly in qcow2_write_snapshots()
        qcow2: flush refcount cache correctly in alloc_refcount_block()
        ...
      dc0b0616
    • A
      Merge remote-tracking branch 'cohuck/virtio-ccw-upstr' into staging · d4d76824
      Anthony Liguori 提交于
      # By Christian Borntraeger (1) and Cornelia Huck (1)
      # Via Cornelia Huck
      * cohuck/virtio-ccw-upstr:
        virtio-ccw: Wire up virtio-rng.
        virtio-ccw: remove qdev_unparent in unplug routing
      d4d76824
    • M
      blockdev: Fix up copyright and permission notice · 3618a094
      Markus Armbruster 提交于
      Screwed up in commit 666daa68.  Thanks to Kevin Wolf for reminding me
      to fix this.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      3618a094
    • S
      qemu-iotests: use -nographic in test case 007 · 804dd417
      Stefan Hajnoczi 提交于
      A comment explains that -nographic hangs test case 007.  This is no
      longer the case so add -nographic.  This makes the test suite faster and
      more pleasant to run since no windows pop up.
      
      I am not sure exactly when -nographic starting working for this case but
      there is no fundamental reason why graphics are needed here.  Make sure
      the serial port is not on stdio, it would conflict with the monitor.
      
      Also remove unnecessary trailing whitespace on these lines.
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      Tested-by: NKevin Wolf <kwolf@redhat.com>
      804dd417
    • P
      qemu-iotests: add tests for rebasing zero clusters · acbf30ec
      Paolo Bonzini 提交于
      If zero clusters are erroneously treated as unallocated, "qemu-img rebase"
      will copy the backing file's contents onto the cluster.
      
      The bug existed also in image streaming, but since the root cause was in
      qcow2's is_allocated implementation it is enough to test it with qemu-img.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      acbf30ec
    • P
      dataplane: fix hang introduced by AioContext transition · 485e3ce8
      Paolo Bonzini 提交于
      The bug is that the EventNotifiers do have a NULL io_flush callback.
      Because _none_ of the callbacks on the dataplane AioContext have such a
      callback, aio_poll will simply do nothing.  Fixed by adding the callbacks:
      the ioeventfd will always be polled (this can change in the future to
      pause/resume the processing during live snapshots or similar operations);
      the ioqueue will be polled if there are outstanding requests.
      
      I must admit I have screwed up my testing somehow, because commit
      2c20e711 does not work even if cherry-picked on top of 1.4.0, and this
      patch fixes it there as well.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      485e3ce8
    • S
      coroutine: use AioContext for CoQueue BH · 28f08246
      Stefan Hajnoczi 提交于
      CoQueue uses a BH to awake coroutines that were made ready to run again
      using qemu_co_queue_next() or qemu_co_queue_restart_all().  The BH
      currently runs in the iothread AioContext and would break coroutines
      that run in a different AioContext.
      
      This is a slightly tricky problem because the lifetime of the BH exceeds
      that of the CoQueue.  This means coroutines can be awoken after CoQueue
      itself has been freed.  Also, there is no qemu_co_queue_destroy()
      function which we could use to handle freeing resources.
      
      Introducing qemu_co_queue_destroy() has a ripple effect of requiring us
      to also add qemu_co_mutex_destroy() and qemu_co_rwlock_destroy(), as
      well as updating all callers.  Avoid doing that.
      
      We also cannot switch from BH to GIdle function because aio_poll() does
      not dispatch GIdle functions.  (GIdle functions make memory management
      slightly easier because they free themselves.)
      
      Finally, I don't want to move unlock_queue and unlock_bh into
      AioContext.  That would break encapsulation - AioContext isn't supposed
      to know about CoQueue.
      
      This patch implements a different solution: each qemu_co_queue_next() or
      qemu_co_queue_restart_all() call creates a new BH and list of coroutines
      to wake up.  Callers tend to invoke qemu_co_queue_next() and
      qemu_co_queue_restart_all() occasionally after blocking I/O, so creating
      a new BH for each call shouldn't be massively inefficient.
      
      Note that this patch does not add an interface for specifying the
      AioContext.  That is left to future patches which will convert CoQueue,
      CoMutex, and CoRwlock to expose AioContext.
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: NPaolo Bonzini <pbonzini@redhat.com>
      28f08246
    • 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
    • S
      block: add bdrv_get_aio_context() · 85d126f3
      Stefan Hajnoczi 提交于
      For now bdrv_get_aio_context() is just a stub that calls
      qemu_aio_get_context() since the block layer is currently tied to the
      main loop AioContext.
      
      Add the stub now so that the block layer can begin accessing its
      AioContext.
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: NPaolo Bonzini <pbonzini@redhat.com>
      85d126f3
    • S
      aio: add a ThreadPool instance to AioContext · 9b34277d
      Stefan Hajnoczi 提交于
      This patch adds a ThreadPool to AioContext.  It's possible that some
      AioContext instances will never use the ThreadPool, so defer creation
      until aio_get_thread_pool().
      
      The reason why AioContext should have the ThreadPool is because the
      ThreadPool is bound to a AioContext instance where the work item's
      callback function is invoked.  It doesn't make sense to keep the
      ThreadPool pointer anywhere other than AioContext.  For example,
      block/raw-posix.c can get its AioContext's ThreadPool and submit work.
      
      Special note about headers: I used struct ThreadPool in aio.h because
      there is a circular dependency if aio.h includes thread-pool.h.
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: NPaolo Bonzini <pbonzini@redhat.com>
      9b34277d
    • S
      threadpool: add thread_pool_new() and thread_pool_free() · f7311ccc
      Stefan Hajnoczi 提交于
      ThreadPool is tied to an AioContext through its event notifier, which
      dictates in which AioContext the work item's callback function will be
      invoked.
      
      In order to support multiple AioContexts we need to support multiple
      ThreadPool instances.
      
      This patch adds the new/free functions.  The free function deserves
      special attention because it quiesces remaining worker threads.  This
      requires a new condition variable and a "stopping" flag to let workers
      know they should terminate once idle.
      
      We never needed to do this before since the global threadpool was not
      explicitly destroyed until process termination.
      
      Also stash the AioContext pointer in ThreadPool so that we can call
      aio_set_event_notifier() in thread_pool_free().  We didn't need to hold
      onto AioContext previously since there was no free function.
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: NPaolo Bonzini <pbonzini@redhat.com>
      f7311ccc
    • S
      threadpool: move globals into struct ThreadPool · b811203c
      Stefan Hajnoczi 提交于
      Move global variables into a struct so multiple thread pools can be
      supported in the future.
      
      This patch does not change thread-pool.h interfaces.  There is still a
      global thread pool and it is not yet possible to create/destroy
      individual thread pools.  Moving the variables into a struct first makes
      later patches easier to review.
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: NPaolo Bonzini <pbonzini@redhat.com>
      b811203c
    • S
      main-loop: add qemu_get_aio_context() · 5f3aa1ff
      Stefan Hajnoczi 提交于
      It is very useful to get the main loop AioContext, which is a static
      variable in main-loop.c.
      
      I'm not sure whether qemu_get_aio_context() will be necessary in the
      future once devices focus on using their own AioContext instead of the
      main loop AioContext, but for now it allows us to refactor code to
      support multiple AioContext while actually passing the main loop
      AioContext.
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: NPaolo Bonzini <pbonzini@redhat.com>
      5f3aa1ff
    • M
      sheepdog: set io_flush handler in do_co_req · ed9ba724
      MORITA Kazutaka 提交于
      If an io_flush handler is not set, qemu_aio_wait doesn't invoke
      callbacks.
      Signed-off-by: NMORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      ed9ba724
    • M
      sheepdog: use non-blocking fd in coroutine context · 0d6db300
      MORITA Kazutaka 提交于
      Using a blocking socket in the coroutine context reduces the chance of
      switching to other work.  This patch makes the sheepdog driver use a
      non-blocking fd always.
      Signed-off-by: NMORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      0d6db300
    • P
      qcow2: make is_allocated return true for zero clusters · 381b487d
      Paolo Bonzini 提交于
      Otherwise, live migration of the top layer will miss zero clusters and
      let the backing file show through.  This also matches what is done in qed.
      
      QCOW2_CLUSTER_ZERO clusters are invalid in v2 image files.  Check this
      directly in qcow2_get_cluster_offset instead of replicating the test
      everywhere.
      
      Cc: qemu-stable@nongnu.org
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      381b487d
    • S
      qcow2: drop unnecessary flush in qcow2_update_snapshot_refcount() · 36479179
      Stefan Hajnoczi 提交于
      We already flush when the function completes.  There is no need to flush
      after every compressed cluster.
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      36479179
    • S
      qcow2: drop flush in update_cluster_refcount() · f9cb2860
      Stefan Hajnoczi 提交于
      The update_cluster_refcount() function increments/decrements a cluster's
      refcount and then returns the new refcount value.
      
      There is no need to flush since both update_cluster_refcount() callers
      already take care of this:
      
      1. qcow2_alloc_bytes() calls update_cluster_refcount() when compressed
         sectors will be appended to an existing cluster with enough free
         space.  qcow2_alloc_bytes() already flushes so there is no need to do
         so in update_cluster_refcount().
      
      2. qcow2_update_snapshot_refcount() sets a cache dependency on refcounts
         if it needs to update L2 entries.  It also flushes before completing.
      
      Removing this flush significantly speeds up qcow2 snapshot creation:
      
        $ qemu-img create -f qcow2 test.qcow2 -o size=50G,preallocation=metadata
        $ time qemu-img snapshot -c new test.qcow2
      
      Time drops from more than 3 minutes to under 1 second.
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      f9cb2860
    • S
      qcow2: flush in qcow2_update_snapshot_refcount() · 2154f24e
      Stefan Hajnoczi 提交于
      Users of qcow2_update_snapshot_refcount() do not flush consistently.
      qcow2_snapshot_create() flushes but qcow2_snapshot_goto() and
      qcow2_snapshot_delete() do not.
      
      Solve this by moving the bdrv_flush() into
      qcow2_update_snapshot_refcount().
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      2154f24e
    • S
      qcow2: set L2 cache dependency in qcow2_alloc_bytes() · c1f5bafd
      Stefan Hajnoczi 提交于
      Compressed writes use qcow2_alloc_bytes() to allocate space with byte
      granularity.  The affected clusters' refcounts will be incremented but
      we do not need to flush yet.
      
      Set a L2 cache dependency on the refcount block cache, so that the
      refcounts get written out before the L2 updates.
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      c1f5bafd
    • S
      qcow2: flush refcount cache correctly in qcow2_write_snapshots() · f6977f15
      Stefan Hajnoczi 提交于
      Since qcow2 metadata is cached we need to flush the caches, not just the
      underlying file.  Use bdrv_flush(bs) instead of bdrv_flush(bs->file).
      
      Also add the error return path when bdrv_flush() fails and move the
      flush after checking for qcow2_alloc_clusters() failure so that the
      qcow2_alloc_clusters() error return value takes precedence.
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      f6977f15