1. 13 9月, 2016 22 次提交
  2. 12 9月, 2016 7 次提交
  3. 10 9月, 2016 11 次提交
    • S
      vhost-vsock: add virtio sockets device · fc0b9b0e
      Stefan Hajnoczi 提交于
      Implement the new virtio sockets device for host<->guest communication
      using the Sockets API.  Most of the work is done in a vhost kernel
      driver so that virtio-vsock can hook into the AF_VSOCK address family.
      The QEMU vhost-vsock device handles configuration and live migration
      while the rx/tx happens in the vhost_vsock.ko Linux kernel driver.
      
      The vsock device must be given a CID (host-wide unique address):
      
        # qemu -device vhost-vsock-pci,id=vhost-vsock-pci0,guest-cid=3 ...
      
      For more information see:
      http://qemu-project.org/Features/VirtioVsock
      
      [Endianness fixes and virtio-ccw support by Claudio Imbrenda
      <imbrenda@linux.vnet.ibm.com>]
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      [mst: rebase to master]
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      fc0b9b0e
    • M
      tests/acpi: speedup acpi tests · 947b205f
      Marcel Apfelbaum 提交于
      Use kvm acceleration if available.
      Disable kernel-irqchip and use qemu64 cpu
      for both kvm and tcg cases.
      
      Using kvm acceleration saves about a second
      and disabling kernel-irqchip has no visible
      performance impact.
      Acked-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMarcel Apfelbaum <marcel@redhat.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      947b205f
    • M
      virtio-pci: minor refactoring · 71d19fc5
      Michael S. Tsirkin 提交于
      !legacy && !modern is shorter than !(legacy || modern).
      I also perfer this (less ()s) as a matter of taste.
      
      Cc: Greg Kurz <gkurz@linux.vnet.ibm.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      71d19fc5
    • J
      vhost: don't set vring call if no vector · 96a3d98d
      Jason Wang 提交于
      We used to set vring call fd unconditionally even if guest driver does
      not use MSIX for this vritqueue at all. This will cause lots of
      unnecessary userspace access and other checks for drivers does not use
      interrupt at all (e.g virtio-net pmd). So check and clean vring call
      fd if guest does not use any vector for this virtqueue at
      all.
      
      Perf diffs (on rx) shows lots of cpus wasted on vhost_signal() were saved:
      
      #
          28.12%  -27.82%  [vhost]           [k] vhost_signal
          14.44%   -1.69%  [kernel.vmlinux]  [k] copy_user_generic_string
           7.05%   +1.53%  [kernel.vmlinux]  [k] __free_page_frag
           6.51%   +5.53%  [vhost]           [k] vhost_get_vq_desc
      ...
      
      Pktgen tests shows 15.8% improvement on rx pps and 6.5% on tx pps.
      
      Before: RX 2.08Mpps TX 1.35Mpps
      After:  RX 2.41Mpps TX 1.44Mpps
      Signed-off-by: NJason Wang <jasowang@redhat.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      96a3d98d
    • G
      virtio-pci: error out when both legacy and modern modes are disabled · 3eff3769
      Greg Kurz 提交于
      Without presuming if we got there because of a user mistake or some
      more subtle bug in the tooling, it really does not make sense to
      implement a non-functional device.
      Signed-off-by: NGreg Kurz <gkurz@linux.vnet.ibm.com>
      Reviewed-by: NMarcel Apfelbaum <marcel@redhat.com>
      Reviewed-by: NCornelia Huck <cornelia.huck@de.ibm.com>
      Signed-off-by: NGreg Kurz <groug@kaod.org>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      3eff3769
    • L
      virtio-balloon: fix stats vq migration · 4a1e48be
      Ladi Prosek 提交于
      The statistics virtqueue is not migrated properly because virtio-balloon
      does not include s->stats_vq_elem in the migration stream.
      
      After migration the statistics virtqueue hangs because the host never
      completes the last element (s->stats_vq_elem is NULL on the destination
      QEMU).  Therefore the guest never submits new elements and the virtqueue
      is hung.
      
      Instead of changing the migration stream format in an incompatible way,
      detect the migration case and rewind the virtqueue so the last element
      can be completed.
      
      Cc: Michael S. Tsirkin <mst@redhat.com>
      Cc: Roman Kagan <rkagan@virtuozzo.com>
      Cc: Stefan Hajnoczi <stefanha@redhat.com>
      Suggested-by: NRoman Kagan <rkagan@virtuozzo.com>
      Signed-off-by: NLadi Prosek <lprosek@redhat.com>
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      4a1e48be
    • S
      virtio: add virtqueue_rewind() · 297a75e6
      Stefan Hajnoczi 提交于
      virtqueue_discard() requires a VirtQueueElement but virtio-balloon does
      not migrate its in-use element.  Introduce a new function that is
      similar to virtqueue_discard() but doesn't require a VirtQueueElement.
      
      This will allow virtio-balloon to access element again after migration
      with the usual proviso that the guest may have modified the vring since
      last time.
      
      Cc: Michael S. Tsirkin <mst@redhat.com>
      Cc: Roman Kagan <rkagan@virtuozzo.com>
      Cc: Stefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: NLadi Prosek <lprosek@redhat.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      297a75e6
    • L
      virtio-balloon: discard virtqueue element on reset · 104e70ca
      Ladi Prosek 提交于
      The one pending element is being freed but not discarded on device
      reset, which causes svq->inuse to creep up, eventually hitting the
      "Virtqueue size exceeded" error.
      
      Properly discarding the element on device reset makes sure that its
      buffers are unmapped and the inuse counter stays balanced.
      
      Cc: Michael S. Tsirkin <mst@redhat.com>
      Cc: Roman Kagan <rkagan@virtuozzo.com>
      Cc: Stefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: NLadi Prosek <lprosek@redhat.com>
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      104e70ca
    • S
      virtio: zero vq->inuse in virtio_reset() · 4b7f91ed
      Stefan Hajnoczi 提交于
      vq->inuse must be zeroed upon device reset like most other virtqueue
      fields.
      
      In theory, virtio_reset() just needs assert(vq->inuse == 0) since
      devices must clean up in-flight requests during reset (requests cannot
      not be leaked!).
      
      In practice, it is difficult to achieve vq->inuse == 0 across reset
      because balloon, blk, 9p, etc implement various different strategies for
      cleaning up requests.  Most devices call g_free(elem) directly without
      telling virtio.c that the VirtQueueElement is cleaned up.  Therefore
      vq->inuse is not decremented during reset.
      
      This patch zeroes vq->inuse and trusts that devices are not leaking
      VirtQueueElements across reset.
      
      I will send a follow-up series that refactors request life-cycle across
      all devices and converts vq->inuse = 0 into assert(vq->inuse == 0) but
      this more invasive approach is not appropriate for stable trees.
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      Cc: qemu-stable <qemu-stable@nongnu.org>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      Reviewed-by: NLadi Prosek <lprosek@redhat.com>
      4b7f91ed
    • M
      virtio-pci: reduce modern_mem_bar size · d9997d89
      Marcel Apfelbaum 提交于
      Currently each VQ Notification Virtio Capability is allocated
      on a different page. The idea is to enable split drivers within
      guests, however there are no known plans to do that.
      The allocation will result in a 8MB BAR, more than various
      guest firmwares pre-allocates for PCI Bridges hotplug process.
      
      Reserve 4 bytes per VQ by default and add a new parameter
      "page-per-vq" to be used with split drivers.
      Signed-off-by: NMarcel Apfelbaum <marcel@redhat.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      d9997d89
    • L
      target-i386: present virtual L3 cache info for vcpus · 14c985cf
      Longpeng(Mike) 提交于
      Some software algorithms are based on the hardware's cache info, for example,
      for x86 linux kernel, when cpu1 want to wakeup a task on cpu2, cpu1 will trigger
      a resched IPI and told cpu2 to do the wakeup if they don't share low level
      cache. Oppositely, cpu1 will access cpu2's runqueue directly if they share llc.
      The relevant linux-kernel code as bellow:
      
      	static void ttwu_queue(struct task_struct *p, int cpu)
      	{
      		struct rq *rq = cpu_rq(cpu);
      		......
      		if (... && !cpus_share_cache(smp_processor_id(), cpu)) {
      			......
      			ttwu_queue_remote(p, cpu); /* will trigger RES IPI */
      			return;
      		}
      		......
      		ttwu_do_activate(rq, p, 0); /* access target's rq directly */
      		......
      	}
      
      In real hardware, the cpus on the same socket share L3 cache, so one won't
      trigger a resched IPIs when wakeup a task on others. But QEMU doesn't present a
      virtual L3 cache info for VM, then the linux guest will trigger lots of RES IPIs
      under some workloads even if the virtual cpus belongs to the same virtual socket.
      
      For KVM, there will be lots of vmexit due to guest send IPIs.
      The workload is a SAP HANA's testsuite, we run it one round(about 40 minuates)
      and observe the (Suse11sp3)Guest's amounts of RES IPIs which triggering during
      the period:
              No-L3           With-L3(applied this patch)
      cpu0:	363890		44582
      cpu1:	373405		43109
      cpu2:	340783		43797
      cpu3:	333854		43409
      cpu4:	327170		40038
      cpu5:	325491		39922
      cpu6:	319129		42391
      cpu7:	306480		41035
      cpu8:	161139		32188
      cpu9:	164649		31024
      cpu10:	149823		30398
      cpu11:	149823		32455
      cpu12:	164830		35143
      cpu13:	172269		35805
      cpu14:	179979		33898
      cpu15:	194505		32754
      avg:	268963.6	40129.8
      
      The VM's topology is "1*socket 8*cores 2*threads".
      After present virtual L3 cache info for VM, the amounts of RES IPIs in guest
      reduce 85%.
      
      For KVM, vcpus send IPIs will cause vmexit which is expensive, so it can cause
      severe performance degradation. We had tested the overall system performance if
      vcpus actually run on sparate physical socket. With L3 cache, the performance
      improves 7.2%~33.1%(avg:15.7%).
      Signed-off-by: NLongpeng(Mike) <longpeng2@huawei.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      14c985cf