1. 16 6月, 2018 5 次提交
    • E
      tcg: track TBs with per-region BST's · be2cdc5e
      Emilio G. Cota 提交于
      This paves the way for enabling scalable parallel generation of TCG code.
      
      Instead of tracking TBs with a single binary search tree (BST), use a
      BST for each TCG region, protecting it with a lock. This is as scalable
      as it gets, since each TCG thread operates on a separate region.
      
      The core of this change is the introduction of struct tcg_region_tree,
      which contains a pointer to a GTree and an associated lock to serialize
      accesses to it. We then allocate an array of tcg_region_tree's, adding
      the appropriate padding to avoid false sharing based on
      qemu_dcache_linesize.
      
      Given a tc_ptr, we first find the corresponding region_tree. This
      is done by special-casing the first and last regions first, since they
      might be of size != region.size; otherwise we just divide the offset
      by region.stride. I was worried about this division (several dozen
      cycles of latency), but profiling shows that this is not a fast path.
      Note that region.stride is not required to be a power of two; it
      is only required to be a multiple of the host's page size.
      
      Note that with this design we can also provide consistent snapshots
      about all region trees at once; for instance, tcg_tb_foreach
      acquires/releases all region_tree locks before/after iterating over them.
      For this reason we now drop tb_lock in dump_exec_info().
      
      As an alternative I considered implementing a concurrent BST, but this
      can be tricky to get right, offers no consistent snapshots of the BST,
      and performance and scalability-wise I don't think it could ever beat
      having separate GTrees, given that our workload is insert-mostly (all
      concurrent BST designs I've seen focus, understandably, on making
      lookups fast, which comes at the expense of convoluted, non-wait-free
      insertions/removals).
      Reviewed-by: NRichard Henderson <richard.henderson@linaro.org>
      Reviewed-by: NAlex Bennée <alex.bennee@linaro.org>
      Signed-off-by: NEmilio G. Cota <cota@braap.org>
      Signed-off-by: NRichard Henderson <richard.henderson@linaro.org>
      be2cdc5e
    • E
      qht: return existing entry when qht_insert fails · 32359d52
      Emilio G. Cota 提交于
      The meaning of "existing" is now changed to "matches in hash and
      ht->cmp result". This is saner than just checking the pointer value.
      Suggested-by: NRichard Henderson <richard.henderson@linaro.org>
      Reviewed-by: NRichard Henderson <richard.henderson@linaro.org>
      Reviewed-by: NAlex Bennée <alex.bennee@linaro.org>
      Signed-off-by: NEmilio G. Cota <cota@braap.org>
      Signed-off-by: NRichard Henderson <richard.henderson@linaro.org>
      32359d52
    • E
      qht: require a default comparison function · 61b8cef1
      Emilio G. Cota 提交于
      qht_lookup now uses the default cmp function. qht_lookup_custom is defined
      to retain the old behaviour, that is a cmp function is explicitly provided.
      
      qht_insert will gain use of the default cmp in the next patch.
      
      Note that we move qht_lookup_custom's @func to be the last argument,
      which makes the new qht_lookup as simple as possible.
      Instead of this (i.e. keeping @func 2nd):
      0000000000010750 <qht_lookup>:
         10750:       89 d1                   mov    %edx,%ecx
         10752:       48 89 f2                mov    %rsi,%rdx
         10755:       48 8b 77 08             mov    0x8(%rdi),%rsi
         10759:       e9 22 ff ff ff          jmpq   10680 <qht_lookup_custom>
         1075e:       66 90                   xchg   %ax,%ax
      
      We get:
      0000000000010740 <qht_lookup>:
         10740:       48 8b 4f 08             mov    0x8(%rdi),%rcx
         10744:       e9 37 ff ff ff          jmpq   10680 <qht_lookup_custom>
         10749:       0f 1f 80 00 00 00 00    nopl   0x0(%rax)
      Reviewed-by: NRichard Henderson <richard.henderson@linaro.org>
      Reviewed-by: NAlex Bennée <alex.bennee@linaro.org>
      Signed-off-by: NEmilio G. Cota <cota@braap.org>
      Signed-off-by: NRichard Henderson <richard.henderson@linaro.org>
      61b8cef1
    • J
      tcg/i386: Use byte form of xgetbv instruction · 1019242a
      John Arbuckle 提交于
      The assembler in most versions of Mac OS X is pretty old and does not
      support the xgetbv instruction.  To go around this problem, the raw
      encoding of the instruction is used instead.
      Signed-off-by: NJohn Arbuckle <programmingkidx@gmail.com>
      Message-Id: <20180604215102.11002-1-programmingkidx@gmail.com>
      Signed-off-by: NRichard Henderson <richard.henderson@linaro.org>
      1019242a
    • P
      Merge remote-tracking branch... · 42747d6a
      Peter Maydell 提交于
      Merge remote-tracking branch 'remotes/edgar/tags/edgar/xilinx-next-2018-06-15.for-upstream' into staging
      
      xilinx-next-2018-06-15.for-upstream
      
      # gpg: Signature made Fri 15 Jun 2018 15:32:47 BST
      # gpg:                using RSA key 29C596780F6BCA83
      # gpg: Good signature from "Edgar E. Iglesias (Xilinx key) <edgar.iglesias@xilinx.com>"
      # gpg:                 aka "Edgar E. Iglesias <edgar.iglesias@gmail.com>"
      # Primary key fingerprint: AC44 FEDC 14F7 F1EB EDBF  4151 29C5 9678 0F6B CA83
      
      * remotes/edgar/tags/edgar/xilinx-next-2018-06-15.for-upstream:
        target-microblaze: Rework NOP/zero instruction handling
        target-microblaze: mmu: Correct masking of output addresses
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      42747d6a
  2. 15 6月, 2018 35 次提交