1. 01 7月, 2015 8 次提交
    • J
      kvm: Switch to unlocked PIO · 80b7d2ef
      Jan Kiszka 提交于
      Do not take the BQL before dispatching PIO requests of KVM VCPUs.
      Instead, address_space_rw will do it if necessary. This enables
      completely BQL-free PIO handling in KVM mode for upcoming devices with
      fine-grained locking.
      Signed-off-by: NJan Kiszka <jan.kiszka@siemens.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Message-Id: <1434646046-27150-8-git-send-email-pbonzini@redhat.com>
      80b7d2ef
    • J
      kvm: First step to push iothread lock out of inner run loop · 4b8523ee
      Jan Kiszka 提交于
      This opens the path to get rid of the iothread lock on vmexits in KVM
      mode. On x86, the in-kernel irqchips has to be used because we otherwise
      need to synchronize APIC and other per-cpu state accesses that could be
      changed concurrently.
      
      Regarding pre/post-run callbacks, s390x and ARM should be fine without
      specific locking as the callbacks are empty. MIPS and POWER require
      locking for the pre-run callback.
      
      For the handle_exit callback, it is non-empty in x86, POWER and s390.
      Some POWER cases could do without the locking, but it is left in
      place for now.
      Signed-off-by: NJan Kiszka <jan.kiszka@siemens.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Message-Id: <1434646046-27150-7-git-send-email-pbonzini@redhat.com>
      4b8523ee
    • J
      memory: let address_space_rw/ld*/st* run outside the BQL · 4840f10e
      Jan Kiszka 提交于
      The MMIO case is further broken up in two cases: if the caller does not
      hold the BQL on invocation, the unlocked one takes or avoids BQL depending
      on the locking strategy of the target memory region and its coalesced
      MMIO handling.  In this case, the caller should not hold _any_ lock
      (a friendly suggestion which is disregarded by virtio-scsi-dataplane).
      Signed-off-by: NJan Kiszka <jan.kiszka@siemens.com>
      Cc: Frederic Konrad <fred.konrad@greensocs.com>
      Message-Id: <1434646046-27150-6-git-send-email-pbonzini@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      4840f10e
    • P
      exec: pull qemu_flush_coalesced_mmio_buffer() into address_space_rw/ld*/st* · 125b3806
      Paolo Bonzini 提交于
      As memory_region_read/write_accessor will now be run also without BQL held,
      we need to move coalesced MMIO flushing earlier in the dispatch process.
      
      Cc: Frederic Konrad <fred.konrad@greensocs.com>
      Message-Id: <1434646046-27150-5-git-send-email-pbonzini@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      125b3806
    • J
      memory: Add global-locking property to memory regions · 196ea131
      Jan Kiszka 提交于
      This introduces the memory region property "global_locking". It is true
      by default. By setting it to false, a device model can request BQL-free
      dispatching of region accesses to its r/w handlers. The actual BQL
      break-up will be provided in a separate patch.
      Signed-off-by: NJan Kiszka <jan.kiszka@siemens.com>
      Cc: Frederic Konrad <fred.konrad@greensocs.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Message-Id: <1434646046-27150-4-git-send-email-pbonzini@redhat.com>
      196ea131
    • P
      main-loop: introduce qemu_mutex_iothread_locked · afbe7053
      Paolo Bonzini 提交于
      This function will be used to avoid recursive locking of the iothread lock
      whenever address_space_rw/ld*/st* are called with the BQL held, which is
      almost always the case.
      
      Tracking whether the iothread is owned is very cheap (just use a TLS
      variable) but requires some care because now the lock must always be
      taken with qemu_mutex_lock_iothread().  Previously this wasn't the case.
      Outside TCG mode this is not a problem.  In TCG mode, we need to be
      careful and avoid the "prod out of compiled code" step if already
      in a VCPU thread.  This is easily done with a check on current_cpu,
      i.e. qemu_in_vcpu_thread().
      
      Hopefully, multithreaded TCG will get rid of the whole logic to kick
      VCPUs whenever an I/O event occurs!
      
      Cc: Frederic Konrad <fred.konrad@greensocs.com>
      Message-Id: <1434646046-27150-3-git-send-email-pbonzini@redhat.com>
      Reviewed-by: NFam Zheng <famz@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      afbe7053
    • P
      main-loop: use qemu_mutex_lock_iothread consistently · 2e7f7a3c
      Paolo Bonzini 提交于
      The next patch will require the BQL to be always taken with
      qemu_mutex_lock_iothread(), while right now this isn't the case.
      
      Outside TCG mode this is not a problem.  In TCG mode, we need to be
      careful and avoid the "prod out of compiled code" step if already
      in a VCPU thread.  This is easily done with a check on current_cpu,
      i.e. qemu_in_vcpu_thread().
      
      Hopefully, multithreaded TCG will get rid of the whole logic to kick
      VCPUs whenever an I/O event occurs!
      
      Cc: Frederic Konrad <fred.konrad@greensocs.com>
      Message-Id: <1434646046-27150-2-git-send-email-pbonzini@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      2e7f7a3c
    • Fix irq route entries exceeding KVM_MAX_IRQ_ROUTES · bdf02631
      马文霜 提交于
      Last month, we experienced several guests crash(6cores-8cores), qemu logs
      display the following messages:
      
      qemu-system-x86_64: /build/qemu-2.1.2/kvm-all.c:976:
      kvm_irqchip_commit_routes: Assertion `ret == 0' failed.
      
      After analysis and verification, we can confirm it's irq-balance
      daemon(in guest) leads to the assertion failure. Start a 8 core guest with
      two disks, execute the following scripts will reproduce the BUG quickly:
      
      irq_affinity.sh
      ========================================================================
      
      vda_irq_num=25
      vdb_irq_num=27
      while [ 1 ]
      do
          for irq in {1,2,4,8,10,20,40,80}
              do
                  echo $irq > /proc/irq/$vda_irq_num/smp_affinity
                  echo $irq > /proc/irq/$vdb_irq_num/smp_affinity
                  dd if=/dev/vda of=/dev/zero bs=4K count=100 iflag=direct
                  dd if=/dev/vdb of=/dev/zero bs=4K count=100 iflag=direct
              done
      done
      ========================================================================
      
      QEMU setup static irq route entries in kvm_pc_setup_irq_routing(), PIC and
      IOAPIC share the first 15 GSI numbers, take up 23 GSI numbers, but take up
      38 irq route entries. When change irq smp_affinity in guest, a dynamic route
      entry may be setup, the current logic is: if allocate GSI number succeeds,
      a new route entry can be added. The available dynamic GSI numbers is
      1021(KVM_MAX_IRQ_ROUTES-23), but available irq route entries is only
      986(KVM_MAX_IRQ_ROUTES-38), GSI numbers greater than route entries.
      irq-balance's behavior will eventually leads to total irq route entries
      exceed KVM_MAX_IRQ_ROUTES, ioctl(KVM_SET_GSI_ROUTING) fail and
      kvm_irqchip_commit_routes() trigger assertion failure.
      
      This patch fix the BUG.
      Signed-off-by: NWenshuang Ma <kevinnma@tencent.com>
      Cc: qemu-stable@nongnu.org
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      bdf02631
  2. 26 6月, 2015 7 次提交
  3. 25 6月, 2015 2 次提交
    • P
      Merge remote-tracking branch 'remotes/stefanha/tags/net-pull-request' into staging · 0a4a0312
      Peter Maydell 提交于
      # gpg: Signature made Wed Jun 24 16:37:23 2015 BST using RSA key ID 81AB73C8
      # gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>"
      # gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>"
      
      * remotes/stefanha/tags/net-pull-request:
        net: simplify net_client_init1()
        net: drop if expression that is always true
        net: raise an error if -net type is invalid
        net: replace net_client_init1() netdev whitelist with blacklist
        net: add missing "netmap" to host_net_devices[]
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      0a4a0312
    • P
      Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging · 58e8b335
      Peter Maydell 提交于
      # gpg: Signature made Wed Jun 24 16:27:53 2015 BST using RSA key ID 81AB73C8
      # gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>"
      # gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>"
      
      * remotes/stefanha/tags/block-pull-request:
        virito-blk: drop duplicate check
        qemu-iotests: fix 051.out after qdev error message change
        iov: don't touch iov in iov_send_recv()
        raw-posix: Introduce hdev_is_sg()
        raw-posix: Use DPRINTF for DEBUG_FLOPPY
        raw-posix: DPRINTF instead of DEBUG_BLOCK_PRINT
        Fix migration in case of scsi-generic
        block: Use bdrv_is_sg() everywhere
        nvme: Fix memleak in nvme_dma_read_prp
        vvfat: add a label option
        util/hbitmap: Add an API to reset all set bits in hbitmap
        virtio-blk: Use blk_drain() to drain IO requests
        block-backend: Introduce blk_drain()
        throttle: Check current timers before updating any_timer_armed[]
        block: Let bdrv_drain_all() to call aio_poll() for each AioContext
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      58e8b335
  4. 24 6月, 2015 23 次提交