1. 12 6月, 2011 2 次提交
    • J
      virtio: correctly initialize vm_running · d3674c57
      Jason Wang 提交于
      Current vm_running was not explicitly initialized and its value was changed by
      vm state notifier, this may confuse the virtio device being hotplugged such as
      virtio-net with vhost backend as it may think the vm was not running. Solve this
      by initialize this value explicitly in virtio_common_init().
      Signed-off-by: NJason Wang <jasowang@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      d3674c57
    • S
      virtio: guard against negative vq notifies · 7157e2e2
      Stefan Hajnoczi 提交于
      The virtio_queue_notify() function checks that the virtqueue number is
      less than the maximum number of virtqueues.  A signed comparison is used
      but the virtqueue number could be negative if a buggy or malicious guest
      is run.  This results in memory accesses outside of the virtqueue array.
      
      It is risky doing input validation in common code instead of at the
      guest<->host boundary.  Note that virtio_queue_set_addr(),
      virtio_queue_get_addr(), virtio_queue_get_num(), and many other virtio
      functions do *not* validate the virtqueue number argument.
      
      Instead of fixing the comparison in virtio_queue_notify(), move the
      comparison to the virtio bindings (just like VIRTIO_PCI_QUEUE_SEL) where
      we have a uint32_t value and can avoid ever calling into common virtio
      code if the virtqueue number is invalid.
      Signed-off-by: NStefan Hajnoczi <stefanha@linux.vnet.ibm.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      7157e2e2
  2. 16 4月, 2011 1 次提交
  3. 10 1月, 2011 2 次提交
    • S
      virtio-pci: Use ioeventfd for virtqueue notify · 25db9ebe
      Stefan Hajnoczi 提交于
      Virtqueue notify is currently handled synchronously in userspace virtio.  This
      prevents the vcpu from executing guest code while hardware emulation code
      handles the notify.
      
      On systems that support KVM, the ioeventfd mechanism can be used to make
      virtqueue notify a lightweight exit by deferring hardware emulation to the
      iothread and allowing the VM to continue execution.  This model is similar to
      how vhost receives virtqueue notifies.
      
      The result of this change is improved performance for userspace virtio devices.
      Virtio-blk throughput increases especially for multithreaded scenarios and
      virtio-net transmit throughput increases substantially.
      
      Some virtio devices are known to have guest drivers which expect a notify to be
      processed synchronously and spin waiting for completion.
      For virtio-net, this also seems to interact with the guest stack in strange
      ways so that TCP throughput for small message sizes (~200bytes)
      is harmed. Only enable ioeventfd for virtio-blk for now.
      
      Care must be taken not to interfere with vhost-net, which uses host
      notifiers.  If the set_host_notifier() API is used by a device
      virtio-pci will disable virtio-ioeventfd and let the device deal with
      host notifiers as it wishes.
      
      Finally, there used to be a limit of 6 KVM io bus devices inside the
      kernel.  On such a kernel, don't use ioeventfd for virtqueue host
      notification since the limit is reached too easily.  This ensures that
      existing vhost-net setups (which always use ioeventfd) have ioeventfds
      available so they can continue to work.
      
      After migration and on VM change state (running/paused) virtio-ioeventfd
      will enable/disable itself.
      
       * VIRTIO_CONFIG_S_DRIVER_OK -> enable virtio-ioeventfd
       * !VIRTIO_CONFIG_S_DRIVER_OK -> disable virtio-ioeventfd
       * virtio_pci_set_host_notifier() -> disable virtio-ioeventfd
       * vm_change_state(running=0) -> disable virtio-ioeventfd
       * vm_change_state(running=1) -> enable virtio-ioeventfd
      Signed-off-by: NStefan Hajnoczi <stefanha@linux.vnet.ibm.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      25db9ebe
    • M
      virtio: move vmstate change tracking to core · 85cf2a8d
      Michael S. Tsirkin 提交于
      Move tracking vmstate change from virtio-net to virtio.c
      as it is going to be used by virito-blk and virtio-pci
      for the ioeventfd support.
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      85cf2a8d
  4. 24 11月, 2010 2 次提交
  5. 21 11月, 2010 1 次提交
  6. 28 10月, 2010 1 次提交
  7. 07 10月, 2010 1 次提交
    • M
      virtio: invoke set_status callback on reset · e0c472d8
      Michael S. Tsirkin 提交于
      As status is set to 0 on reset, invoke the relevant callback. This makes
      for a cleaner code in devices as they don't need to duplicate the code
      in their reset routine, as well as excercises this path a little more.
      
      In particular this makes it possible to unify
      vhost-net handling code with the following patch.
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      e0c472d8
  8. 10 9月, 2010 1 次提交
  9. 31 8月, 2010 1 次提交
  10. 12 5月, 2010 1 次提交
  11. 02 4月, 2010 2 次提交
  12. 20 1月, 2010 1 次提交
  13. 12 1月, 2010 2 次提交
  14. 12 12月, 2009 1 次提交
  15. 30 10月, 2009 1 次提交
  16. 02 10月, 2009 2 次提交
  17. 11 9月, 2009 1 次提交
  18. 10 7月, 2009 1 次提交
  19. 24 6月, 2009 2 次提交
  20. 22 6月, 2009 2 次提交
  21. 22 5月, 2009 1 次提交
    • J
      Introduce reset notifier order · 8217606e
      Jan Kiszka 提交于
      Add the parameter 'order' to qemu_register_reset and sort callbacks on
      registration. On system reset, callbacks with lower order will be
      invoked before those with higher order. Update all existing users to the
      standard order 0.
      
      Note: At least for x86, the existing users seem to assume that handlers
      are called in their registration order. Therefore, the patch preserves
      this property. If someone feels bored, (s)he could try to identify this
      dependency and express it properly on callback registration.
      Signed-off-by: NJan Kiszka <jan.kiszka@siemens.com>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      8217606e
  22. 19 5月, 2009 1 次提交
  23. 15 5月, 2009 1 次提交
  24. 04 5月, 2009 1 次提交
  25. 18 4月, 2009 1 次提交
  26. 06 4月, 2009 1 次提交
  27. 29 3月, 2009 1 次提交
  28. 21 3月, 2009 1 次提交
  29. 06 2月, 2009 1 次提交
  30. 02 2月, 2009 1 次提交
  31. 30 1月, 2009 1 次提交
  32. 26 1月, 2009 1 次提交