1. 10 11月, 2015 1 次提交
    • D
      Inhibit ballooning during postcopy · 371ff5a3
      Dr. David Alan Gilbert 提交于
      Postcopy detects accesses to pages that haven't been transferred yet
      using userfaultfd, and it causes exceptions on pages that are 'not
      present'.
      Ballooning also causes pages to be marked as 'not present' when the
      guest inflates the balloon.
      Potentially a balloon could be inflated to discard pages that are
      currently inflight during postcopy and that may be arriving at about
      the same time.
      
      To avoid this confusion, disable ballooning during postcopy.
      
      When disabled we drop balloon requests from the guest.  Since ballooning
      is generally initiated by the host, the management system should avoid
      initiating any balloon instructions to the guest during migration,
      although it's not possible to know how long it would take a guest to
      process a request made prior to the start of migration.
      Guest initiated ballooning will not know if it's really freed a page
      of host memory or not.
      
      Queueing the requests until after migration would be nice, but is
      non-trivial, since the set of inflate/deflate requests have to
      be compared with the state of the page to know what the final
      outcome is allowed to be.
      Signed-off-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
      Reviewed-by: NJuan Quintela <quintela@redhat.com>
      Reviewed-by: NAmit Shah <amit.shah@redhat.com>
      Signed-off-by: NJuan Quintela <quintela@redhat.com>
      371ff5a3
  2. 23 6月, 2015 1 次提交
  3. 23 6月, 2014 1 次提交
  4. 19 12月, 2012 2 次提交
  5. 16 6月, 2012 1 次提交
    • D
      Add event notification for guest balloon changes · 973603a8
      Daniel P. Berrange 提交于
      After setting a balloon target value, applications have to
      continually poll 'query-balloon' to determine whether the
      guest has reacted to this request. The virtio-balloon backend
      knows exactly when the guest has reacted though, and thus it
      is possible to emit a JSON event to tell the mgmt application
      whenever the guest balloon changes.
      
      This introduces a new 'qemu_balloon_changed()' API which is
      to be called by balloon driver backends, whenever they have
      a change in balloon value. This takes the 'actual' balloon
      value, as would be found in the BalloonInfo struct.
      
      The qemu_balloon_change API emits a JSON monitor event which
      looks like:
      
        {"timestamp": {"seconds": 1337162462, "microseconds": 814521},
         "event": "BALLOON_CHANGE", "data": {"actual": 944766976}}
      
      * balloon.c, balloon.h: Introduce qemu_balloon_changed() for
        emitting balloon change events on the monitor
      * hw/virtio-balloon.c: Invoke qemu_balloon_changed() whenever
        the guest changes the balloon actual value
      * monitor.c, monitor.h: Define QEVENT_BALLOON_CHANGE
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      Acked-by: NAmit Shah <amit.shah@redhat.com>
      Signed-off-by: NLuiz Capitulino <lcapitulino@redhat.com>
      973603a8
  6. 06 12月, 2011 1 次提交
  7. 27 10月, 2011 1 次提交
  8. 10 9月, 2011 1 次提交
  9. 05 8月, 2011 3 次提交
    • A
      balloon: Don't allow multiple balloon handler registrations · 6c6ec182
      Amit Shah 提交于
      Multiple balloon devices don't make sense; disallow more than one
      registration attempt to register handlers.
      Signed-off-by: NAmit Shah <amit.shah@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Acked-by: NMichael S. Tsirkin <mst@redhat.com>
      6c6ec182
    • A
      balloon: Separate out stat and balloon handling · 30fb2ca6
      Amit Shah 提交于
      Passing on '0' as ballooning target to indicate retrieval of stats is
      bad API.  It also makes 'balloon 0' in the monitor cause a segfault.
      Have two different functions handle the different functionality instead.
      
      Detailed explanation from Markus's review:
      
      1. do_info_balloon() is an info_async() method.  It receives a callback
         with argument, to be called exactly once (callback frees the
         argument).  It passes the callback via qemu_balloon_status() and
         indirectly through qemu_balloon_event to virtio_balloon_to_target().
      
         virtio_balloon_to_target() executes its balloon stats half.  It
         stores the callback in the device state.
      
         If it can't send a stats request, it resets stats and calls the
         callback right away.
      
         Else, it sends a stats request.  The device model runs the callback
         when it receives the answer.
      
         Works.
      
      2. do_balloon() is a cmd_async() method.  It receives a callback with
         argument, to be called when the command completes.  do_balloon()
         calls it right before it succeeds.  Odd, but should work.
      
         Nevertheless, it passes the callback on via qemu_ballon() and
         indirectly through qemu_balloon_event to virtio_balloon_to_target().
      
         a. If the argument is non-zero, virtio_balloon_to_target() executes
            its balloon half, which doesn't use the callback in any way.
      
            Odd, but works.
      
         b. If the argument is zero, virtio_balloon_to_target() executes its
            balloon stats half, just like in 1.  It either calls the callback
            right away, or arranges for it to be called later.
      
            Thus, the callback runs twice: use after free and double free.
      
      Test case: start with -S -device virtio-balloon, execute "balloon 0" in
      human monitor.  Runs the callback first from virtio_balloon_to_target(),
      then again from do_balloon().
      Reported-by: NMike Cao <bcao@redhat.com>
      Signed-off-by: NAmit Shah <amit.shah@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      30fb2ca6
    • A
      balloon: Make functions, local vars static · 0a2a30d5
      Amit Shah 提交于
      balloon.h had function declarations for a couple of functions that are
      local to balloon.c.  Make them static.
      
      Drop the 'qemu_' prefix for balloon.c-local variables, and make them
      static.
      Signed-off-by: NAmit Shah <amit.shah@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      0a2a30d5
  10. 10 4月, 2010 1 次提交
  11. 30 3月, 2010 1 次提交
  12. 27 1月, 2010 1 次提交
    • A
      virtio: Add memory statistics reporting to the balloon driver · 625a5bef
      Adam Litke 提交于
      When using ballooning to manage overcommitted memory on a host, a system for
      guests to communicate their memory usage to the host can provide information
      that will minimize the impact of ballooning on the guests.  The current method
      employs a daemon running in each guest that communicates memory statistics to a
      host daemon at a specified time interval.  The host daemon aggregates this
      information and inflates and/or deflates balloons according to the level of
      host memory pressure.  This approach is effective but overly complex since a
      daemon must be installed inside each guest and coordinated to communicate with
      the host.  A simpler approach is to collect memory statistics in the virtio
      balloon driver and communicate them directly to the hypervisor.
      Signed-off-by: NAdam Litke <agl@us.ibm.com>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      625a5bef
  13. 02 10月, 2009 2 次提交
  14. 05 12月, 2008 1 次提交