Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: qemu/qemu
base: 234320cd0573
Choose a base ref
...
head repository: qemu/qemu
compare: 802341823f17
Choose a head ref
  • 11 commits
  • 7 files changed
  • 3 contributors

Commits on Jul 31, 2023

  1. util/interval-tree: Use qatomic_read for left/right while searching

    Fixes a race condition (generally without optimization) in which
    the subtree is re-read after the protecting if condition.
    
    Cc: qemu-stable@nongnu.org
    Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
    Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
    rth7680 committed Jul 31, 2023
    Copy the full SHA
    055b86e View commit details
    Browse the repository at this point in the history
  2. util/interval-tree: Use qatomic_set_mb in rb_link_node

    Ensure that the stores to rb_left and rb_right are complete before
    inserting the new node into the tree.  Otherwise a concurrent reader
    could see garbage in the new leaf.
    
    Cc: qemu-stable@nongnu.org
    Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
    Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
    rth7680 committed Jul 31, 2023
    Copy the full SHA
    4c8baa0 View commit details
    Browse the repository at this point in the history
  3. util/interval-tree: Introduce pc_parent

    Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
    Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
    rth7680 committed Jul 31, 2023
    Copy the full SHA
    d37a259 View commit details
    Browse the repository at this point in the history
  4. util/interval-tree: Use qatomic_read/set for rb_parent_color

    While less susceptible to optimization problems than left and right,
    interval_tree_iter_next also reads rb_parent(), so make sure that
    stores and loads are atomic.
    
    This goes further than technically required, changing all loads to
    be atomic, rather than simply the ones in the iteration side.  But
    it doesn't really affect the code generation on the rebalance side
    and is cleaner to handle everything the same.
    
    Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
    Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
    rth7680 committed Jul 31, 2023
    Copy the full SHA
    79e2985 View commit details
    Browse the repository at this point in the history
  5. accel/tcg: Clear tcg_ctx->gen_tb on buffer overflow

    On overflow of code_gen_buffer, we unlock the guest pages we had been
    translating, but failed to clear gen_tb.  On restart, if we cannot
    allocate a TB, we exit to the main loop to perform the flush of all
    TBs as soon as possible.  With garbage in gen_tb, we hit an assert:
    
    ../src/accel/tcg/tb-maint.c:348:page_unlock__debug: \
        assertion failed: (page_is_locked(pd))
    
    Fixes: deba787 ("accel/tcg: Always lock pages before translation")
    Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
    rth7680 committed Jul 31, 2023
    Copy the full SHA
    ad17868 View commit details
    Browse the repository at this point in the history
  6. bsd-user: Allocate guest virtual address space

    With reserved_va, mmap.c expects to have pre-allocated host address
    space for the entire guest address space.  When combined with the -B
    command-line option, ensure that the chosen address does not overlap
    anything else.  Ensure that mmap_next_start is within reserved_va,
    as we use it within mmap.c without checking.
    
    Reviewed by: Warner Losh <imp@bsdimp.com>
    Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
    Message-Id: <20230727161148.444988-1-richard.henderson@linaro.org>
    rth7680 committed Jul 31, 2023
    Copy the full SHA
    28b61d4 View commit details
    Browse the repository at this point in the history
  7. bsd-user: Specify host page alignment if none specified

    We're hitting an assert when we pass in alignment == 0 since that's not
    a power of two. so pass in the ideal page size.
    
    Signed-off-by: Warner Losh <imp@bsdimp.com>
    Message-Id: <20230728162927.5009-1-imp@bsdimp.com>
    Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
    Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
    bsdimp authored and rth7680 committed Jul 31, 2023
    Copy the full SHA
    0f2f324 View commit details
    Browse the repository at this point in the history
  8. target/ppc: Disable goto_tb with architectural singlestep

    The change to use translator_use_goto_tb went too far, as the
    CF_SINGLE_STEP flag managed by the translator only handles
    gdb single stepping and not the architectural single stepping
    modeled in DisasContext.singlestep_enabled.
    
    Fixes: 6e9cc37 ("target/ppc: Use translator_use_goto_tb")
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1795
    Reviewed-by: Cédric Le Goater <clg@kaod.org>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
    Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
    rth7680 committed Jul 31, 2023
    Copy the full SHA
    2e718e6 View commit details
    Browse the repository at this point in the history
  9. linux-user/armeb: Fix __kernel_cmpxchg() for armeb

    Commit 7f4f0d9 ("linux-user/arm: Implement __kernel_cmpxchg with host
    atomics") switched to use qatomic_cmpxchg() to swap a word with the memory
    content, but missed to endianess-swap the oldval and newval values when
    emulating an armeb CPU, which expects words to be stored in big endian in
    the guest memory.
    
    The bug can be verified with qemu >= v7.0 on any little-endian host, when
    starting the armeb binary of the upx program, which just hangs without
    this patch.
    
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Helge Deller <deller@gmx.de>
    Reported-by: "Markus F.X.J. Oberhumer" <markus@oberhumer.com>
    Reported-by: John Reiser <jreiser@BitWagon.com>
    Closes: upx/upx#687
    Message-Id: <ZMQVnqY+F+5sTNFd@p100>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
    Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
    Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
    hdeller authored and rth7680 committed Jul 31, 2023
    Copy the full SHA
    38dd78c View commit details
    Browse the repository at this point in the history
  10. target/s390x: Move trans_exc_code update to do_program_interrupt

    This solves a problem in which the store to LowCore during tlb_fill
    triggers a clean-page TB invalidation for page0 during translation,
    which results in an assertion failure for locked pages.
    
    By delaying the store until after the exception has been raised,
    we will have unwound the pages locked for translation and the
    problem does not arise.  There are plenty of other updates to
    LowCore while delivering an interrupt/exception; trans_exc_code
    does not need to be special.
    
    Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com>
    Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
    rth7680 committed Jul 31, 2023
    Copy the full SHA
    8b94ec5 View commit details
    Browse the repository at this point in the history
  11. Merge tag 'pull-tcg-20230731' of https://gitlab.com/rth7680/qemu into…

    … staging
    
    util/interval-tree: Access left/right/parent atomically
    accel/tcg: Clear gen_tb on buffer overflow
    bsd-user: Specify host page alignment if none specified
    bsd-user: Allocate guest virtual address space
    target/ppc: Disable goto_tb with architectural singlestep
    target/s390x: Move trans_exc_code update to do_program_interrupt
    
    # -----BEGIN PGP SIGNATURE-----
    #
    # iQFRBAABCgA7FiEEekgeeIaLTbaoWgXAZN846K9+IV8FAmTIIQUdHHJpY2hhcmQu
    # aGVuZGVyc29uQGxpbmFyby5vcmcACgkQZN846K9+IV87JAf/ZgJTq26oniJ4TLkS
    # 2UVBEcxGnnA2L1n4zcXG1o0onT5dAqm/6YjSlVD7C+Ol8pzQMomJKcWLL/jrCEUp
    # rQXPV9ibD5bCtO47MY3ZS3aW3pqOhXOeKUFer1+YHWRRyi9Y6kEx0d2No3MSGo18
    # S5A6zPwqduQvZPBPVualmtdIrpTasxhUdNfbqBW31pxYpCNg1wqIiwKoLcD5NJeX
    # epVhaUi/7TwqljrK7SGXmmfDWiTHIXDtvPrJQcSYGgqpVNFzRuq6jTXRJObeWen0
    # DhOHqC0Z6OkZ2gU+eso/VRbcbawQNQohUHQzZ7c0643TxncPDKG82/MDRe2MTJnq
    # /z+jpw==
    # =Z8UY
    # -----END PGP SIGNATURE-----
    # gpg: Signature made Mon 31 Jul 2023 02:00:53 PM PDT
    # gpg:                using RSA key 7A481E78868B4DB6A85A05C064DF38E8AF7E215F
    # gpg:                issuer "richard.henderson@linaro.org"
    # gpg: Good signature from "Richard Henderson <richard.henderson@linaro.org>" [ultimate]
    
    * tag 'pull-tcg-20230731' of https://gitlab.com/rth7680/qemu:
      target/s390x: Move trans_exc_code update to do_program_interrupt
      linux-user/armeb: Fix __kernel_cmpxchg() for armeb
      target/ppc: Disable goto_tb with architectural singlestep
      bsd-user: Specify host page alignment if none specified
      bsd-user: Allocate guest virtual address space
      accel/tcg: Clear tcg_ctx->gen_tb on buffer overflow
      util/interval-tree: Use qatomic_read/set for rb_parent_color
      util/interval-tree: Introduce pc_parent
      util/interval-tree: Use qatomic_set_mb in rb_link_node
      util/interval-tree: Use qatomic_read for left/right while searching
    
    Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
    rth7680 committed Jul 31, 2023
    Copy the full SHA
    8023418 View commit details
    Browse the repository at this point in the history