Skip to content
Snippets Groups Projects
  1. Feb 07, 2018
    • Ladi Prosek's avatar
      ivshmem: Improve MSI irqfd error handling · 0b88dd94
      Ladi Prosek authored
      Adds a rollback path to ivshmem_enable_irqfd() and fixes
      ivshmem_disable_irqfd() to bail if irqfd has not been enabled.
      
      To reproduce, run:
      
        ivshmem-server -n 0
      
      and QEMU with:
      
        -device ivshmem-doorbell,chardev=iv
        -chardev socket,path=/tmp/ivshmem_socket,id=iv
      
      then load, unload, and load again the Windows driver, at the time of writing
      available at:
      
      https://github.com/virtio-win/kvm-guest-drivers-windows/tree/master/ivshmem
      
      
      
      The issue is believed to have been masked by other guest drivers, notably
      Linux ones, not enabling MSI-X on the device.
      
      Signed-off-by: default avatarLadi Prosek <lprosek@redhat.com>
      Reviewed-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Message-Id: <20171211072110.9058-4-lprosek@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      0b88dd94
    • Ladi Prosek's avatar
      ivshmem: Always remove irqfd notifiers · 089fd803
      Ladi Prosek authored
      
      As of commit 660c97ee ("ivshmem: use kvm irqfd for msi notifications"),
      QEMU crashes with:
      
      ivshmem: msix_set_vector_notifiers failed
      msix_unset_vector_notifiers: Assertion `dev->msix_vector_use_notifier && dev->msix_vector_release_notifier' failed.
      
      if MSI-X is repeatedly enabled and disabled on the ivshmem device, for example
      by loading and unloading the Windows ivshmem driver. This is because
      msix_unset_vector_notifiers() doesn't call any of the release notifier callbacks
      since MSI-X is already disabled at that point (msix_enabled() returning false
      is how this transition is detected in the first place). Thus ivshmem_vector_mask()
      doesn't run and when MSI-X is subsequently enabled again ivshmem_vector_unmask()
      fails.
      
      This is fixed by keeping track of unmasked vectors and making sure that
      ivshmem_vector_mask() always runs on MSI-X disable.
      
      Fixes: 660c97ee ("ivshmem: use kvm irqfd for msi notifications")
      Signed-off-by: default avatarLadi Prosek <lprosek@redhat.com>
      Reviewed-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Message-Id: <20171211072110.9058-3-lprosek@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      089fd803
    • Ladi Prosek's avatar
      ivshmem: Don't update non-existent MSI routes · e6a354be
      Ladi Prosek authored
      As of commit 660c97ee ("ivshmem: use kvm irqfd for msi notifications"),
      QEMU crashes with:
      
        kvm_irqchip_commit_routes: Assertion `ret == 0' failed.
      
      if the ivshmem device is configured with more vectors than what the server
      supports. This is caused by the ivshmem_vector_unmask() being called on
      vectors that have not been initialized by ivshmem_add_kvm_msi_virq().
      
      This commit fixes it by adding a simple check to the mask and unmask
      callbacks.
      
      Note that the opposite mismatch, if the server supplies more vectors than
      what the device is configured for, is already handled and leads to output
      like:
      
        Too many eventfd received, device has 1 vectors
      
      To reproduce the assert, run:
      
        ivshmem-server -n 0
      
      and QEMU with:
      
        -device ivshmem-doorbell,chardev=iv
        -chardev socket,path=/tmp/ivshmem_socket,id=iv
      
      then load the Windows driver, at the time of writing available at:
      
      https://github.com/virtio-win/kvm-guest-drivers-windows/tree/master/ivshmem
      
      
      
      The issue is believed to have been masked by other guest drivers, notably
      Linux ones, not enabling MSI-X on the device.
      
      Fixes: 660c97ee ("ivshmem: use kvm irqfd for msi notifications")
      Signed-off-by: default avatarLadi Prosek <lprosek@redhat.com>
      Reviewed-by: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>
      Reviewed-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Message-Id: <20171211072110.9058-2-lprosek@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      e6a354be
    • Klim Kireev's avatar
      chardev/char-socket: add POLLHUP handler · a8aa6197
      Klim Kireev authored
      
      The following behavior was observed for QEMU configured by libvirt
      to use guest agent as usual for the guests without virtio-serial
      driver (Windows or the guest remaining in BIOS stage).
      
      In QEMU on first connect to listen character device socket
      the listen socket is removed from poll just after the accept().
      virtio_serial_guest_ready() returns 0 and the descriptor
      of the connected Unix socket is removed from poll and it will
      not be present in poll() until the guest will initialize the driver
      and change the state of the serial to "guest connected".
      
      In libvirt connect() to guest agent is performed on restart and
      is run under VM state lock. Connect() is blocking and can
      wait forever.
      In this case libvirt can not perform ANY operation on that VM.
      
      The bug can be easily reproduced this way:
      
      Terminal 1:
      qemu-system-x86_64 -m 512 -device pci-serial,chardev=serial1 -chardev socket,id=serial1,path=/tmp/console.sock,server,nowait
      (virtio-serial and isa-serial also fit)
      
      Terminal 2:
      minicom -D unix\#/tmp/console.sock
      (type something and press enter)
      C-a x (to exit)
      
      Do 3 times:
      minicom -D unix\#/tmp/console.sock
      C-a x
      
      It needs 4 connections, because the first one is accepted by QEMU, then two are queued by
      the kernel, and the 4th blocks.
      
      The problem is that QEMU doesn't add a read watcher after succesful read
      until the guest device wants to acquire recieved data, so
      I propose to install a separate pullhup watcher regardless of
      whether the device waits for data or not.
      
      Signed-off-by: default avatarKlim Kireev <klim.kireev@virtuozzo.com>
      Message-Id: <20180125135129.9305-1-klim.kireev@virtuozzo.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      a8aa6197
    • Peter Xu's avatar
      memory: do explicit cleanup when remove listeners · d25836ca
      Peter Xu authored
      When unregister memory listeners, we should call, e.g.,
      region_del() (and possibly other undo operations) on every existing
      memory region sections there, otherwise we may leak resources that are
      held during the region_add(). This patch undo the stuff for the
      listeners, which emulates the case when the address space is set from
      current to an empty state.
      
      I found this problem when debugging a refcount leak issue that leads to
      a device unplug event lost (please see the "Bug:" line below).  In that
      case, the leakage of resource is the PCI BAR memory region refcount.
      And since memory regions are not keeping their own refcount but onto
      their owners, so the vfio-pci device's (who is the owner of the PCI BAR
      memory regions) refcount is leaked, and event missing.
      
      We had encountered similar issues before and fixed in other
      way (ee4c1128, "vhost: Release memory references on cleanup"). This
      patch can be seen as a more high-level fix of similar problems that are
      caused by the resource leaks from memory listeners. So now we can remove
      the explicit unref of memory regions since that'll be done altogether
      during unregistering of listeners now.
      
      Bug: https://bugzilla.redhat.com/show_bug.cgi?id=1531393
      
      
      Signed-off-by: default avatarPeter Xu <peterx@redhat.com>
      Message-Id: <20180122060244.29368-5-peterx@redhat.com>
      Reviewed-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      d25836ca
    • Peter Xu's avatar
      vfio: listener unregister before unset container · 36968626
      Peter Xu authored
      
      After next patch, listener unregister will need the container to be
      alive.  Let's move this unregister phase to be before unset container,
      since that operation will free the backend container in kernel,
      otherwise we'll get these after next patch:
      
      qemu-system-x86_64: VFIO_UNMAP_DMA: -22
      qemu-system-x86_64: vfio_dma_unmap(0x559bf53a4590, 0x0, 0xa0000) = -22 (Invalid argument)
      
      Signed-off-by: default avatarPeter Xu <peterx@redhat.com>
      Message-Id: <20180122060244.29368-4-peterx@redhat.com>
      Reviewed-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Acked-by: default avatarAlex Williamson <alex.williamson@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      36968626
    • Peter Xu's avatar
      arm: postpone device listener unregister · 0bbe4354
      Peter Xu authored
      
      It's a preparation for follow-up patch to call region_del() in
      memory_listener_unregister(), otherwise all device addr attached with
      kvm_devices_head will be reset before calling kvm_arm_set_device_addr.
      
      Signed-off-by: default avatarPeter Xu <peterx@redhat.com>
      Message-Id: <20180122060244.29368-3-peterx@redhat.com>
      Reviewed-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      0bbe4354
    • Peter Xu's avatar
      vhost: add traces for memory listeners · 0750b060
      Peter Xu authored
      
      Trace these operations on two memory listeners.  It helps to verify the
      new memory listener fix, and good to keep them there.
      
      Signed-off-by: default avatarPeter Xu <peterx@redhat.com>
      Message-Id: <20180122060244.29368-2-peterx@redhat.com>
      Acked-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Reviewed-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      0750b060
    • Marc-André Lureau's avatar
      ucontext: annotate coroutine stack for ASAN · d83414e1
      Marc-André Lureau authored
      It helps ASAN to detect more leaks on coroutine stacks, and to get rid
      of some extra warnings.
      
      Before:
      
      tests/test-coroutine -p
      /basic/lifecycle
      /basic/lifecycle: ==20781==WARNING: ASan doesn't fully support
      makecontext/swapcontext functions and may produce false positives in
      some cases!
      ==20781==WARNING: ASan is ignoring requested __asan_handle_no_return:
      stack top: 0x7ffcb184d000; bottom 0x7ff6c4cfd000; size: 0x0005ecb50000
      (25446121472)
      False positive error reports may follow
      For details see https://github.com/google/sanitizers/issues/189
      
      
      OK
      
      After:
      
      tests/test-coroutine -p /basic/lifecycle
      /basic/lifecycle: ==21110==WARNING: ASan doesn't fully support
      makecontext/swapcontext functions and may produce false positives in
      some cases!
      OK
      
      A similar work would need to be done for sigaltstack & windows fibers
      to have similar coverage. Since ucontext is preferred, I didn't bother
      checking the other coroutine implementations for now.
      
      Update travis to fix the build with ASAN annotations.
      
      Signed-off-by: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-Id: <20180116151152.4040-4-marcandre.lureau@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      d83414e1
    • Marc-André Lureau's avatar
      build-sys: add --enable-sanitizers · 247724cb
      Marc-André Lureau authored
      
      Typical slowdown introduced by AddressSanitizer is 2x.
      UBSan shouldn't have much impact on runtime cost.
      
      Enable it by default when --enable-debug, unless --disable-sanitizers.
      
      Signed-off-by: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-Id: <20180116151152.4040-3-marcandre.lureau@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      247724cb
  2. Feb 05, 2018
  3. Feb 02, 2018
    • Peter Maydell's avatar
      Merge remote-tracking branch 'remotes/kraxel/tags/ui-20180202-pull-request' into staging · f24ee107
      Peter Maydell authored
      
      ui: use QIONetListener in vnc, bugfixes for sdl1 and vnc.
      
      # gpg: Signature made Fri 02 Feb 2018 07:17:36 GMT
      # gpg:                using RSA key 4CB6D8EED3E87138
      # gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
      # gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
      # gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"
      # Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138
      
      * remotes/kraxel/tags/ui-20180202-pull-request:
        ui: correctly advance output buffer when writing SASL data
        ui: convert VNC server to QIONetListener
        ui: fix mixup between qnum and qcode in SDL1 key handling
      
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      f24ee107
    • Peter Maydell's avatar
      Merge remote-tracking branch 'remotes/kraxel/tags/vga-20180202-pull-request' into staging · fb2516ef
      Peter Maydell authored
      
      virtio-gpu: disallow vIOMMU
      
      # gpg: Signature made Fri 02 Feb 2018 08:31:52 GMT
      # gpg:                using RSA key 4CB6D8EED3E87138
      # gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
      # gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
      # gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"
      # Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138
      
      * remotes/kraxel/tags/vga-20180202-pull-request:
        virtio-gpu: disallow vIOMMU
      
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      fb2516ef
    • Peter Maydell's avatar
      Merge remote-tracking branch 'remotes/gkurz/tags/for-upstream' into staging · f74425e2
      Peter Maydell authored
      
      This series is mostly about 9p request cancellation. It fixes a
      long standing bug (read "specification violation") where the server
      would send an invalid response when the client has cancelled an
      in-flight request. This was causing annoying spurious EINTR returns
      in linux. The fix comes with some related testing in QTEST.
      
      Other patches are code cleanup and improvements.
      
      # gpg: Signature made Fri 02 Feb 2018 10:16:03 GMT
      # gpg:                using RSA key 71D4D5E5822F73D6
      # gpg: Good signature from "Greg Kurz <groug@kaod.org>"
      # gpg:                 aka "Gregory Kurz <gregory.kurz@free.fr>"
      # gpg:                 aka "[jpeg image of size 3330]"
      # Primary key fingerprint: B482 8BAF 9431 40CE F2A3  4910 71D4 D5E5 822F 73D6
      
      * remotes/gkurz/tags/for-upstream:
        tests/virtio-9p: explicitly handle potential integer overflows
        tests: virtio-9p: add FLUSH operation test
        libqos/virtio: return length written into used descriptor
        tests: virtio-9p: add WRITE operation test
        tests: virtio-9p: add LOPEN operation test
        tests: virtio-9p: use the synth backend
        tests: virtio-9p: wait for completion in the test code
        tests: virtio-9p: move request tag to the test functions
        9pfs: Correctly handle cancelled requests
        9pfs: drop v9fs_register_transport()
      
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      f74425e2
    • Peter Maydell's avatar
      Merge remote-tracking branch 'remotes/kraxel/tags/audio-20180202-pull-request' into staging · fabbd691
      Peter Maydell authored
      
      audio: two small fixes.
      
      # gpg: Signature made Fri 02 Feb 2018 07:49:20 GMT
      # gpg:                using RSA key 4CB6D8EED3E87138
      # gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
      # gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
      # gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"
      # Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138
      
      * remotes/kraxel/tags/audio-20180202-pull-request:
        hw/audio/sb16.c: change dolog() to qemu_log_mask()
        hw/audio/wm8750: move WM8750 declarations from i2c/i2c.h to audio/wm8750.h
      
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      fabbd691
    • Peter Maydell's avatar
      Merge remote-tracking branch 'remotes/cminyard/tags/for-release-20180201' into staging · 6a95e258
      Peter Maydell authored
      
      Lots of litte miscellaneous fixes for the IPMI code, plus
      add me as the IPMI maintainer.
      
      # gpg: Signature made Thu 01 Feb 2018 18:44:55 GMT
      # gpg:                using RSA key 61F38C90919BFF81
      # gpg: Good signature from "Corey Minyard <cminyard@mvista.com>"
      # gpg:                 aka "Corey Minyard <minyard@acm.org>"
      # gpg:                 aka "Corey Minyard <corey@minyard.net>"
      # gpg:                 aka "Corey Minyard <minyard@mvista.com>"
      # gpg: WARNING: This key is not certified with a trusted signature!
      # gpg:          There is no indication that the signature belongs to the owner.
      # Primary key fingerprint: FD0D 5CE6 7CE0 F59A 6688  2686 61F3 8C90 919B FF81
      
      * remotes/cminyard/tags/for-release-20180201:
        ipmi: Allow BMC device properties to be set
        ipmi: disable IRQ and ATN on an external disconnect
        ipmi: Fix macro issues
        ipmi: Add the platform event message command
        ipmi: Don't set the timestamp on add events that don't have it
        ipmi: Fix SEL get/set time commands
        Add maintainer for the IPMI code
      
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      6a95e258
    • Peter Maydell's avatar
      Merge remote-tracking branch 'remotes/elmarco/tags/dump-pull-request' into staging · e486b528
      Peter Maydell authored
      
      # gpg: Signature made Thu 01 Feb 2018 11:15:42 GMT
      # gpg:                using RSA key DAE8E10975969CE5
      # gpg: Good signature from "Marc-André Lureau <marcandre.lureau@redhat.com>"
      # gpg:                 aka "Marc-André Lureau <marcandre.lureau@gmail.com>"
      # Primary key fingerprint: 87A9 BD93 3F87 C606 D276  F62D DAE8 E109 7596 9CE5
      
      * remotes/elmarco/tags/dump-pull-request:
        dump-guest-memory.py: skip vmcoreinfo section if not available
      
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      e486b528
    • Greg Kurz's avatar
    • Greg Kurz's avatar
      tests: virtio-9p: add FLUSH operation test · 357e2f7f
      Greg Kurz authored
      The idea is to send a victim request that will possibly block in the
      server and to send a flush request to cancel the victim request.
      
      This patch adds two test to verifiy that:
      - the server does not reply to a victim request that was actually
        cancelled
      - the server replies to the flush request after replying to the
        victim request if it could not cancel it
      
      9p request cancellation reference:
      
      http://man.cat-v.org/plan_9/5/flush
      
      
      
      Signed-off-by: default avatarGreg Kurz <groug@kaod.org>
      Reviewed-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
      (groug, change the test to only write a single byte to avoid
              any alignment or endianess consideration)
      357e2f7f
    • Greg Kurz's avatar
      libqos/virtio: return length written into used descriptor · be3a6781
      Greg Kurz authored
      
      When a 9p request is flushed (ie, cancelled) by the guest, the device
      is expected to simply mark the request as used, without sending a 9p
      reply (ie, without writing anything into the used buffer).
      
      To be able to test this, we need access to the length written by the
      device into the used descriptor. This patch adds a uint32_t * argument
      to qvirtqueue_get_buf() and qvirtio_wait_used_elem() for this purpose.
      
      All existing users are updated accordingly.
      
      Signed-off-by: default avatarGreg Kurz <groug@kaod.org>
      Reviewed-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
      be3a6781
    • Peter Maydell's avatar
      Merge remote-tracking branch 'remotes/cody/tags/block-pull-request' into staging · 707eafb8
      Peter Maydell authored
      
      # gpg: Signature made Thu 01 Feb 2018 04:05:22 GMT
      # gpg:                using RSA key BDBE7B27C0DE3057
      # gpg: Good signature from "Jeffrey Cody <jcody@redhat.com>"
      # gpg:                 aka "Jeffrey Cody <jeff@codyprime.org>"
      # gpg:                 aka "Jeffrey Cody <codyprime@gmail.com>"
      # Primary key fingerprint: 9957 4B4D 3474 90E7 9D98  D624 BDBE 7B27 C0DE 3057
      
      * remotes/cody/tags/block-pull-request:
        iotests: Make 200 run on tmpfs
        block/ssh: fix possible segmentation fault when .desc is not null-terminated
      
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      707eafb8
    • Peter Xu's avatar
      virtio-gpu: disallow vIOMMU · 34e304e9
      Peter Xu authored
      
      virtio-gpu has special code path that bypassed vIOMMU protection.  So
      for now let's disable iommu_platform for the device until we fully
      support that (if needed).
      
      After the patch, both virtio-vga and virtio-gpu won't allow to boot with
      iommu_platform parameter set.
      
      CC: Gerd Hoffmann <kraxel@redhat.com>
      Signed-off-by: default avatarPeter Xu <peterx@redhat.com>
      Message-id: 20180131040401.3550-1-peterx@redhat.com
      Signed-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
      34e304e9
    • John Arbuckle's avatar
      hw/audio/sb16.c: change dolog() to qemu_log_mask() · 8ec660b8
      John Arbuckle authored
      
      Changes all the occurrances of dolog() to qemu_log_mask().
      
      Signed-off-by: default avatarJohn Arbuckle <programmingkidx@gmail.com>
      Message-id: 20180201172744.7504-1-programmingkidx@gmail.com
      Signed-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
      8ec660b8
Loading