1. 28 4月, 2016 1 次提交
    • J
      target-mips: Fix RDHWR exception host PC · d96391c1
      James Hogan 提交于
      Commit b00c7218 ("target-mips: add PC, XNP reg numbers to RDHWR")
      changed the rdhwr helpers to use check_hwrena() to check the register
      being accessed is enabled in CP0_HWREna when used from user mode. If
      that check fails an EXCP_RI exception is raised at the host PC
      calculated with GETPC().
      
      However check_hwrena() may not be fully inlined as the
      do_raise_exception() part of it is common regardless of the arguments.
      This causes GETPC() to calculate the address in the call in the helper
      instead of the generated code calling the helper. No TB will be found
      and the EPC reported with the resulting guest RI exception points to the
      beginning of the TB instead of the RDHWR instruction.
      
      We can't reliably force check_hwrena() to be inlined, and converting it
      to a macro would be ugly, so instead pass the host PC in as an argument,
      with each rdhwr helper passing GETPC(). This should avoid any dependence
      on compiler behaviour, and in practice seems to ensure the full inlining
      of check_hwrena() on x86_64.
      
      This issue causes failures when running a MIPS KVM (trap & emulate)
      guest in a MIPS QEMU TCG guest, as the inner guest kernel will do a
      RDHWR of counter, which is disabled in the outer guest's CP0_HWREna by
      KVM so it can emulate the inner guest's counter. The emulation fails and
      the RI exception is passed to the inner guest.
      
      Fixes: b00c7218 ("target-mips: add PC, XNP reg numbers to RDHWR")
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Cc: Leon Alrae <leon.alrae@imgtec.com>
      Cc: Yongbok Kim <yongbok.kim@imgtec.com>
      Cc: Aurelien Jarno <aurelien@aurel32.net>
      Reviewed-by: NAurelien Jarno <aurelien@aurel32.net>
      Reviewed-by: NLeon Alrae <leon.alrae@imgtec.com>
      Signed-off-by: NLeon Alrae <leon.alrae@imgtec.com>
      d96391c1
  2. 25 4月, 2016 2 次提交
    • G
      usb/uhci: move pid check · f419a626
      Gerd Hoffmann 提交于
      commit "5f77e06b usb: add pid check at the first of uhci_handle_td()"
      moved the pid verification to the start of the uhci_handle_td function,
      to simplify the error handling (we don't have to free stuff which we
      didn't allocate in the first place ...).
      
      Problem is now the check fires too often, it raises error IRQs even for
      TDs which we are not going to process because they are not set active.
      
      So, lets move down the check a bit, so it is done only for active TDs,
      but still before we are going to allocate stuff to process the requested
      transfer.
      Reported-by: NJoe Clifford <joe@thunderbug.co.uk>
      Tested-by: NJoe Clifford <joe@thunderbug.co.uk>
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      Message-id: 1461321893-15811-1-git-send-email-kraxel@redhat.com
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      f419a626
    • P
      Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-2.6-20160423' into staging · 3123bd8e
      Peter Maydell 提交于
      ppc patch queue for 2016-03-23
      
      A single fix for a bug in parameter handling for the spapr PCI host
      bridge.
      
      # gpg: Signature made Sat 23 Apr 2016 07:55:29 BST using RSA key ID 20D9B392
      # gpg: Good signature from "David Gibson <david@gibson.dropbear.id.au>"
      # gpg:                 aka "David Gibson (Red Hat) <dgibson@redhat.com>"
      # gpg:                 aka "David Gibson (ozlabs.org) <dgibson@ozlabs.org>"
      # 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: 75F4 6586 AE61 A66C C44E  87DC 6C38 CACA 20D9 B392
      
      * remotes/dgibson/tags/ppc-for-2.6-20160423:
        hw/ppc/spapr: Fix crash when specifying bad parameters to spapr-pci-host-bridge
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      3123bd8e
  3. 23 4月, 2016 1 次提交
    • T
      hw/ppc/spapr: Fix crash when specifying bad parameters to spapr-pci-host-bridge · da34fed7
      Thomas Huth 提交于
      QEMU currently crashes when using bad parameters for the
      spapr-pci-host-bridge device:
      
      $ qemu-system-ppc64 -device spapr-pci-host-bridge,buid=0x123,liobn=0x321,mem_win_addr=0x1,io_win_addr=0x10
      Segmentation fault
      
      The problem is that spapr_tce_find_by_liobn() might return NULL, but
      the code in spapr_populate_pci_dt() does not check for this condition
      and then tries to dereference this NULL pointer.
      Apart from that, the return value of spapr_populate_pci_dt() also
      has to be checked for all PCI buses, not only for the last one, to
      make sure we catch all errors.
      Signed-off-by: NThomas Huth <thuth@redhat.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      da34fed7
  4. 22 4月, 2016 9 次提交
    • P
      Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging · 53343338
      Peter Maydell 提交于
      Mirror block job fixes for 2.6.0-rc4
      
      # gpg: Signature made Fri 22 Apr 2016 15:46:41 BST using RSA key ID C88F2FD6
      # gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>"
      
      * remotes/kevin/tags/for-upstream:
        mirror: Workaround for unexpected iohandler events during completion
        aio-posix: Skip external nodes in aio_dispatch
        virtio: Mark host notifiers as external
        event-notifier: Add "is_external" parameter
        iohandler: Introduce iohandler_get_aio_context
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      53343338
    • F
      mirror: Workaround for unexpected iohandler events during completion · ab27c3b5
      Fam Zheng 提交于
      Commit 5a7e7a0b moved mirror_exit to a BH handler but didn't add any
      protection against new requests that could sneak in just before the
      BH is dispatched. For example (assuming a code base at that commit):
      
              main_loop_wait # 1
                os_host_main_loop_wait
                  g_main_context_dispatch
                    aio_ctx_dispatch
                      aio_dispatch
                        ...
                          mirror_run
                            bdrv_drain
          (a)               block_job_defer_to_main_loop
                qemu_iohandler_poll
                  virtio_queue_host_notifier_read
                    ...
                      virtio_submit_multiwrite
          (b)           blk_aio_multiwrite
      
              main_loop_wait # 2
                <snip>
                      aio_dispatch
                        aio_bh_poll
          (c)             mirror_exit
      
      At (a) we know the BDS has no pending request. However, the same
      main_loop_wait call is going to dispatch iohandlers (EventNotifier
      events), which may lead to a new I/O from guest. So the invariant is
      already broken at (c). Data loss.
      
      Commit f3926945 made iohandler to use aio API.  The order of
      virtio_queue_host_notifier_read and block_job_defer_to_main_loop within
      a main_loop_wait becomes unpredictable, and even worse, if the host
      notifier event arrives at the next main_loop_wait call, the
      unpredictable order between mirror_exit and
      virtio_queue_host_notifier_read is also a trouble. As shown below, this
      commit made the bug easier to trigger:
      
          - Bug case 1:
      
              main_loop_wait # 1
                os_host_main_loop_wait
                  g_main_context_dispatch
                    aio_ctx_dispatch (qemu_aio_context)
                      ...
                        mirror_run
                          bdrv_drain
          (a)             block_job_defer_to_main_loop
                    aio_ctx_dispatch (iohandler_ctx)
                      virtio_queue_host_notifier_read
                        ...
                          virtio_submit_multiwrite
          (b)               blk_aio_multiwrite
      
              main_loop_wait # 2
                ...
                      aio_dispatch
                        aio_bh_poll
          (c)             mirror_exit
      
          - Bug case 2:
      
              main_loop_wait # 1
                os_host_main_loop_wait
                  g_main_context_dispatch
                    aio_ctx_dispatch (qemu_aio_context)
                      ...
                        mirror_run
                          bdrv_drain
          (a)             block_job_defer_to_main_loop
      
              main_loop_wait # 2
                ...
                  aio_ctx_dispatch (iohandler_ctx)
                    virtio_queue_host_notifier_read
                      ...
                        virtio_submit_multiwrite
          (b)             blk_aio_multiwrite
                    aio_dispatch
                      aio_bh_poll
          (c)           mirror_exit
      
      In both cases, (b) breaks the invariant wanted by (a) and (c).
      
      Until then, the request loss has been silent. Later, 3f09bfbc added
      asserts at (c) to check the invariant (in
      bdrv_replace_in_backing_chain), and Max reported an assertion failure
      first visible there, by doing active committing while the guest is
      running bonnie++.
      
      2.5 added bdrv_drained_begin at (a) to protect the dataplane case from
      similar problems, but we never realize the main loop bug until now.
      
      As a bandage, this patch disables iohandler's external events
      temporarily together with bs->ctx.
      
      Launchpad Bug: 1570134
      
      Cc: qemu-stable@nongnu.org
      Signed-off-by: NFam Zheng <famz@redhat.com>
      Reviewed-by: NJeff Cody <jcody@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      ab27c3b5
    • F
      aio-posix: Skip external nodes in aio_dispatch · 37989ced
      Fam Zheng 提交于
      aio_poll doesn't poll the external nodes so this should never be true,
      but aio_ctx_dispatch may get notified by the events from GSource. To
      make bdrv_drained_begin effective in main loop, we should check the
      is_external flag here too.
      
      Also do the check in aio_pending so aio_dispatch is not called
      superfluously, when there is no events other than external ones.
      Signed-off-by: NFam Zheng <famz@redhat.com>
      Reviewed-by: NJeff Cody <jcody@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      37989ced
    • F
      virtio: Mark host notifiers as external · 14560d69
      Fam Zheng 提交于
      The effect of this change is the block layer drained section can work,
      for example when mirror job is being completed.
      Signed-off-by: NFam Zheng <famz@redhat.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      14560d69
    • F
      event-notifier: Add "is_external" parameter · 54e18d35
      Fam Zheng 提交于
      All callers pass "false" keeping the old semantics. The windows
      implementation doesn't distinguish the flag yet. On posix, it is passed
      down to the underlying aio context.
      Signed-off-by: NFam Zheng <famz@redhat.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      54e18d35
    • F
      iohandler: Introduce iohandler_get_aio_context · bcd82a96
      Fam Zheng 提交于
      Signed-off-by: NFam Zheng <famz@redhat.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      bcd82a96
    • C
      util: align memory allocations to 2M on AArch64 · ee1e0f8e
      Christoffer Dall 提交于
      For KVM to use Transparent Huge Pages (THP) we have to ensure that the
      alignment of the userspace address of the KVM memory slot and the IPA
      that the guest sees for a memory region have the same offset from the 2M
      huge page size boundary.
      
      One way to achieve this is to always align the IPA region at a 2M
      boundary and ensure that the mmap alignment is also at 2M.
      
      Unfortunately, we were only doing this for __arm__, not for __aarch64__,
      so add this simple condition.
      
      This fixes a performance regression using KVM/ARM on AArch64 platforms
      that showed a performance penalty of more than 50%, introduced by the
      following commit:
      
      9fac18f0 (oslib: allocate PROT_NONE pages on top of RAM, 2015-09-10)
      
      We were only lucky before the above commit, because we were allocating
      large regions and naturally getting a 2M alignment on those allocations
      then.
      
      Cc: qemu-stable@nongnu.org
      Reported-by: NShih-Wei Li <shihwei@cs.columbia.edu>
      Signed-off-by: NChristoffer Dall <christoffer.dall@linaro.org>
      Reviewed-by: NPeter Maydell <peter.maydell@linaro.org>
      [PMM: wrapped long line]
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      ee1e0f8e
    • E
      nbd: Don't mishandle unaligned client requests · df7b97ff
      Eric Blake 提交于
      The NBD protocol does not (yet) force any alignment constraints
      on clients.  Even though qemu NBD clients always send requests
      that are aligned to 512 bytes, we must be prepared for non-qemu
      clients that don't care about alignment (even if it means they
      are less efficient).  Our use of blk_read() and blk_write() was
      silently operating on the wrong file offsets when the client
      made an unaligned request, corrupting the client's data (but
      as the client already has control over the file we are serving,
      I don't think it is a security hole, per se, just a data
      corruption bug).
      
      Note that in the case of NBD_CMD_READ, an unaligned length could
      cause us to return up to 511 bytes of uninitialized trailing
      garbage from blk_try_blockalign() - hopefully nothing sensitive
      from the heap's prior usage is ever leaked in that manner.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NFam Zheng <famz@redhat.com>
      Tested-by: NKevin Wolf <kwolf@redhat.com>
      Message-id: 1461249750-31928-1-git-send-email-eblake@redhat.com
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      df7b97ff
    • P
      Update version for v2.6.0-rc3 release · 8d0d9b9f
      Peter Maydell 提交于
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      8d0d9b9f
  5. 21 4月, 2016 4 次提交
  6. 20 4月, 2016 14 次提交
  7. 19 4月, 2016 9 次提交