1. 24 3月, 2016 16 次提交
  2. 23 3月, 2016 7 次提交
    • P
      Merge remote-tracking branch 'remotes/armbru/tags/pull-ivshmem-2016-03-18' into staging · 2538039f
      Peter Maydell 提交于
      ivshmem: Fixes, cleanups, device model split
      
      # gpg: Signature made Mon 21 Mar 2016 20:33:54 GMT using RSA key ID EB918653
      # gpg: Good signature from "Markus Armbruster <armbru@redhat.com>"
      # gpg:                 aka "Markus Armbruster <armbru@pond.sub.org>"
      
      * remotes/armbru/tags/pull-ivshmem-2016-03-18: (40 commits)
        contrib/ivshmem-server: Print "not for production" warning
        ivshmem: Require master to have ID zero
        ivshmem: Drop ivshmem property x-memdev
        ivshmem: Clean up after the previous commit
        ivshmem: Split ivshmem-plain, ivshmem-doorbell off ivshmem
        ivshmem: Replace int role_val by OnOffAuto master
        qdev: New DEFINE_PROP_ON_OFF_AUTO
        ivshmem: Inline check_shm_size() into its only caller
        ivshmem: Simplify memory regions for BAR 2 (shared memory)
        ivshmem: Implement shm=... with a memory backend
        ivshmem: Tighten check of property "size"
        ivshmem: Simplify how we cope with short reads from server
        ivshmem: Drop the hackish test for UNIX domain chardev
        ivshmem: Rely on server sending the ID right after the version
        ivshmem: Propagate errors through ivshmem_recv_setup()
        ivshmem: Receive shared memory synchronously in realize()
        ivshmem: Plug leaks on unplug, fix peer disconnect
        ivshmem: Disentangle ivshmem_read()
        ivshmem: Simplify rejection of invalid peer ID from server
        ivshmem: Assert interrupts are set up once
        ...
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      2538039f
    • P
      Merge remote-tracking branch 'remotes/weil/tags/pull-wxx-20160322' into staging · ffa6564c
      Peter Maydell 提交于
      wxx patch queue
      
      # gpg: Signature made Tue 22 Mar 2016 18:18:36 GMT using RSA key ID 677450AD
      # gpg: Good signature from "Stefan Weil <sw@weilnetz.de>"
      # gpg:                 aka "Stefan Weil <stefan.weil@weilnetz.de>"
      # gpg:                 aka "Stefan Weil <stefan.weil@bib.uni-mannheim.de>"
      # gpg: WARNING: This key is not certified with sufficiently trusted signatures!
      # gpg:          It is not certain that the signature belongs to the owner.
      # Primary key fingerprint: 4923 6FEA 75C9 5D69 8EC2  B78A E08C 21D5 6774 50AD
      
      * remotes/weil/tags/pull-wxx-20160322:
        wxx: Add support for ncurses
        Remove unneeded include statements for setjmp.h
        Include setjmp.h in qemu/osdep.h (bug fix for w64)
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      ffa6564c
    • S
      wxx: Add support for ncurses · ae629634
      Stefan Weil 提交于
      We used to support only pdcurses for Windows, but recently Cygwin added
      mingw64-i686-ncurses and mingw64-x86_64-ncurses packages which are
      supported now, too.
      Signed-off-by: NStefan Weil <sw@weilnetz.de>
      ae629634
    • S
      Remove unneeded include statements for setjmp.h · 8ff98f1e
      Stefan Weil 提交于
      As soon as setjmp.h is included from qemu/osdep.h, those old include
      statements are no longer needed.
      
      Add also setjmp.h to the list in scripts/clean-includes.
      Signed-off-by: NStefan Weil <sw@weilnetz.de>
      8ff98f1e
    • S
      Include setjmp.h in qemu/osdep.h (bug fix for w64) · e89fdafb
      Stefan Weil 提交于
      setjmp must be declared before sysemu/os-win32.h
      because it is redefined there for 64 bit Windows.
      Reviewed-by: NRichard Henderson  <rth@twiddle.net>
      Tested-by: NAndrew Baumann <Andrew.Baumann@microsoft.com>
      Signed-off-by: NStefan Weil <sw@weilnetz.de>
      e89fdafb
    • P
      Merge remote-tracking branch 'remotes/mdroth/tags/qga-pull-2016-03-21-tag' into staging · 459621ac
      Peter Maydell 提交于
      qemu-ga patch queue for 2.6
      
      * remove unused variable
      
      # gpg: Signature made Mon 21 Mar 2016 17:32:42 GMT using RSA key ID F108B584
      # gpg: Good signature from "Michael Roth <flukshun@gmail.com>"
      # gpg:                 aka "Michael Roth <mdroth@utexas.edu>"
      # gpg:                 aka "Michael Roth <mdroth@linux.vnet.ibm.com>"
      
      * remotes/mdroth/tags/qga-pull-2016-03-21-tag:
        qemu-ga: drop unused local err variable
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      459621ac
    • P
      Merge remote-tracking branch 'remotes/kraxel/tags/pull-usb-20160321-1' into staging · ac0d25e8
      Peter Maydell 提交于
      usb: bugfix collection.
      
      # gpg: Signature made Mon 21 Mar 2016 11:07:39 GMT using RSA key ID D3E87138
      # 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>"
      
      * remotes/kraxel/tags/pull-usb-20160321-1:
        usb: ehci: add capability mmio write function
        hw/usb/dev-mtp: Guard inotify usage with CONFIG_INOTIFY1
        usb: fix unbound stack warning for inotify_watchfn
        usb: fix unbound stack usage for usb_mtp_add_str
        usb: fix unbounded stack warning for xhci_dma_write_u32s
        usb: Fix compilation for Windows
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      ac0d25e8
  3. 22 3月, 2016 17 次提交
    • M
      contrib/ivshmem-server: Print "not for production" warning · a335c6f2
      Markus Armbruster 提交于
      The code is okay for illustrating how things work and for testing, but
      its error handling make it unfit for production use.  Print a warning
      to protect the innocent.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-Id: <1458066895-20632-41-git-send-email-armbru@redhat.com>
      a335c6f2
    • M
      ivshmem: Require master to have ID zero · 62a830b6
      Markus Armbruster 提交于
      Migration with ivshmem needs to be carefully orchestrated to work.
      Exactly one peer (the "master") migrates to the destination, all other
      peers need to unplug (and disconnect), migrate, plug back (and
      reconnect).  This is sort of documented in qemu-doc.
      
      If peers connect on the destination before migration completes, the
      shared memory can get messed up.  This isn't documented anywhere.  Fix
      that in qemu-doc.
      
      To avoid messing up register IVPosition on migration, the server must
      assign the same ID on source and destination.  ivshmem-spec.txt leaves
      ID assignment unspecified, however.
      
      Amend ivshmem-spec.txt to require the first client to receive ID zero.
      The example ivshmem-server complies: it always assigns the first
      unused ID.
      
      For a bit of additional safety, enforce ID zero for the master.  This
      does nothing when we're not using a server, because the ID is zero for
      all peers then.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-Id: <1458066895-20632-40-git-send-email-armbru@redhat.com>
      62a830b6
    • M
      ivshmem: Drop ivshmem property x-memdev · 13fd2cb6
      Markus Armbruster 提交于
      Use ivshmem-plain instead.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-Id: <1458066895-20632-39-git-send-email-armbru@redhat.com>
      13fd2cb6
    • M
      ivshmem: Clean up after the previous commit · ddc85284
      Markus Armbruster 提交于
      Move code to more sensible places.  Use the opportunity to reorder and
      document IVShmemState members.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-Id: <1458066895-20632-38-git-send-email-armbru@redhat.com>
      ddc85284
    • M
      ivshmem: Split ivshmem-plain, ivshmem-doorbell off ivshmem · 5400c02b
      Markus Armbruster 提交于
      ivshmem can be configured with and without interrupt capability
      (a.k.a. "doorbell").  The two configurations have largely disjoint
      options, which makes for a confusing (and badly checked) user
      interface.  Moreover, the device can't tell the guest whether its
      doorbell is enabled.
      
      Create two new device models ivshmem-plain and ivshmem-doorbell, and
      deprecate the old one.
      
      Changes from ivshmem:
      
      * PCI revision is 1 instead of 0.  The new revision is fully backwards
        compatible for guests.  Guests may elect to require at least
        revision 1 to make sure they're not exposed to the funny "no shared
        memory, yet" state.
      
      * Property "role" replaced by "master".  role=master becomes
        master=on, role=peer becomes master=off.  Default is off instead of
        auto.
      
      * Property "use64" is gone.  The new devices always have 64 bit BARs.
      
      Changes from ivshmem to ivshmem-plain:
      
      * The Interrupt Pin register in PCI config space is zero (does not use
        an interrupt pin) instead of one (uses INTA).
      
      * Property "x-memdev" is renamed to "memdev".
      
      * Properties "shm" and "size" are gone.  Use property "memdev"
        instead.
      
      * Property "msi" is gone.  The new device can't have MSI-X capability.
        It can't interrupt anyway.
      
      * Properties "ioeventfd" and "vectors" are gone.  They're meaningless
        without interrupts anyway.
      
      Changes from ivshmem to ivshmem-doorbell:
      
      * Property "msi" is gone.  The new device always has MSI-X capability.
      
      * Property "ioeventfd" defaults to on instead of off.
      
      * Property "size" is gone.  The new device can only map all the shared
        memory received from the server.
      
      Guests can easily find out whether the device is configured for
      interrupts by checking for MSI-X capability.
      
      Note: some code added in sub-optimal places to make the diff easier to
      review.  The next commit will move it to more sensible places.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-Id: <1458066895-20632-37-git-send-email-armbru@redhat.com>
      5400c02b
    • M
      ivshmem: Replace int role_val by OnOffAuto master · 2a845da7
      Markus Armbruster 提交于
      In preparation of making it a qdev property.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-Id: <1458066895-20632-36-git-send-email-armbru@redhat.com>
      2a845da7
    • M
      qdev: New DEFINE_PROP_ON_OFF_AUTO · 55e8a154
      Markus Armbruster 提交于
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-Id: <1458066895-20632-35-git-send-email-armbru@redhat.com>
      55e8a154
    • M
      ivshmem: Inline check_shm_size() into its only caller · 8baeb22b
      Markus Armbruster 提交于
      Improve the error messages while there.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Message-Id: <1458066895-20632-34-git-send-email-armbru@redhat.com>
      Reviewed-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      8baeb22b
    • M
      ivshmem: Simplify memory regions for BAR 2 (shared memory) · c2d8019c
      Markus Armbruster 提交于
      ivshmem_realize() puts the shared memory region in a container region.
      Used to be necessary to permit delayed mapping of the shared memory.
      However, we recently moved to synchronous mapping, in "ivshmem:
      Receive shared memory synchronously in realize()" and the commit
      following it.  The container is redundant since then.  Drop it.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Reviewed-by: NPaolo Bonzini <pbonzini@redhat.com>
      Message-Id: <1458066895-20632-33-git-send-email-armbru@redhat.com>
      c2d8019c
    • M
      ivshmem: Implement shm=... with a memory backend · 5503e285
      Markus Armbruster 提交于
      ivshmem has its very own code to create and map shared memory.
      Replace that with an implicitly created memory backend.  Reduces the
      number of ways we create BAR 2 from three to two.
      
      The memory-backend-file is currently available only with CONFIG_LINUX,
      so this adds a second Linuxism to ivshmem (the other one is eventfd).
      Should we ever need to make it portable to systems where
      memory-backend-file can't be made to serve, we could create a
      memory-backend-shmem that allocates memory with shm_open().
      
      Bonus fix: shared memory files are now created with permissions 0655
      instead of 0777.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NPaolo Bonzini <pbonzini@redhat.com>
      Message-Id: <1458066895-20632-32-git-send-email-armbru@redhat.com>
      5503e285
    • M
      ivshmem: Tighten check of property "size" · 08183c20
      Markus Armbruster 提交于
      If size_t is narrower than 64 bits, passing uint64_t ivshmem_size to
      mmap() truncates.  Reject such sizes.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-Id: <1458066895-20632-31-git-send-email-armbru@redhat.com>
      08183c20
    • M
      ivshmem: Simplify how we cope with short reads from server · ee276391
      Markus Armbruster 提交于
      Short reads from a UNIX domain sockets are exceedingly unlikely when
      the other side always sends eight bytes and we always read eight
      bytes.  We cope with them anyway.  However, the code doing that is
      rather convoluted.  Dumb it down radically.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-Id: <1458066895-20632-30-git-send-email-armbru@redhat.com>
      ee276391
    • M
      ivshmem: Drop the hackish test for UNIX domain chardev · ba5970a1
      Markus Armbruster 提交于
      The chardev must be capable of transmitting SCM_RIGHTS ancillary
      messages.  We check it by comparing CharDriverState member filename to
      "unix:".  That's almost as brittle as it is disgusting.
      
      When the actual transmission all happened asynchronously, this check
      was all we could do in realize(), and thus better than nothing.  But
      now we receive at least one SCM_RIGHTS synchronously in realize(),
      it's not worth its keep anymore.  Drop it.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-Id: <1458066895-20632-29-git-send-email-armbru@redhat.com>
      ba5970a1
    • M
      ivshmem: Rely on server sending the ID right after the version · a3feb086
      Markus Armbruster 提交于
      The protocol specification (ivshmem-spec.txt, formerly
      ivshmem_device_spec.txt) has always required the ID message to be sent
      right at the beginning, and ivshmem-server has always complied.  The
      device, however, accepts it out of order.  If an interrupt setup
      arrived before it, though, it would be misinterpreted as connect
      notification.  Fix the latent bug by relying on the spec and
      ivshmem-server's actual behavior.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-Id: <1458066895-20632-28-git-send-email-armbru@redhat.com>
      a3feb086
    • M
      ivshmem: Propagate errors through ivshmem_recv_setup() · 1309cf44
      Markus Armbruster 提交于
      This kills off the funny state described in the previous commit.
      
      Simplify ivshmem_io_read() accordingly, and update documentation.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Message-Id: <1458066895-20632-27-git-send-email-armbru@redhat.com>
      Reviewed-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      1309cf44
    • M
      ivshmem: Receive shared memory synchronously in realize() · 3a55fc0f
      Markus Armbruster 提交于
      When configured for interrupts (property "chardev" given), we receive
      the shared memory from an ivshmem server.  We do so asynchronously
      after realize() completes, by setting up callbacks with
      qemu_chr_add_handlers().
      
      Keeping server I/O out of realize() that way avoids delays due to a
      slow server.  This is probably relevant only for hot plug.
      
      However, this funny "no shared memory, yet" state of the device also
      causes a raft of issues that are hard or impossible to work around:
      
      * The guest is exposed to this state: when we enter and leave it its
        shared memory contents is apruptly replaced, and device register
        IVPosition changes.
      
        This is a known issue.  We document that guests should not access
        the shared memory after device initialization until the IVPosition
        register becomes non-negative.
      
        For cold plug, the funny state is unlikely to be visible in
        practice, because we normally receive the shared memory long before
        the guest gets around to mess with the device.
      
        For hot plug, the timing is tighter, but the relative slowness of
        PCI device configuration has a good chance to hide the funny state.
      
        In either case, guests complying with the documented procedure are
        safe.
      
      * Migration becomes racy.
      
        If migration completes before the shared memory setup completes on
        the source, shared memory contents is silently lost.  Fortunately,
        migration is rather unlikely to win this race.
      
        If the shared memory's ramblock arrives at the destination before
        shared memory setup completes, migration fails.
      
        There is no known way for a management application to wait for
        shared memory setup to complete.
      
        All you can do is retry failed migration.  You can improve your
        chances by leaving more time between running the destination QEMU
        and the migrate command.
      
        To mitigate silent memory loss, you need to ensure the server
        initializes shared memory exactly the same on source and
        destination.
      
        These issues are entirely undocumented so far.
      
      I'd expect the server to be almost always fast enough to hide these
      issues.  But then rare catastrophic races are in a way the worst kind.
      
      This is way more trouble than I'm willing to take from any device.
      Kill the funny state by receiving shared memory synchronously in
      realize().  If your hot plug hangs, go kill your ivshmem server.
      
      For easier review, this commit only makes the receive synchronous, it
      doesn't add the necessary error propagation.  Without that, the funny
      state persists.  The next commit will do that, and kill it off for
      real.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-Id: <1458066895-20632-26-git-send-email-armbru@redhat.com>
      3a55fc0f
    • M
      ivshmem: Plug leaks on unplug, fix peer disconnect · 9db51b4d
      Markus Armbruster 提交于
      close_peer_eventfds() cleans up three things: ioeventfd triggers if
      they exist, eventfds, and the array to store them.
      
      Commit 98609cd8 (v1.2.0) fixed it not to clean up ioeventfd triggers
      when they don't exist (property ioeventfd=off, which is the default).
      Unfortunately, the fix also made it skip cleanup of the eventfds and
      the array then.  This is a memory and file descriptor leak on unplug.
      
      Additionally, the reset of nb_eventfds is skipped.  Doesn't matter on
      unplug.  On peer disconnect, however, this permanently wedges the
      interrupt vectors used for that peer's ID.  The eventfds stay behind,
      but aren't connected to a peer anymore.  When the ID gets recycled for
      a new peer, the new peer's eventfds get assigned to vectors after the
      old ones.  Commonly, the device's number of vectors matches the
      server's, so the new ones get dropped with a "Too many eventfd
      received" message.  Interrupts either don't work (common case) or go
      to the wrong vector.
      
      Fix by narrowing the conditional to just the ioeventfd trigger
      cleanup.
      
      While there, move the "invalid" peer check to the only caller where it
      can actually happen, and tighten it to reject own ID.
      
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-Id: <1458066895-20632-25-git-send-email-armbru@redhat.com>
      9db51b4d