Dynamic TLB sizing, backends
cover Dynamic TLB sizing, backends
This is Emilio's v7 unchanged, plus all of the backends updated. Finally, remove the static tlb sizing so that we only support the one code path.
I have tested all of these, though riscv, s390 and mips were done under qemu emulation itself.
I'll leave some time for comment, but otherwise will include these in my next tcg pull request.
r~
Emilio G. Cota (3):
cputlb: do not evict empty entries to the vtlb
tcg: introduce dynamic TLB sizing
tcg/i386: enable dynamic TLB sizing
Richard Henderson (10):
tcg/aarch64: enable dynamic TLB sizing
tcg/ppc: enable dynamic TLB sizing
tcg/sparc: enable dynamic TLB sizing
tcg/s390: enable dynamic TLB sizing
tcg/riscv: enable dynamic TLB sizing
tcg/arm: enable dynamic TLB sizing
tcg/mips: Fix tcg_out_qemu_ld_slow_path
tcg/mips: enable dynamic TLB sizing
tcg/tci: enable dynamic TLB sizing
cputlb: Remove static tlb sizing
include/exec/cpu-defs.h | 71 +++++++------ include/exec/cpu_ldst.h | 9 +- accel/tcg/cputlb.c | 192 +++++++++++++++++++++++++++++++++-- tcg/aarch64/tcg-target.inc.c | 100 ++++++++++-------- tcg/arm/tcg-target.inc.c | 143 +++++++++++++------------- tcg/i386/tcg-target.inc.c | 28 ++--- tcg/mips/tcg-target.inc.c | 97 ++++++++++++------ tcg/ppc/tcg-target.inc.c | 91 +++++++++-------- tcg/riscv/tcg-target.inc.c | 126 ++++++++++------------- tcg/s390/tcg-target.inc.c | 45 ++++---- tcg/sparc/tcg-target.inc.c | 82 +++++++++------ 11 files changed, 617 insertions(+), 367 deletions(-)
Signature · 1 line
2.17.2
PATCH 1/13 cputlb: do not evict empty entries to the vtlb
From: "Emilio G. Cota" <[email protected]>
Currently we evict an entry to the victim TLB when it doesn't match the current address. But it could be that there's no match because the current entry is empty (i.e. all -1's, for instance via tlb_flush). Do not evict the entry to the vtlb in that case.
This change will help us keep track of the TLB's use rate, which we'll use to implement a policy for dynamic TLB sizing.
Message-Id: <[email protected]>
--- accel/tcg/cputlb.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
accel/tcg/cputlb.c +10 -1
@@ -224,6 +224,15 @@ static inline bool tlb_hit_page_anyprot(CPUTLBEntry *tlb_entry,tlb_hit_page (tlb_entry->addr_code, page); } +/** +* tlb_entry_is_empty - return true if the entry is not in use +* @te: pointer to CPUTLBEntry +*/ +static inline bool tlb_entry_is_empty (const CPUTLBEntry *te) +{ +return te->addr_read ==-1 && te->addr_write ==-1 && te->addr_code ==-1 ; +} +/* Called with tlb_c.lock held */ static inline void tlb_flush_entry_locked (CPUTLBEntry *tlb_entry,target_ulong page)
@@ -591,7 +600,7 @@ void tlb_set_page_with_attrs(CPUState *cpu, target_ulong vaddr,* Only evict the old entry to the victim tlb if it's for a * different page; otherwise just overwrite the stale data. */ -if (!tlb_hit_page_anyprot (te, vaddr_page)) { +if (!tlb_hit_page_anyprot (te, vaddr_page) && !tlb_entry_is_empty (te)) {unsigned vidx = env->tlb_d[mmu_idx].vindex++ %CPU_VTLB_SIZE ;CPUTLBEntry *tv = &env->tlb_v_table[mmu_idx][vidx];
Signature · 1 line
2.17.2
PATCH 2/13 tcg: introduce dynamic TLB sizing
In reply to Richard HendersonFrom: "Emilio G. Cota" <[email protected]>
Disabled in all TCG backends for now.
Message-Id: <[email protected]>
--- include/exec/cpu-defs.h | 57 ++++++++++- include/exec/cpu_ldst.h | 21 ++++ tcg/aarch64/tcg-target.h | 1 + tcg/arm/tcg-target.h | 1 + tcg/i386/tcg-target.h | 1 + tcg/mips/tcg-target.h | 1 + tcg/ppc/tcg-target.h | 1 + tcg/riscv/tcg-target.h | 1 + tcg/s390/tcg-target.h | 1 + tcg/sparc/tcg-target.h | 1 + tcg/tci/tcg-target.h | 1 + accel/tcg/cputlb.c | 202 ++++++++++++++++++++++++++++++++++++++- 12 files changed, 282 insertions(+), 7 deletions(-)
include/exec/cpu-defs.h +55 -2
@@ -67,6 +67,28 @@ typedef uint64_t target_ulong;#define CPU_TLB_ENTRY_BITS 5#endif +#if TCG_TARGET_IMPLEMENTS_DYN_TLB +#define CPU_TLB_DYN_MIN_BITS 6 +#define CPU_TLB_DYN_DEFAULT_BITS 8 + + +# if HOST_LONG_BITS ==32 +/* Make sure we do not require a double-word shift for the TLB load */ +# define CPU_TLB_DYN_MAX_BITS (32 - TARGET_PAGE_BITS) +# else /* HOST_LONG_BITS == 64 */ +/* +* Assuming TARGET_PAGE_BITS==12, with 2**22 entries we can cover 2**(22+12) == +* 2**34 == 16G of address space. This is roughly what one would expect a +* TLB to cover in a modern (as of 2018) x86_64 CPU. For instance, Intel +* Skylake's Level-2 STLB has 16 1G entries. +* Also, make sure we do not size the TLB past the guest's address space. +*/ +# define CPU_TLB_DYN_MAX_BITS \ + MIN(22, TARGET_VIRT_ADDR_SPACE_BITS - TARGET_PAGE_BITS) +# endif + +#else /* !TCG_TARGET_IMPLEMENTS_DYN_TLB */ +/* TCG_TARGET_TLB_DISPLACEMENT_BITS is used in CPU_TLB_BITS to ensure that * the TLB is not unnecessarily small, but still small enough for the * TLB lookup instruction sequence used by the TCG target.
@@ -98,6 +120,7 @@ typedef uint64_t target_ulong; NB_MMU_MODES <= 8 ? 3 : 4))#define CPU_TLB_SIZE (1 << CPU_TLB_BITS) +#endif /* TCG_TARGET_IMPLEMENTS_DYN_TLB */ typedef struct CPUTLBEntry { /* bit TARGET_LONG_BITS to TARGET_PAGE_BITS : virtual address
@@ -141,6 +164,18 @@ typedef struct CPUIOTLBEntry {MemTxAttrs attrs; } CPUIOTLBEntry; +/** +* struct CPUTLBWindow +* @begin_ns: host time (in ns) at the beginning of the time window +* @max_entries: maximum number of entries observed in the window +* +* See also: tlb_mmu_resize_locked() +*/ +typedef struct CPUTLBWindow { +int64_t begin_ns; +size_t max_entries; +}CPUTLBWindow ; + typedef struct CPUTLBDesc { /* * Describe a region covering all of the large pages allocated
@@ -152,6 +187,10 @@ typedef struct CPUTLBDesc {target_ulong large_page_mask;/* The next index to use in the tlb victim table. */ size_t vindex; +#if TCG_TARGET_IMPLEMENTS_DYN_TLB +CPUTLBWindow window; +size_t n_used_entries; +#endif } CPUTLBDesc;/*
@@ -176,6 +215,20 @@ typedef struct CPUTLBCommon {size_t elide_flush_count; } CPUTLBCommon; +#if TCG_TARGET_IMPLEMENTS_DYN_TLB +# define CPU_TLB \ +/* tlb_mask[i] contains (n_entries - 1) << CPU_TLB_ENTRY_BITS */ \ + uintptr_t tlb_mask[NB_MMU_MODES]; \ + CPUTLBEntry *tlb_table[NB_MMU_MODES]; +# define CPU_IOTLB \ + CPUIOTLBEntry *iotlb[NB_MMU_MODES]; +#else +# define CPU_TLB \ + CPUTLBEntry tlb_table[NB_MMU_MODES][CPU_TLB_SIZE]; +# define CPU_IOTLB \ + CPUIOTLBEntry iotlb[NB_MMU_MODES][CPU_TLB_SIZE]; +#endif +/* * The meaning of each of the MMU modes is defined in the target code. * Note that NB_MMU_MODES is not yet defined; we can only reference it
@@ -184,9 +237,9 @@ typedef struct CPUTLBCommon {#define CPU_COMMON_TLB \ CPUTLBCommon tlb_c; \ CPUTLBDesc tlb_d[NB_MMU_MODES]; \ - CPUTLBEntry tlb_table[NB_MMU_MODES][CPU_TLB_SIZE]; \ + CPU_TLB \ CPUTLBEntry tlb_v_table[NB_MMU_MODES][CPU_VTLB_SIZE]; \ - CPUIOTLBEntry iotlb[NB_MMU_MODES][CPU_TLB_SIZE]; \ + CPU_IOTLB \ CPUIOTLBEntry iotlb_v[NB_MMU_MODES][CPU_VTLB_SIZE];#else
include/exec/cpu_ldst.h +21 -0
@@ -135,6 +135,21 @@ static inline target_ulong tlb_addr_write(const CPUTLBEntry *entry)#endif } +#if TCG_TARGET_IMPLEMENTS_DYN_TLB +/* Find the TLB index corresponding to the mmu_idx + address pair. */ +static inline uintptr_t tlb_index (CPUArchState *env,uintptr_t mmu_idx, +target_ulong addr) +{ +uintptr_t size_mask = env->tlb_mask[mmu_idx] >>CPU_TLB_ENTRY_BITS ; + +return (addr >>TARGET_PAGE_BITS ) & size_mask; +} + +static inline size_t tlb_n_entries (CPUArchState *env,uintptr_t mmu_idx) +{ +return (env->tlb_mask[mmu_idx] >>CPU_TLB_ENTRY_BITS ) +1 ; +} +#else /* Find the TLB index corresponding to the mmu_idx + address pair. */ static inline uintptr_t tlb_index (CPUArchState *env,uintptr_t mmu_idx,target_ulong addr)
@@ -142,6 +157,12 @@ static inline uintptr_t tlb_index(CPUArchState *env, uintptr_t mmu_idx, return (addr >> TARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1); } +static inline size_t tlb_n_entries (CPUArchState *env,uintptr_t mmu_idx) +{ +return CPU_TLB_SIZE ; +} +#endif /* TCG_TARGET_IMPLEMENTS_DYN_TLB */ +/* Find the TLB entry corresponding to the mmu_idx + address pair. */ static inline CPUTLBEntry *tlb_entry (CPUArchState *env,uintptr_t mmu_idx,target_ulong addr)
tcg/aarch64/tcg-target.h +1 -0
@@ -15,6 +15,7 @@#define TCG_TARGET_INSN_UNIT_SIZE 4#define TCG_TARGET_TLB_DISPLACEMENT_BITS 24 +#define TCG_TARGET_IMPLEMENTS_DYN_TLB 0#undef TCG_TARGET_STACK_GROWSUP typedef enum {
tcg/arm/tcg-target.h +1 -0
@@ -60,6 +60,7 @@ extern int arm_arch;#undef TCG_TARGET_STACK_GROWSUP#define TCG_TARGET_INSN_UNIT_SIZE 4#define TCG_TARGET_TLB_DISPLACEMENT_BITS 16 +#define TCG_TARGET_IMPLEMENTS_DYN_TLB 0 typedef enum { TCG_REG_R0 = 0,
tcg/i386/tcg-target.h +1 -0
@@ -27,6 +27,7 @@#define TCG_TARGET_INSN_UNIT_SIZE 1#define TCG_TARGET_TLB_DISPLACEMENT_BITS 31 +#define TCG_TARGET_IMPLEMENTS_DYN_TLB 0#ifdef __x86_64__# define TCG_TARGET_REG_BITS 64
tcg/mips/tcg-target.h +1 -0
@@ -37,6 +37,7 @@#define TCG_TARGET_INSN_UNIT_SIZE 4#define TCG_TARGET_TLB_DISPLACEMENT_BITS 16 +#define TCG_TARGET_IMPLEMENTS_DYN_TLB 0#define TCG_TARGET_NB_REGS 32 typedef enum {
tcg/ppc/tcg-target.h +1 -0
@@ -34,6 +34,7 @@#define TCG_TARGET_NB_REGS 32#define TCG_TARGET_INSN_UNIT_SIZE 4#define TCG_TARGET_TLB_DISPLACEMENT_BITS 16 +#define TCG_TARGET_IMPLEMENTS_DYN_TLB 0 typedef enum { TCG_REG_R0, TCG_REG_R1, TCG_REG_R2, TCG_REG_R3,
tcg/riscv/tcg-target.h +1 -0
@@ -33,6 +33,7 @@#define TCG_TARGET_INSN_UNIT_SIZE 4#define TCG_TARGET_TLB_DISPLACEMENT_BITS 20 +#define TCG_TARGET_IMPLEMENTS_DYN_TLB 0#define TCG_TARGET_NB_REGS 32 typedef enum {
tcg/s390/tcg-target.h +1 -0
@@ -27,6 +27,7 @@#define TCG_TARGET_INSN_UNIT_SIZE 2#define TCG_TARGET_TLB_DISPLACEMENT_BITS 19 +#define TCG_TARGET_IMPLEMENTS_DYN_TLB 0 typedef enum TCGReg { TCG_REG_R0 = 0,
tcg/sparc/tcg-target.h +1 -0
@@ -29,6 +29,7 @@#define TCG_TARGET_INSN_UNIT_SIZE 4#define TCG_TARGET_TLB_DISPLACEMENT_BITS 32 +#define TCG_TARGET_IMPLEMENTS_DYN_TLB 0#define TCG_TARGET_NB_REGS 32 typedef enum {
tcg/tci/tcg-target.h +1 -0
@@ -43,6 +43,7 @@#define TCG_TARGET_INTERPRETER 1#define TCG_TARGET_INSN_UNIT_SIZE 1#define TCG_TARGET_TLB_DISPLACEMENT_BITS 32 +#define TCG_TARGET_IMPLEMENTS_DYN_TLB 0#if UINTPTR_MAX ==UINT32_MAX # define TCG_TARGET_REG_BITS 32
accel/tcg/cputlb.c +197 -5
262 lines not on this page · raw message
Signature · 1 line
2.17.2
PATCH 3/13 tcg/i386: enable dynamic TLB sizing
In reply to Richard HendersonFrom: "Emilio G. Cota" <[email protected]>
As the following experiments show, this series is a net perf gain, particularly for memory-heavy workloads. Experiments are run on an Intel(R) Xeon(R) Gold 6142 CPU @ 2.60GHz.
1. System boot + shudown, debian aarch64:
- Before (v3.1.0):
Performance counter stats for './die.sh v3.1.0' (10 runs):
9019.797015 task-clock (msec) # 0.993 CPUs utilized ( +- 0.23% )
29,910,312,379 cycles # 3.316 GHz ( +- 0.14% )
54,699,252,014 instructions # 1.83 insn per cycle ( +- 0.08% )
10,061,951,686 branches # 1115.541 M/sec ( +- 0.08% )
172,966,530 branch-misses # 1.72% of all branches ( +- 0.07% )9.084039051 seconds time elapsed ( +- 0.23% )
- After:
Performance counter stats for './die.sh tlb-dyn-v5' (10 runs):
8624.084842 task-clock (msec) # 0.993 CPUs utilized ( +- 0.23% )
28,556,123,404 cycles # 3.311 GHz ( +- 0.13% )
51,755,089,512 instructions # 1.81 insn per cycle ( +- 0.05% )
9,526,513,946 branches # 1104.641 M/sec ( +- 0.05% )
166,578,509 branch-misses # 1.75% of all branches ( +- 0.19% )8.680540350 seconds time elapsed ( +- 0.24% )
That is, a 4.4% perf increase.
2. System boot + shutdown, ubuntu 18.04 x86_64:
- Before (v3.1.0):
56100.574751 task-clock (msec) # 1.016 CPUs utilized ( +- 4.81% )
200,745,466,128 cycles # 3.578 GHz ( +- 5.24% )
431,949,100,608 instructions # 2.15 insn per cycle ( +- 5.65% )
77,502,383,330 branches # 1381.490 M/sec ( +- 6.18% )
844,681,191 branch-misses # 1.09% of all branches ( +- 3.82% )55.221556378 seconds time elapsed ( +- 5.01% )
- After:
56603.419540 task-clock (msec) # 1.019 CPUs utilized ( +- 10.19% )
202,217,930,479 cycles # 3.573 GHz ( +- 10.69% )
439,336,291,626 instructions # 2.17 insn per cycle ( +- 14.14% )
80,538,357,447 branches # 1422.853 M/sec ( +- 16.09% )
776,321,622 branch-misses # 0.96% of all branches ( +- 3.77% )55.549661409 seconds time elapsed ( +- 10.44% )
No improvement (within noise range). Note that for this workload, increasing the time window too much can lead to perf degradation, since it flushes the TLB *very* frequently.
3. x86_64 SPEC06int:
x86_64-softmmu speedup vs. v3.1.0 for SPEC06int (test set)
Host: Intel(R) Xeon(R) Gold 6142 CPU @ 2.60GHz (Skylake)5.5 +------------------------------------------------------------------------+
| +-+ |
5 |-+.................+-+...............................tlb-dyn-v5.......+-|
| * * |
4.5 |-+.................*.*................................................+-|
| * * |
4 |-+.................*.*................................................+-|
| * * |
3.5 |-+.................*.*................................................+-|
| * * |
3 |-+......+-+*.......*.*................................................+-|
| * * * * |
2.5 |-+......*..*.......*.*.................................+-+*...........+-|
| * * * * * * |
2 |-+......*..*.......*.*.................................*..*...........+-|
| * * * * * * +-+ |
1.5 |-+......*..*.......*.*.................................*..*.*+-+.*+-+.+-|
| * * *+-+ * * +-+ *+-+ +-+ +-+ * * * * * * |
1 |++++-+*+*++*+*++*++*+*++*+*+++-+*+*+-++*+-++++-++++-+++*++*+*++*+*++*+++|
| * * * * * * * * * * * * * * * * * * * * * * * * * * |0.5 +------------------------------------------------------------------------+
400.perlb401.bzip403.g429445.g456.hm462.libq464.h471.omn47483.xalancbgeomean
png: https://imgur.com/YRF90f7
That is, a 1.51x average speedup over the baseline, with a max speedup of 5.17x.
Here's a different look at the SPEC06int results, using KVM as the baseline:
x86_64-softmmu slowdown vs. KVM for SPEC06int (test set)
Host: Intel(R) Xeon(R) Gold 6142 CPU @ 2.60GHz (Skylake)
25 +---------------------------------------------------------------------------+
| +-+ +-+ | | * * +-+ v3.1.0 | | * * +-+ tlb-dyn-v5 | | * * * * +-+ | 20 |-+.................*.*.............................*.+-+......*.*........+-| | * * * # # * * | | +-+ * * * # # * * | | * * * * * # # * * | 15 |-+......*.*........*.*.............................*.#.#......*.+-+......+-| | * * * * * # # * #|# | | * * * * +-+ * # # * +-+ | | * * +-+ * * ++-+ +-+ * # # * # # +-+ | | * * +-+ * * * ## *| +-+ * # # * # # +-+ | 10 |-+......*.*..*.+-+.*.*........*.##.......++-+.*.+-+*.#.#......*.#.#.*.*..+-| | * * * +-+ * * * ## +-+ *# # * # #* # # +-+ * # # * * | | * * * # # * * +-+ * ## * +-+ *# # * # #* # # * * * # # *+-+ | | * * * # # * * * +-+ * ## * # # *# # * # #* # # * * * # # * ## | 5 |-+......*.+-+*.#.#.*.*..*.#.#.*.##.*.#.#.*#.#.*.#.#*.#.#.*.*..*.#.#.*.##.+-| | * # #* # # * +-+* # # * ## * # # *# # * # #* # # * * * # # * ## | | * # #* # # * # #* # # * ## * # # *# # * # #* # # * +-+* # # * ## | | ++-+ * # #* # # * # #* # # * ## * # # *# # * # #* # # * # #* # # * ## | |+++*#+#+*+#+#*+#+#+*+#+#*+#+#+*+##+*+#+#+*#+#+*+#+#*+#+#+*+#+#*+#+#+*+##+++|
0 +---------------------------------------------------------------------------+ 400.perlbe401.bzi403.gc429445.go456.h462.libqu464.h471.omne4483.xalancbmgeomean
png: https://imgur.com/YzAMNEV
After this series, we bring down the average SPEC06int slowdown vs KVM from 11.47x to 7.58x.
Message-Id: <[email protected]>
--- tcg/i386/tcg-target.h | 2 +- tcg/i386/tcg-target.inc.c | 28 ++++++++++++++-------------- 2 files changed, 15 insertions(+), 15 deletions(-)
tcg/i386/tcg-target.h +1 -1
@@ -27,7 +27,7 @@#define TCG_TARGET_INSN_UNIT_SIZE 1#define TCG_TARGET_TLB_DISPLACEMENT_BITS 31 -#define TCG_TARGET_IMPLEMENTS_DYN_TLB 0 +#define TCG_TARGET_IMPLEMENTS_DYN_TLB 1#ifdef __x86_64__# define TCG_TARGET_REG_BITS 64
tcg/i386/tcg-target.inc.c +14 -14
@@ -329,6 +329,7 @@ static inline int tcg_target_const_match(tcg_target_long val, TCGType type,#define OPC_ARITH_GvEv (0x03)/* ... plus (ARITH_FOO << 3) */ #define OPC_ANDN (0xf2 | P_EXT38)#define OPC_ADD_GvEv (OPC_ARITH_GvEv | (ARITH_ADD << 3)) +#define OPC_AND_GvEv (OPC_ARITH_GvEv | (ARITH_AND << 3))#define OPC_BLENDPS (0x0c | P_EXT3A | P_DATA16)#define OPC_BSF (0xbc | P_EXT)#define OPC_BSR (0xbd | P_EXT)
@@ -1641,7 +1642,7 @@ static inline void tcg_out_tlb_load(TCGContext *s, TCGReg addrlo, TCGReg addrhi, }if (TCG_TYPE_PTR ==TCG_TYPE_I64 ) { hrexw =P_REXW ; -if (TARGET_PAGE_BITS +CPU_TLB_BITS >32 ) { +if (TARGET_PAGE_BITS +CPU_TLB_DYN_MAX_BITS >32 ) { tlbtype =TCG_TYPE_I64 ; tlbrexw =P_REXW ; }
@@ -1649,6 +1650,15 @@ static inline void tcg_out_tlb_load(TCGContext *s, TCGReg addrlo, TCGReg addrhi, }tcg_out_mov (s, tlbtype, r0, addrlo); +tcg_out_shifti (s,SHIFT_SHR + tlbrexw, r0, +TARGET_PAGE_BITS -CPU_TLB_ENTRY_BITS ); + +tcg_out_modrm_offset (s, OPC_AND_GvEv + trexw, r0,TCG_AREG0 , + offsetof(CPUArchState, tlb_mask[mem_index])); + +tcg_out_modrm_offset (s, OPC_ADD_GvEv + hrexw, r0,TCG_AREG0 , + offsetof(CPUArchState, tlb_table[mem_index])); +/* If the required alignment is at least as large as the access, simply copy the address and mask. For lesser alignments, check that we don't cross pages for the complete access. */
@@ -1658,20 +1668,10 @@ static inline void tcg_out_tlb_load(TCGContext *s, TCGReg addrlo, TCGReg addrhi,tcg_out_modrm_offset (s,OPC_LEA + trexw, r1, addrlo, s_mask - a_mask); } tlb_mask = (target_ulong )TARGET_PAGE_MASK | a_mask; - -tcg_out_shifti (s,SHIFT_SHR + tlbrexw, r0, -TARGET_PAGE_BITS -CPU_TLB_ENTRY_BITS ); -tgen_arithi (s,ARITH_AND + trexw, r1, tlb_mask,0 ); -tgen_arithi (s,ARITH_AND + tlbrexw, r0, - (CPU_TLB_SIZE -1 ) <<CPU_TLB_ENTRY_BITS ,0 ); - -tcg_out_modrm_sib_offset (s,OPC_LEA + hrexw, r0,TCG_AREG0 , r0,0 , - offsetof(CPUArchState, tlb_table[mem_index][0]) - + which);/* cmp 0(r0), r1 */ -tcg_out_modrm_offset (s, OPC_CMP_GvEv + trexw, r1, r0,0 ); +tcg_out_modrm_offset (s, OPC_CMP_GvEv + trexw, r1, r0, which);/* Prepare for both the fast path add of the tlb addend, and the slow path function argument setup. */
@@ -1684,7 +1684,7 @@ static inline void tcg_out_tlb_load(TCGContext *s, TCGReg addrlo, TCGReg addrhi,if (TARGET_LONG_BITS >TCG_TARGET_REG_BITS ) {/* cmp 4(r0), addrhi */ -tcg_out_modrm_offset (s, OPC_CMP_GvEv, addrhi, r0,4 ); +tcg_out_modrm_offset (s, OPC_CMP_GvEv, addrhi, r0, which +4 );/* jne slow_path */ tcg_out_opc (s, OPC_JCC_long +JCC_JNE ,0 ,0 ,0 );
@@ -1696,7 +1696,7 @@ static inline void tcg_out_tlb_load(TCGContext *s, TCGReg addrlo, TCGReg addrhi,/* add addend(r0), r1 */ tcg_out_modrm_offset (s, OPC_ADD_GvEv + hrexw, r1, r0, - offsetof(CPUTLBEntry , addend) - which); + offsetof(CPUTLBEntry , addend)); }/*
Signature · 1 line
2.17.2
PATCH 4/13 tcg/aarch64: enable dynamic TLB sizing
In reply to Richard Henderson--- tcg/aarch64/tcg-target.h | 2 +- tcg/aarch64/tcg-target.inc.c | 100 +++++++++++++++++++++-------------- 2 files changed, 60 insertions(+), 42 deletions(-)
tcg/aarch64/tcg-target.h +1 -1
@@ -15,7 +15,7 @@#define TCG_TARGET_INSN_UNIT_SIZE 4#define TCG_TARGET_TLB_DISPLACEMENT_BITS 24 -#define TCG_TARGET_IMPLEMENTS_DYN_TLB 0 +#define TCG_TARGET_IMPLEMENTS_DYN_TLB 1#undef TCG_TARGET_STACK_GROWSUP typedef enum {
tcg/aarch64/tcg-target.inc.c +59 -41
133 lines not on this page · raw message
Signature · 1 line
2.17.2
Re: [Qemu-devel] [PATCH 04/13] tcg/aarch64: enable dynamic TLB sizing
Quoted 60 lines · Richard Henderson
Signed-off-by Richard Henderson <[email protected]>--- tcg/aarch64/tcg-target.h | 2 +- tcg/aarch64/tcg-target.inc.c | 100 +++++++++++++++++++++-------------- 2 files changed, 60 insertions(+), 42 deletions(-)tcg/aarch64/tcg-target.h +1
-1@@ -15,7 +15,7 @@#define TCG_TARGET_INSN_UNIT_SIZE 4#define TCG_TARGET_TLB_DISPLACEMENT_BITS 24 -#define TCG_TARGET_IMPLEMENTS_DYN_TLB 0 +#define TCG_TARGET_IMPLEMENTS_DYN_TLB 1#undef TCG_TARGET_STACK_GROWSUP typedef enum {tcg/aarch64/tcg-target.inc.c +13
-3@@ -498,6 +498,9 @@ typedef enum {I3510_EON =0x4a200000 ,I3510_ANDS =0x6a000000 , +/* Logical shifted register instructions (with a shift). */ +I3502S_AND_LSR =I3510_AND | (1 <<22 ), +/* AdvSIMD copy */ I3605_DUP =0x0e000400 , I3605_INS = 0x4e001c00,@@ -1448,6 +1451,14 @@ static void add_qemu_ldst_label(TCGContext *s, bool is_ld, TCGMemOpIdx oi, label->label_ptr[0 ] = label_ptr; } +/* We expect tlb_mask to be before tlb_table. */ +QEMU_BUILD_BUG_ON (offsetof(CPUArchState , tlb_table) < + offsetof(CPUArchState , tlb_mask)); + +/* We expect to use a 24-bit unsigned offset from ENV. */ +QEMU_BUILD_BUG_ON (offsetof (CPUArchState ,tlb_table [NB_MMU_MODES -1 ]) + > 0xffffff); +/* Load and compare a TLB entry, emitting the conditional jump to the slow path for the failure case, which will be patched later when finalizing the slow path. Generated code returns the host addend in X1, @@ -1456,15 +1467,55 @@ static void tcg_out_tlb_read(TCGContext *s, TCGReg addr_reg, TCGMemOp opc, tcg_insn_unit **label_ptr, int mem_index, bool is_read) { - int tlb_offset = is_read ? - offsetof(CPUArchState, tlb_table[mem_index][0].addr_read) - : offsetof(CPUArchState, tlb_table[mem_index][0].addr_write); + int mask_ofs = offsetof(CPUArchState, tlb_mask[mem_index]); + int table_ofs = offsetof(CPUArchState, tlb_table[mem_index]);unsigned a_bits =get_alignment_bits (opc);unsigned s_bits = opc &MO_SIZE ;unsigned a_mask = (1u << a_bits) -1 ;
tcg/aarch64/tcg-target.inc.c static void tcg_out_tlb_read(TCGContext *s, TCGReg addr_reg, TCGMemOp opc, · line 1482
Quoted 10 lines
tcg/aarch64/tcg-target.inc.c +7
-2unsigned s_mask = (1u << s_bits) -1 ; -TCGReg base =TCG_AREG0 , x3; -uint64_t tlb_mask; +TCGReg mask_base =TCG_AREG0 , table_base =TCG_AREG0 , x3; +TCGType mask_type; +uint64_t compare_mask; + +if (table_ofs >0xfff ) { +int table_hi = table_ofs & ~0xfff ; +int mask_hi = mask_ofs & ~0xfff ;
Isn't there a #define for this number here?
Quoted 80 lines
tcg/aarch64/tcg-target.inc.c +37
-33+ + table_base =TCG_REG_X1 ; +if (mask_hi == table_hi) { + mask_base = table_base; + }else if (mask_hi) { + mask_base =TCG_REG_X0 ; +tcg_out_insn (s,3401 ,ADDI ,TCG_TYPE_I64 , + mask_base,TCG_AREG0 , mask_hi); + } +tcg_out_insn (s,3401 ,ADDI ,TCG_TYPE_I64 , + table_base,TCG_AREG0 , table_hi); + mask_ofs -= mask_hi; + table_ofs -= table_hi; + } + + mask_type = (TARGET_PAGE_BITS +CPU_TLB_DYN_MAX_BITS >32 + ?TCG_TYPE_I64 :TCG_TYPE_I32 ); + +/* Load tlb_mask[mmu_idx] and tlb_table[mmu_idx]. */ +tcg_out_ld (s, mask_type,TCG_REG_X0 , mask_base, mask_ofs); +tcg_out_ld (s,TCG_TYPE_PTR ,TCG_REG_X1 , table_base, table_ofs); + +/* Extract the TLB index from the address into X0. */ + tcg_out_insn(s, 3502S, AND_LSR, mask_type == TCG_TYPE_I64, +TCG_REG_X0 ,TCG_REG_X0 , addr_reg, +TARGET_PAGE_BITS -CPU_TLB_ENTRY_BITS ); + +/* Add the tlb_table pointer, creating the CPUTLBEntry address into X1. */ +tcg_out_insn (s,3502 ,ADD ,1 ,TCG_REG_X1 ,TCG_REG_X1 ,TCG_REG_X0 ); + +/* Load the tlb comparator into X0, and the fast path addend into X1. */ +tcg_out_ld (s,TCG_TYPE_TL ,TCG_REG_X0 ,TCG_REG_X1 , is_read + ? offsetof(CPUTLBEntry , addr_read) + : offsetof(CPUTLBEntry , addr_write)); +tcg_out_ld (s,TCG_TYPE_PTR ,TCG_REG_X1 ,TCG_REG_X1 , + offsetof(CPUTLBEntry , addend));/* For aligned accesses, we check the first byte and include the alignment bits within the address. For unaligned access, we check that we don't @@ -1476,47 +1527,14 @@ static void tcg_out_tlb_read(TCGContext *s, TCGReg addr_reg, TCGMemOp opc, TCG_REG_X3, addr_reg, s_mask - a_mask); x3 =TCG_REG_X3 ; } - tlb_mask = (uint64_t )TARGET_PAGE_MASK | a_mask; - -/* Extract the TLB index from the address into X0. -X0<CPU_TLB_BITS:0> = -addr_reg<TARGET_PAGE_BITS+CPU_TLB_BITS:TARGET_PAGE_BITS> */ -tcg_out_ubfm (s,TARGET_LONG_BITS ==64 ,TCG_REG_X0 , addr_reg, -TARGET_PAGE_BITS ,TARGET_PAGE_BITS +CPU_TLB_BITS ); + compare_mask = (uint64_t )TARGET_PAGE_MASK | a_mask;/* Store the page mask part of the address into X3. */ tcg_out_logicali(s, I3404_ANDI, TARGET_LONG_BITS == 64, -TCG_REG_X3 , x3, tlb_mask); - -/* Add any "high bits" from the tlb offset to the env address into X2, -to take advantage of the LSL12 form of the ADDI instruction. -X2 = env + (tlb_offset & 0xfff000) */ -if (tlb_offset &0xfff000 ) { -tcg_out_insn (s,3401 ,ADDI ,TCG_TYPE_I64 ,TCG_REG_X2 , base, - tlb_offset &0xfff000 ); - base =TCG_REG_X2 ; - } - -/* Merge the tlb index contribution into X2. -X2 = X2 + (X0 << CPU_TLB_ENTRY_BITS) */ - tcg_out_insn(s, 3502S, ADD_LSL, TCG_TYPE_I64, TCG_REG_X2, base, -TCG_REG_X0 ,CPU_TLB_ENTRY_BITS ); - -/* Merge "low bits" from tlb offset, load the tlb comparator into X0. -X0 = load [X2 + (tlb_offset & 0x000fff)] */ -tcg_out_ldst (s,TARGET_LONG_BITS ==32 ?I3312_LDRW :I3312_LDRX , -TCG_REG_X0 ,TCG_REG_X2 , tlb_offset &0xfff , -TARGET_LONG_BITS ==32 ?2 :3 ); - -/* Load the tlb addend. Do that early to avoid stalling. -X1 = load [X2 + (tlb_offset & 0xfff) + offsetof(addend)] */ - tcg_out_ldst(s, I3312_LDRX, TCG_REG_X1, TCG_REG_X2, - (tlb_offset & 0xfff) + (offsetof(CPUTLBEntry, addend)) -
tcg/aarch64/tcg-target.inc.c static void tcg_out_tlb_read(TCGContext *s, TCGReg addr_reg, TCGMemOp opc, · line 1540
Quoted 10 lines
tcg/aarch64/tcg-target.inc.c +2
-3- (is_read ? offsetof(CPUTLBEntry , addr_read) - : offsetof(CPUTLBEntry, addr_write)), 3); + TCG_REG_X3, x3, compare_mask);/* Perform the address comparison. */ -tcg_out_cmp (s, (TARGET_LONG_BITS ==64 ),TCG_REG_X0 ,TCG_REG_X3 ,0 ); +tcg_out_cmp (s,TARGET_LONG_BITS ==64 ,TCG_REG_X0 ,TCG_REG_X3 ,0 );/* If not equal, we jump to the slow path. */ *label_ptr = s->code_ptr;
Anyway:
(running s a very slow MTTCG s390x on my SynQuacer)
--
Alex Bennée
Re: [Qemu-devel] [PATCH 04/13] tcg/aarch64: enable dynamic TLB sizing
Quoted 5 lines · Alex Bennée
tcg/aarch64/tcg-target.inc.c static void tcg_out_tlb_read(TCGContext *s, TCGReg addr_reg, TCGMemOp opc, · line 1482
Quoted 3 lines
tcg/aarch64/tcg-target.inc.c +3
-0+if (table_ofs >0xfff ) { +int table_hi = table_ofs & ~0xfff ; +int mask_hi = mask_ofs & ~0xfff ;Isn't there a #define for this number here?
No. I don't know what I'd call it, either.
You're just Supposed to Know that arm memory offsets are 12 bits. ;-P
r~
PATCH 5/13 tcg/ppc: enable dynamic TLB sizing
In reply to Richard Henderson--- tcg/ppc/tcg-target.h | 2 +- tcg/ppc/tcg-target.inc.c | 91 ++++++++++++++++++++++------------------ 2 files changed, 52 insertions(+), 41 deletions(-)
tcg/ppc/tcg-target.h +1 -1
@@ -34,7 +34,7 @@#define TCG_TARGET_NB_REGS 32#define TCG_TARGET_INSN_UNIT_SIZE 4#define TCG_TARGET_TLB_DISPLACEMENT_BITS 16 -#define TCG_TARGET_IMPLEMENTS_DYN_TLB 0 +#define TCG_TARGET_IMPLEMENTS_DYN_TLB 1 typedef enum { TCG_REG_R0, TCG_REG_R1, TCG_REG_R2, TCG_REG_R3,
tcg/ppc/tcg-target.inc.c +51 -40
136 lines not on this page · raw message
Signature · 1 line
2.17.2
PATCH 6/13 tcg/sparc: enable dynamic TLB sizing
In reply to Richard Henderson--- tcg/sparc/tcg-target.h | 2 +- tcg/sparc/tcg-target.inc.c | 82 +++++++++++++++++++++++--------------- 2 files changed, 51 insertions(+), 33 deletions(-)
tcg/sparc/tcg-target.h +1 -1
@@ -29,7 +29,7 @@#define TCG_TARGET_INSN_UNIT_SIZE 4#define TCG_TARGET_TLB_DISPLACEMENT_BITS 32 -#define TCG_TARGET_IMPLEMENTS_DYN_TLB 0 +#define TCG_TARGET_IMPLEMENTS_DYN_TLB 1#define TCG_TARGET_NB_REGS 32 typedef enum {
tcg/sparc/tcg-target.inc.c +50 -32
104 lines not on this page · raw message
Signature · 1 line
2.17.2
PATCH 7/13 tcg/s390: enable dynamic TLB sizing
In reply to Richard Henderson--- tcg/s390/tcg-target.h | 2 +- tcg/s390/tcg-target.inc.c | 45 +++++++++++++++++---------------------- 2 files changed, 20 insertions(+), 27 deletions(-)
tcg/s390/tcg-target.h +1 -1
@@ -27,7 +27,7 @@#define TCG_TARGET_INSN_UNIT_SIZE 2#define TCG_TARGET_TLB_DISPLACEMENT_BITS 19 -#define TCG_TARGET_IMPLEMENTS_DYN_TLB 0 +#define TCG_TARGET_IMPLEMENTS_DYN_TLB 1 typedef enum TCGReg { TCG_REG_R0 = 0,
tcg/s390/tcg-target.inc.c +19 -26
77 lines not on this page · raw message
Signature · 1 line
2.17.2
PATCH 8/13 tcg/riscv: enable dynamic TLB sizing
In reply to Richard Henderson--- tcg/riscv/tcg-target.h | 2 +- tcg/riscv/tcg-target.inc.c | 126 ++++++++++++++++--------------------- 2 files changed, 56 insertions(+), 72 deletions(-)
tcg/riscv/tcg-target.h +1 -1
@@ -33,7 +33,7 @@#define TCG_TARGET_INSN_UNIT_SIZE 4#define TCG_TARGET_TLB_DISPLACEMENT_BITS 20 -#define TCG_TARGET_IMPLEMENTS_DYN_TLB 0 +#define TCG_TARGET_IMPLEMENTS_DYN_TLB 1#define TCG_TARGET_NB_REGS 32 typedef enum {
tcg/riscv/tcg-target.inc.c +55 -71
155 lines not on this page · raw message
Signature · 1 line
2.17.2
Re: [Qemu-devel] [PATCH 08/13] tcg/riscv: enable dynamic TLB sizing
Quoted 1 line · Richard Henderson
Signed-off-by Richard Henderson <[email protected]>
Alistair
Quoted 180 lines
--- tcg/riscv/tcg-target.h | 2 +- tcg/riscv/tcg-target.inc.c | 126 ++++++++++++++++--------------------- 2 files changed, 56 insertions(+), 72 deletions(-)tcg/riscv/tcg-target.h +1
-1@@ -33,7 +33,7 @@#define TCG_TARGET_INSN_UNIT_SIZE 4#define TCG_TARGET_TLB_DISPLACEMENT_BITS 20 -#define TCG_TARGET_IMPLEMENTS_DYN_TLB 0 +#define TCG_TARGET_IMPLEMENTS_DYN_TLB 1#define TCG_TARGET_NB_REGS 32 typedef enum {tcg/riscv/tcg-target.inc.c +55
-71@@ -958,6 +958,17 @@ static void * const qemu_st_helpers[16] = { [MO_BEQ ] = helper_be_stq_mmu, }; +/* We don't support oversize guests */ +QEMU_BUILD_BUG_ON (TCG_TARGET_REG_BITS <TARGET_LONG_BITS ); + +/* We expect tlb_mask to be before tlb_table. */ +QEMU_BUILD_BUG_ON (offsetof(CPUArchState , tlb_table) < + offsetof(CPUArchState , tlb_mask)); + +/* We expect tlb_mask to be "near" tlb_table. */ +QEMU_BUILD_BUG_ON (offsetof(CPUArchState , tlb_table) - + offsetof(CPUArchState , tlb_mask) >=0x800 ); +static void tcg_out_tlb_load (TCGContext *s,TCGReg addrl,TCGReg addrh,TCGMemOpIdx oi,tcg_insn_unit **label_ptr,bool is_load)@@ -965,94 +976,67 @@ static void tcg_out_tlb_load(TCGContext *s, TCGReg addrl,TCGMemOp opc =get_memop (oi);unsigned s_bits = opc &MO_SIZE ;unsigned a_bits =get_alignment_bits (opc); -target_ulong mask; +tcg_target_long compare_mask;int mem_index =get_mmuidx (oi); -int cmp_off - = (is_load - ? offsetof(CPUArchState, tlb_table[mem_index][0].addr_read) - : offsetof(CPUArchState, tlb_table[mem_index][0].addr_write)); - int add_off = offsetof(CPUArchState, tlb_table[mem_index][0].addend); -RISCVInsn load_cmp_op = (TARGET_LONG_BITS ==64 ?OPC_LD : -TCG_TARGET_REG_BITS ==64 ?OPC_LWU :OPC_LW ); -RISCVInsn load_add_op =TCG_TARGET_REG_BITS ==64 ?OPC_LD :OPC_LW ; -TCGReg base =TCG_AREG0 ; +int mask_off, table_off; +TCGReg mask_base =TCG_AREG0 , table_base =TCG_AREG0 ; -/* We don't support oversize guests */ -if (TCG_TARGET_REG_BITS <TARGET_LONG_BITS ) { -g_assert_not_reached (); + mask_off = offsetof(CPUArchState, tlb_mask[mem_index]); + table_off = offsetof(CPUArchState, tlb_table[mem_index]); +if (table_off >0x7ff ) { +int mask_hi = mask_off -sextreg (mask_off,0 ,12 ); +int table_hi = table_off -sextreg (table_off,0 ,12 ); + +if (likely (mask_hi == table_hi)) { + mask_base = table_base =TCG_REG_TMP1 ; +tcg_out_opc_upper (s,OPC_LUI , mask_base, mask_hi); +tcg_out_opc_reg (s,OPC_ADD , mask_base, mask_base,TCG_AREG0 ); + mask_off -= mask_hi; + table_off -= mask_hi; + }else { + mask_base =TCG_REG_TMP0 ; + table_base =TCG_REG_TMP1 ; +tcg_out_opc_upper (s,OPC_LUI , mask_base, mask_hi); +tcg_out_opc_reg (s,OPC_ADD , mask_base, mask_base,TCG_AREG0 ); + table_off -= mask_off; + mask_off -= mask_hi; +tcg_out_opc_imm (s,OPC_ADDI , table_base, mask_base, mask_off); + } } +tcg_out_ld (s,TCG_TYPE_PTR ,TCG_REG_TMP0 , mask_base, mask_off); +tcg_out_ld (s,TCG_TYPE_PTR ,TCG_REG_TMP1 , table_base, table_off); + +tcg_out_opc_imm (s,OPC_SRLI ,TCG_REG_TMP2 , addrl, +TARGET_PAGE_BITS -CPU_TLB_ENTRY_BITS ); +tcg_out_opc_reg (s,OPC_AND ,TCG_REG_TMP2 ,TCG_REG_TMP2 ,TCG_REG_TMP0 ); +tcg_out_opc_reg (s,OPC_ADD ,TCG_REG_TMP2 ,TCG_REG_TMP2 ,TCG_REG_TMP1 ); + +/* Load the tlb comparator and the addend. */ +tcg_out_ld (s,TCG_TYPE_TL ,TCG_REG_TMP0 ,TCG_REG_TMP2 , + is_load ? offsetof(CPUTLBEntry , addr_read) + : offsetof(CPUTLBEntry , addr_write)); +tcg_out_ld (s,TCG_TYPE_PTR ,TCG_REG_TMP2 ,TCG_REG_TMP2 , + offsetof(CPUTLBEntry , addend)); +/* We don't support unaligned accesses. */ if (a_bits < s_bits) { a_bits = s_bits; } - mask = (target_ulong )TARGET_PAGE_MASK | ((1 << a_bits) -1 ); - - -/* Compensate for very large offsets. */ -if (add_off >=0x1000 ) { -int adj; - base =TCG_REG_TMP2 ; -if (cmp_off <=2 *0xfff ) { - adj =0xfff ; -tcg_out_opc_imm (s,OPC_ADDI , base,TCG_AREG0 , adj); - }else { - adj = cmp_off -sextreg (cmp_off,0 ,12 ); -tcg_debug_assert (add_off - adj >=-0x1000 - && add_off - adj <0x1000 ); - -tcg_out_opc_upper (s,OPC_LUI , base, adj); -tcg_out_opc_reg (s,OPC_ADD , base, base,TCG_AREG0 ); - } - add_off -= adj; - cmp_off -= adj; - } - -/* Extract the page index. */ -if (CPU_TLB_BITS +CPU_TLB_ENTRY_BITS <12 ) { -tcg_out_opc_imm (s,OPC_SRLI ,TCG_REG_TMP0 , addrl, -TARGET_PAGE_BITS -CPU_TLB_ENTRY_BITS ); -tcg_out_opc_imm (s,OPC_ANDI ,TCG_REG_TMP0 ,TCG_REG_TMP0 , -MAKE_64BIT_MASK (CPU_TLB_ENTRY_BITS ,CPU_TLB_BITS )); - }else if (TARGET_PAGE_BITS >=12 ) { -tcg_out_opc_upper (s,OPC_LUI ,TCG_REG_TMP0 , -MAKE_64BIT_MASK (TARGET_PAGE_BITS ,CPU_TLB_BITS )); -tcg_out_opc_reg (s,OPC_AND ,TCG_REG_TMP0 ,TCG_REG_TMP0 , addrl); -tcg_out_opc_imm (s,OPC_SRLI ,TCG_REG_TMP0 ,TCG_REG_TMP0 , -CPU_TLB_BITS -CPU_TLB_ENTRY_BITS ); - }else { -tcg_out_opc_imm (s,OPC_SRLI ,TCG_REG_TMP0 , addrl,TARGET_PAGE_BITS ); -tcg_out_opc_imm (s,OPC_ANDI ,TCG_REG_TMP0 ,TCG_REG_TMP0 , -MAKE_64BIT_MASK (0 ,CPU_TLB_BITS )); -tcg_out_opc_imm (s,OPC_SLLI ,TCG_REG_TMP0 ,TCG_REG_TMP0 , -CPU_TLB_ENTRY_BITS ); - } - -/* Add that to the base address to index the tlb. */ -tcg_out_opc_reg (s,OPC_ADD ,TCG_REG_TMP2 , base,TCG_REG_TMP0 ); - base =TCG_REG_TMP2 ; - -/* Load the tlb comparator and the addend. */ -tcg_out_ldst (s, load_cmp_op,TCG_REG_TMP0 , base, cmp_off); -tcg_out_ldst (s, load_add_op,TCG_REG_TMP2 , base, add_off); -/* Clear the non-page, non-alignment bits from the address. */ -if (mask ==sextreg (mask,0 ,12 )) { -tcg_out_opc_imm (s,OPC_ANDI ,TCG_REG_TMP1 , addrl, mask); + compare_mask = (tcg_target_long )TARGET_PAGE_MASK | ((1 << a_bits) -1 ); +if (compare_mask ==sextreg (compare_mask,0 ,12 )) { +tcg_out_opc_imm (s,OPC_ANDI ,TCG_REG_TMP1 , addrl, compare_mask); }else { -tcg_out_movi (s,TCG_TYPE_REG ,TCG_REG_TMP1 , mask); +tcg_out_movi (s,TCG_TYPE_TL ,TCG_REG_TMP1 , compare_mask);tcg_out_opc_reg (s,OPC_AND ,TCG_REG_TMP1 ,TCG_REG_TMP1 , addrl); - } + }/* Compare masked address with the TLB entry. */ label_ptr[0 ] = s->code_ptr;tcg_out_opc_branch (s,OPC_BNE ,TCG_REG_TMP0 ,TCG_REG_TMP1 ,0 );/* NOP to allow patching later */ tcg_out_opc_imm (s,OPC_ADDI ,TCG_REG_ZERO ,TCG_REG_ZERO ,0 ); -/* TODO: Move this out of line -* see: -* https://lists.nongnu.org/archive/html/qemu-devel/2018-11/msg02234.html -*/ /* TLB Hit - translate address using addend. */ if (TCG_TARGET_REG_BITS >TARGET_LONG_BITS ) {
PATCH 9/13 tcg/arm: enable dynamic TLB sizing
In reply to Richard Henderson--- tcg/arm/tcg-target.h | 2 +- tcg/arm/tcg-target.inc.c | 143 +++++++++++++++++++-------------------- 2 files changed, 72 insertions(+), 73 deletions(-)
tcg/arm/tcg-target.h +1 -1
@@ -60,7 +60,7 @@ extern int arm_arch;#undef TCG_TARGET_STACK_GROWSUP#define TCG_TARGET_INSN_UNIT_SIZE 4#define TCG_TARGET_TLB_DISPLACEMENT_BITS 16 -#define TCG_TARGET_IMPLEMENTS_DYN_TLB 0 +#define TCG_TARGET_IMPLEMENTS_DYN_TLB 1 typedef enum { TCG_REG_R0 = 0,
tcg/arm/tcg-target.inc.c +71 -72
169 lines not on this page · raw message
Signature · 1 line
2.17.2
PATCH 10/13 tcg/mips: Fix tcg_out_qemu_ld_slow_path
In reply to Richard HendersonPatch the branch after it has been emitted rather
than before it exists.
--- tcg/mips/tcg-target.inc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tcg/mips/tcg-target.inc.c +2 -1
@@ -1343,8 +1343,9 @@ static void tcg_out_qemu_ld_slow_path(TCGContext *s, TCGLabelQemuLdst *l) } } -reloc_pc16 (s->code_ptr, l->raddr);tcg_out_opc_br (s,OPC_BEQ ,TCG_REG_ZERO ,TCG_REG_ZERO ); +reloc_pc16 (s->code_ptr -1 , l->raddr); +/* delay slot */ if (TCG_TARGET_REG_BITS ==64 && l->type ==TCG_TYPE_I32 ) {/* we always sign-extend 32-bit loads */
Signature · 1 line
2.17.2
PATCH 11/13 tcg/mips: enable dynamic TLB sizing
In reply to Richard Henderson--- tcg/mips/tcg-target.h | 2 +- tcg/mips/tcg-target.inc.c | 94 ++++++++++++++++++++++++++------------- 2 files changed, 64 insertions(+), 32 deletions(-)
tcg/mips/tcg-target.h +1 -1
@@ -37,7 +37,7 @@#define TCG_TARGET_INSN_UNIT_SIZE 4#define TCG_TARGET_TLB_DISPLACEMENT_BITS 16 -#define TCG_TARGET_IMPLEMENTS_DYN_TLB 0 +#define TCG_TARGET_IMPLEMENTS_DYN_TLB 1#define TCG_TARGET_NB_REGS 32 typedef enum {
tcg/mips/tcg-target.inc.c +63 -31
133 lines not on this page · raw message
Signature · 1 line
2.17.2
PATCH 12/13 tcg/tci: enable dynamic TLB sizing
In reply to Richard HendersonThis is automatic due to TCI using the other softtlb macros.
--- tcg/tci/tcg-target.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tcg/tci/tcg-target.h +1 -1
@@ -43,7 +43,7 @@#define TCG_TARGET_INTERPRETER 1#define TCG_TARGET_INSN_UNIT_SIZE 1#define TCG_TARGET_TLB_DISPLACEMENT_BITS 32 -#define TCG_TARGET_IMPLEMENTS_DYN_TLB 0 +#define TCG_TARGET_IMPLEMENTS_DYN_TLB 1#if UINTPTR_MAX ==UINT32_MAX # define TCG_TARGET_REG_BITS 32
Signature · 1 line
2.17.2
PATCH 13/13 cputlb: Remove static tlb sizing
In reply to Richard HendersonNow that all tcg backends support TCG_TARGET_IMPLEMENTS_DYN_TLB, remove the define and the old code.
--- include/exec/cpu-defs.h | 46 ---------------------------------------- include/exec/cpu_ldst.h | 14 ------------ tcg/aarch64/tcg-target.h | 1 - tcg/arm/tcg-target.h | 1 - tcg/i386/tcg-target.h | 1 - tcg/mips/tcg-target.h | 1 - tcg/ppc/tcg-target.h | 1 - tcg/riscv/tcg-target.h | 1 - tcg/s390/tcg-target.h | 1 - tcg/sparc/tcg-target.h | 1 - tcg/tci/tcg-target.h | 1 - accel/tcg/cputlb.c | 21 ------------------ 12 files changed, 90 deletions(-)
include/exec/cpu-defs.h +0 -46
@@ -67,11 +67,9 @@ typedef uint64_t target_ulong;#define CPU_TLB_ENTRY_BITS 5#endif -#if TCG_TARGET_IMPLEMENTS_DYN_TLB #define CPU_TLB_DYN_MIN_BITS 6#define CPU_TLB_DYN_DEFAULT_BITS 8 -# if HOST_LONG_BITS ==32 /* Make sure we do not require a double-word shift for the TLB load */ # define CPU_TLB_DYN_MAX_BITS (32 - TARGET_PAGE_BITS)
@@ -87,41 +85,6 @@ typedef uint64_t target_ulong; MIN(22, TARGET_VIRT_ADDR_SPACE_BITS - TARGET_PAGE_BITS)# endif -#else /* !TCG_TARGET_IMPLEMENTS_DYN_TLB */ - -/* TCG_TARGET_TLB_DISPLACEMENT_BITS is used in CPU_TLB_BITS to ensure that -* the TLB is not unnecessarily small, but still small enough for the -* TLB lookup instruction sequence used by the TCG target. -* -* TCG will have to generate an operand as large as the distance between -* env and the tlb_table[NB_MMU_MODES - 1][0].addend. For simplicity, -* the TCG targets just round everything up to the next power of two, and -* count bits. This works because: 1) the size of each TLB is a largish -* power of two, 2) and because the limit of the displacement is really close -* to a power of two, 3) the offset of tlb_table[0][0] inside env is smaller -* than the size of a TLB. -* -* For example, the maximum displacement 0xFFF0 on PPC and MIPS, but TCG -* just says "the displacement is 16 bits". TCG_TARGET_TLB_DISPLACEMENT_BITS -* then ensures that tlb_table at least 0x8000 bytes large ("not unnecessarily -* small": 2^15). The operand then will come up smaller than 0xFFF0 without -* any particular care, because the TLB for a single MMU mode is larger than -* 0x10000-0xFFF0=16 bytes. In the end, the maximum value of the operand -* could be something like 0xC000 (the offset of the last TLB table) plus -* 0x18 (the offset of the addend field in each TLB entry) plus the offset -* of tlb_table inside env (which is non-trivial but not huge). -*/ -#define CPU_TLB_BITS \ - MIN(8, \ - TCG_TARGET_TLB_DISPLACEMENT_BITS - CPU_TLB_ENTRY_BITS - \ - (NB_MMU_MODES <= 1 ? 0 : \ - NB_MMU_MODES <= 2 ? 1 : \ - NB_MMU_MODES <= 4 ? 2 : \ - NB_MMU_MODES <= 8 ? 3 : 4)) - -#define CPU_TLB_SIZE (1 << CPU_TLB_BITS) -#endif /* TCG_TARGET_IMPLEMENTS_DYN_TLB */ - typedef struct CPUTLBEntry { /* bit TARGET_LONG_BITS to TARGET_PAGE_BITS : virtual address bit TARGET_PAGE_BITS-1..4 : Nonzero for accesses that should not
@@ -187,10 +150,8 @@ typedef struct CPUTLBDesc {target_ulong large_page_mask;/* The next index to use in the tlb victim table. */ size_t vindex; -#if TCG_TARGET_IMPLEMENTS_DYN_TLB CPUTLBWindow window;size_t n_used_entries; -#endif } CPUTLBDesc;/*
@@ -215,19 +176,12 @@ typedef struct CPUTLBCommon {size_t elide_flush_count; } CPUTLBCommon; -#if TCG_TARGET_IMPLEMENTS_DYN_TLB # define CPU_TLB \/* tlb_mask[i] contains (n_entries - 1) << CPU_TLB_ENTRY_BITS */ \ uintptr_t tlb_mask[NB_MMU_MODES]; \ CPUTLBEntry *tlb_table[NB_MMU_MODES];# define CPU_IOTLB \ CPUIOTLBEntry *iotlb[NB_MMU_MODES]; -#else -# define CPU_TLB \ - CPUTLBEntry tlb_table[NB_MMU_MODES][CPU_TLB_SIZE]; -# define CPU_IOTLB \ - CPUIOTLBEntry iotlb[NB_MMU_MODES][CPU_TLB_SIZE]; -#endif /* * The meaning of each of the MMU modes is defined in the target code.
include/exec/cpu_ldst.h +0 -14
@@ -135,7 +135,6 @@ static inline target_ulong tlb_addr_write(const CPUTLBEntry *entry)#endif } -#if TCG_TARGET_IMPLEMENTS_DYN_TLB /* Find the TLB index corresponding to the mmu_idx + address pair. */ static inline uintptr_t tlb_index (CPUArchState *env,uintptr_t mmu_idx,target_ulong addr)
@@ -149,19 +148,6 @@ static inline size_t tlb_n_entries(CPUArchState *env, uintptr_t mmu_idx) {return (env->tlb_mask[mmu_idx] >>CPU_TLB_ENTRY_BITS ) +1 ; } -#else -/* Find the TLB index corresponding to the mmu_idx + address pair. */ -static inline uintptr_t tlb_index (CPUArchState *env,uintptr_t mmu_idx, -target_ulong addr) -{ -return (addr >>TARGET_PAGE_BITS ) & (CPU_TLB_SIZE -1 ); -} - -static inline size_t tlb_n_entries (CPUArchState *env,uintptr_t mmu_idx) -{ -return CPU_TLB_SIZE ; -} -#endif /* TCG_TARGET_IMPLEMENTS_DYN_TLB */ /* Find the TLB entry corresponding to the mmu_idx + address pair. */ static inline CPUTLBEntry *tlb_entry(CPUArchState *env, uintptr_t mmu_idx,
tcg/aarch64/tcg-target.h +0 -1
@@ -15,7 +15,6 @@#define TCG_TARGET_INSN_UNIT_SIZE 4#define TCG_TARGET_TLB_DISPLACEMENT_BITS 24 -#define TCG_TARGET_IMPLEMENTS_DYN_TLB 1#undef TCG_TARGET_STACK_GROWSUP typedef enum {
tcg/arm/tcg-target.h +0 -1
@@ -60,7 +60,6 @@ extern int arm_arch;#undef TCG_TARGET_STACK_GROWSUP#define TCG_TARGET_INSN_UNIT_SIZE 4#define TCG_TARGET_TLB_DISPLACEMENT_BITS 16 -#define TCG_TARGET_IMPLEMENTS_DYN_TLB 1 typedef enum { TCG_REG_R0 = 0,
tcg/i386/tcg-target.h +0 -1
@@ -27,7 +27,6 @@#define TCG_TARGET_INSN_UNIT_SIZE 1#define TCG_TARGET_TLB_DISPLACEMENT_BITS 31 -#define TCG_TARGET_IMPLEMENTS_DYN_TLB 1#ifdef __x86_64__# define TCG_TARGET_REG_BITS 64
tcg/mips/tcg-target.h +0 -1
@@ -37,7 +37,6 @@#define TCG_TARGET_INSN_UNIT_SIZE 4#define TCG_TARGET_TLB_DISPLACEMENT_BITS 16 -#define TCG_TARGET_IMPLEMENTS_DYN_TLB 1#define TCG_TARGET_NB_REGS 32 typedef enum {
tcg/ppc/tcg-target.h +0 -1
@@ -34,7 +34,6 @@#define TCG_TARGET_NB_REGS 32#define TCG_TARGET_INSN_UNIT_SIZE 4#define TCG_TARGET_TLB_DISPLACEMENT_BITS 16 -#define TCG_TARGET_IMPLEMENTS_DYN_TLB 1 typedef enum { TCG_REG_R0, TCG_REG_R1, TCG_REG_R2, TCG_REG_R3,
tcg/riscv/tcg-target.h +0 -1
@@ -33,7 +33,6 @@#define TCG_TARGET_INSN_UNIT_SIZE 4#define TCG_TARGET_TLB_DISPLACEMENT_BITS 20 -#define TCG_TARGET_IMPLEMENTS_DYN_TLB 1#define TCG_TARGET_NB_REGS 32 typedef enum {
tcg/s390/tcg-target.h +0 -1
@@ -27,7 +27,6 @@#define TCG_TARGET_INSN_UNIT_SIZE 2#define TCG_TARGET_TLB_DISPLACEMENT_BITS 19 -#define TCG_TARGET_IMPLEMENTS_DYN_TLB 1 typedef enum TCGReg { TCG_REG_R0 = 0,
tcg/sparc/tcg-target.h +0 -1
@@ -29,7 +29,6 @@#define TCG_TARGET_INSN_UNIT_SIZE 4#define TCG_TARGET_TLB_DISPLACEMENT_BITS 32 -#define TCG_TARGET_IMPLEMENTS_DYN_TLB 1#define TCG_TARGET_NB_REGS 32 typedef enum {
tcg/tci/tcg-target.h +0 -1
@@ -43,7 +43,6 @@#define TCG_TARGET_INTERPRETER 1#define TCG_TARGET_INSN_UNIT_SIZE 1#define TCG_TARGET_TLB_DISPLACEMENT_BITS 32 -#define TCG_TARGET_IMPLEMENTS_DYN_TLB 1#if UINTPTR_MAX ==UINT32_MAX # define TCG_TARGET_REG_BITS 32
accel/tcg/cputlb.c +0 -21
@@ -74,7 +74,6 @@ QEMU_BUILD_BUG_ON(sizeof(target_ulong) > sizeof(run_on_cpu_data));QEMU_BUILD_BUG_ON (NB_MMU_MODES >16 );#define ALL_MMUIDX_BITS ((1 << NB_MMU_MODES) - 1) -#if TCG_TARGET_IMPLEMENTS_DYN_TLB static inline size_t sizeof_tlb (CPUArchState *env,uintptr_t mmu_idx) {return env->tlb_mask[mmu_idx] + (1 <<CPU_TLB_ENTRY_BITS );
@@ -235,26 +234,6 @@ static inline void tlb_n_used_entries_dec(CPUArchState *env, uintptr_t mmu_idx) env->tlb_d[mmu_idx].n_used_entries--; } -#else /* !TCG_TARGET_IMPLEMENTS_DYN_TLB */ - -static inline void tlb_dyn_init (CPUArchState *env) -{ -} - -static inline void tlb_table_flush_by_mmuidx (CPUArchState *env,int mmu_idx) -{ -memset (env->tlb_table[mmu_idx],-1 ,sizeof (env->tlb_table[0 ])); -} - -static inline void tlb_n_used_entries_inc (CPUArchState *env,uintptr_t mmu_idx) -{ -} - -static inline void tlb_n_used_entries_dec (CPUArchState *env,uintptr_t mmu_idx) -{ -} -#endif /* TCG_TARGET_IMPLEMENTS_DYN_TLB */ -void tlb_init (CPUState *cpu) {CPUArchState *env = cpu->env_ptr;
Signature · 1 line
2.17.2
Re: [Qemu-devel] [PATCH 13/13] cputlb: Remove static tlb sizing
Quoted 4 lines · Richard Henderson
Now that all tcg backends support
TCG_TARGET_IMPLEMENTS_DYN_TLB, remove the define and the old code.Signed-off-by Richard Henderson <[email protected]>
Alistair
Quoted 284 lines
--- include/exec/cpu-defs.h | 46 ---------------------------------------- include/exec/cpu_ldst.h | 14 ------------ tcg/aarch64/tcg-target.h | 1 - tcg/arm/tcg-target.h | 1 - tcg/i386/tcg-target.h | 1 - tcg/mips/tcg-target.h | 1 - tcg/ppc/tcg-target.h | 1 - tcg/riscv/tcg-target.h | 1 - tcg/s390/tcg-target.h | 1 - tcg/sparc/tcg-target.h | 1 - tcg/tci/tcg-target.h | 1 - accel/tcg/cputlb.c | 21 ------------------ 12 files changed, 90 deletions(-)include/exec/cpu-defs.h +0
-46@@ -67,11 +67,9 @@ typedef uint64_t target_ulong;#define CPU_TLB_ENTRY_BITS 5#endif -#if TCG_TARGET_IMPLEMENTS_DYN_TLB #define CPU_TLB_DYN_MIN_BITS 6#define CPU_TLB_DYN_DEFAULT_BITS 8 -# if HOST_LONG_BITS ==32 /* Make sure we do not require a double-word shift for the TLB load */ # define CPU_TLB_DYN_MAX_BITS (32 - TARGET_PAGE_BITS)@@ -87,41 +85,6 @@ typedef uint64_t target_ulong; MIN(22, TARGET_VIRT_ADDR_SPACE_BITS - TARGET_PAGE_BITS)# endif -#else /* !TCG_TARGET_IMPLEMENTS_DYN_TLB */ - -/* TCG_TARGET_TLB_DISPLACEMENT_BITS is used in CPU_TLB_BITS to ensure that -* the TLB is not unnecessarily small, but still small enough for the -* TLB lookup instruction sequence used by the TCG target. -* -* TCG will have to generate an operand as large as the distance between -* env and the tlb_table[NB_MMU_MODES - 1][0].addend. For simplicity, -* the TCG targets just round everything up to the next power of two, and -* count bits. This works because: 1) the size of each TLB is a largish -* power of two, 2) and because the limit of the displacement is really close -* to a power of two, 3) the offset of tlb_table[0][0] inside env is smaller -* than the size of a TLB. -* -* For example, the maximum displacement 0xFFF0 on PPC and MIPS, but TCG -* just says "the displacement is 16 bits". TCG_TARGET_TLB_DISPLACEMENT_BITS -* then ensures that tlb_table at least 0x8000 bytes large ("not unnecessarily -* small": 2^15). The operand then will come up smaller than 0xFFF0 without -* any particular care, because the TLB for a single MMU mode is larger than -* 0x10000-0xFFF0=16 bytes. In the end, the maximum value of the operand -* could be something like 0xC000 (the offset of the last TLB table) plus -* 0x18 (the offset of the addend field in each TLB entry) plus the offset -* of tlb_table inside env (which is non-trivial but not huge). -*/ -#define CPU_TLB_BITS \ - MIN(8, \ - TCG_TARGET_TLB_DISPLACEMENT_BITS - CPU_TLB_ENTRY_BITS - \ - (NB_MMU_MODES <= 1 ? 0 : \ - NB_MMU_MODES <= 2 ? 1 : \ - NB_MMU_MODES <= 4 ? 2 : \ - NB_MMU_MODES <= 8 ? 3 : 4)) - -#define CPU_TLB_SIZE (1 << CPU_TLB_BITS) -#endif /* TCG_TARGET_IMPLEMENTS_DYN_TLB */ - typedef struct CPUTLBEntry { /* bit TARGET_LONG_BITS to TARGET_PAGE_BITS : virtual address bit TARGET_PAGE_BITS-1..4 : Nonzero for accesses that should not@@ -187,10 +150,8 @@ typedef struct CPUTLBDesc {target_ulong large_page_mask;/* The next index to use in the tlb victim table. */ size_t vindex; -#if TCG_TARGET_IMPLEMENTS_DYN_TLB CPUTLBWindow window;size_t n_used_entries; -#endif } CPUTLBDesc;/* @@ -215,19 +176,12 @@ typedef struct CPUTLBCommon {size_t elide_flush_count; } CPUTLBCommon; -#if TCG_TARGET_IMPLEMENTS_DYN_TLB # define CPU_TLB \/* tlb_mask[i] contains (n_entries - 1) << CPU_TLB_ENTRY_BITS */ \ uintptr_t tlb_mask[NB_MMU_MODES]; \ CPUTLBEntry *tlb_table[NB_MMU_MODES];# define CPU_IOTLB \ CPUIOTLBEntry *iotlb[NB_MMU_MODES]; -#else -# define CPU_TLB \ - CPUTLBEntry tlb_table[NB_MMU_MODES][CPU_TLB_SIZE]; -# define CPU_IOTLB \ - CPUIOTLBEntry iotlb[NB_MMU_MODES][CPU_TLB_SIZE]; -#endif /* * The meaning of each of the MMU modes is defined in the target code. include/exec/cpu_ldst.h +0
-14@@ -135,7 +135,6 @@ static inline target_ulong tlb_addr_write(const CPUTLBEntry *entry)#endif } -#if TCG_TARGET_IMPLEMENTS_DYN_TLB /* Find the TLB index corresponding to the mmu_idx + address pair. */ static inline uintptr_t tlb_index (CPUArchState *env,uintptr_t mmu_idx,target_ulong addr)@@ -149,19 +148,6 @@ static inline size_t tlb_n_entries(CPUArchState *env, uintptr_t mmu_idx) {return (env->tlb_mask[mmu_idx] >>CPU_TLB_ENTRY_BITS ) +1 ; } -#else -/* Find the TLB index corresponding to the mmu_idx + address pair. */ -static inline uintptr_t tlb_index (CPUArchState *env,uintptr_t mmu_idx, -target_ulong addr) -{ -return (addr >>TARGET_PAGE_BITS ) & (CPU_TLB_SIZE -1 ); -} - -static inline size_t tlb_n_entries (CPUArchState *env,uintptr_t mmu_idx) -{ -return CPU_TLB_SIZE ; -} -#endif /* TCG_TARGET_IMPLEMENTS_DYN_TLB */ /* Find the TLB entry corresponding to the mmu_idx + address pair. */ static inline CPUTLBEntry *tlb_entry(CPUArchState *env, uintptr_t mmu_idx,tcg/aarch64/tcg-target.h +0
-1@@ -15,7 +15,6 @@#define TCG_TARGET_INSN_UNIT_SIZE 4#define TCG_TARGET_TLB_DISPLACEMENT_BITS 24 -#define TCG_TARGET_IMPLEMENTS_DYN_TLB 1#undef TCG_TARGET_STACK_GROWSUP typedef enum {tcg/arm/tcg-target.h +0
-1@@ -60,7 +60,6 @@ extern int arm_arch;#undef TCG_TARGET_STACK_GROWSUP#define TCG_TARGET_INSN_UNIT_SIZE 4#define TCG_TARGET_TLB_DISPLACEMENT_BITS 16 -#define TCG_TARGET_IMPLEMENTS_DYN_TLB 1 typedef enum { TCG_REG_R0 = 0,tcg/i386/tcg-target.h +0
-1@@ -27,7 +27,6 @@#define TCG_TARGET_INSN_UNIT_SIZE 1#define TCG_TARGET_TLB_DISPLACEMENT_BITS 31 -#define TCG_TARGET_IMPLEMENTS_DYN_TLB 1#ifdef __x86_64__# define TCG_TARGET_REG_BITS 64tcg/mips/tcg-target.h +0
-1@@ -37,7 +37,6 @@#define TCG_TARGET_INSN_UNIT_SIZE 4#define TCG_TARGET_TLB_DISPLACEMENT_BITS 16 -#define TCG_TARGET_IMPLEMENTS_DYN_TLB 1#define TCG_TARGET_NB_REGS 32 typedef enum {tcg/ppc/tcg-target.h +0
-1@@ -34,7 +34,6 @@#define TCG_TARGET_NB_REGS 32#define TCG_TARGET_INSN_UNIT_SIZE 4#define TCG_TARGET_TLB_DISPLACEMENT_BITS 16 -#define TCG_TARGET_IMPLEMENTS_DYN_TLB 1 typedef enum { TCG_REG_R0, TCG_REG_R1, TCG_REG_R2, TCG_REG_R3,tcg/riscv/tcg-target.h +0
-1@@ -33,7 +33,6 @@#define TCG_TARGET_INSN_UNIT_SIZE 4#define TCG_TARGET_TLB_DISPLACEMENT_BITS 20 -#define TCG_TARGET_IMPLEMENTS_DYN_TLB 1#define TCG_TARGET_NB_REGS 32 typedef enum {tcg/s390/tcg-target.h +0
-1@@ -27,7 +27,6 @@#define TCG_TARGET_INSN_UNIT_SIZE 2#define TCG_TARGET_TLB_DISPLACEMENT_BITS 19 -#define TCG_TARGET_IMPLEMENTS_DYN_TLB 1 typedef enum TCGReg { TCG_REG_R0 = 0,tcg/sparc/tcg-target.h +0
-1@@ -29,7 +29,6 @@#define TCG_TARGET_INSN_UNIT_SIZE 4#define TCG_TARGET_TLB_DISPLACEMENT_BITS 32 -#define TCG_TARGET_IMPLEMENTS_DYN_TLB 1#define TCG_TARGET_NB_REGS 32 typedef enum {tcg/tci/tcg-target.h +0
-1@@ -43,7 +43,6 @@#define TCG_TARGET_INTERPRETER 1#define TCG_TARGET_INSN_UNIT_SIZE 1#define TCG_TARGET_TLB_DISPLACEMENT_BITS 32 -#define TCG_TARGET_IMPLEMENTS_DYN_TLB 1#if UINTPTR_MAX ==UINT32_MAX # define TCG_TARGET_REG_BITS 32accel/tcg/cputlb.c +0
-21@@ -74,7 +74,6 @@ QEMU_BUILD_BUG_ON(sizeof(target_ulong) > sizeof(run_on_cpu_data));QEMU_BUILD_BUG_ON (NB_MMU_MODES >16 );#define ALL_MMUIDX_BITS ((1 << NB_MMU_MODES) - 1) -#if TCG_TARGET_IMPLEMENTS_DYN_TLB static inline size_t sizeof_tlb (CPUArchState *env,uintptr_t mmu_idx) {return env->tlb_mask[mmu_idx] + (1 <<CPU_TLB_ENTRY_BITS );@@ -235,26 +234,6 @@ static inline void tlb_n_used_entries_dec(CPUArchState *env, uintptr_t mmu_idx) env->tlb_d[mmu_idx].n_used_entries--; } -#else /* !TCG_TARGET_IMPLEMENTS_DYN_TLB */ - -static inline void tlb_dyn_init (CPUArchState *env) -{ -} - -static inline void tlb_table_flush_by_mmuidx (CPUArchState *env,int mmu_idx) -{ -memset (env->tlb_table[mmu_idx],-1 ,sizeof (env->tlb_table[0 ])); -} - -static inline void tlb_n_used_entries_inc (CPUArchState *env,uintptr_t mmu_idx) -{ -} - -static inline void tlb_n_used_entries_dec (CPUArchState *env,uintptr_t mmu_idx) -{ -} -#endif /* TCG_TARGET_IMPLEMENTS_DYN_TLB */ -void tlb_init (CPUState *cpu) {CPUArchState *env = cpu->env_ptr;
Patchew URL: https://patchew.org/QEMU/[email protected]/
Patchew URL: https://patchew.org/QEMU/[email protected]/
Hi,
This series seems to have some coding style problems. See output below for more information:
Subject: [Qemu-devel] [PATCH 00/13] Dynamic TLB sizing, backends
Type: series
Message-id: [email protected]
=== TEST SCRIPT BEGIN ===
#!/bin/bash
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===
Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384 Switched to a new branch 'test'a08f6bec93 cputlb: Remove static tlb sizing 0efd0464f0 tcg/tci: enable dynamic TLB sizing b53d9afec3 tcg/mips: enable dynamic TLB sizing c2b46736e8 tcg/mips: Fix tcg_out_qemu_ld_slow_path 72aa447a49 tcg/arm: enable dynamic TLB sizing 2b4d1fa8bd tcg/riscv: enable dynamic TLB sizing 1cd52ed294 tcg/s390: enable dynamic TLB sizing 02c6510644 tcg/sparc: enable dynamic TLB sizing 91dd33b602 tcg/ppc: enable dynamic TLB sizing cc0dc49d9a tcg/aarch64: enable dynamic TLB sizing 636758a24d tcg/i386: enable dynamic TLB sizing f530c788b5 tcg: introduce dynamic TLB sizing 5a02f1a0e4 cputlb: do not evict empty entries to the vtlb
=== OUTPUT BEGIN ===
1/13 Checking commit 5a02f1a0e498 (cputlb: do not evict empty entries to the vtlb)
WARNING: Block comments use a leading /* on a separate line
#31: FILE: accel/tcg/cputlb.c:227:
+/**
total: 0 errors, 1 warnings, 23 lines checked
Patch 1/13 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
2/13 Checking commit f530c788b54e (tcg: introduce dynamic TLB sizing)
WARNING: Block comments use a leading /* on a separate line #53: FILE: accel/tcg/cputlb.c:106:
+/**
WARNING: Block comments use a leading /* on a separate line #336: FILE: include/exec/cpu-defs.h:167:
+/**
WARNING: Block comments use a leading /* on a separate line #368: FILE: include/exec/cpu-defs.h:220:
+ /* tlb_mask[i] contains (n_entries - 1) << CPU_TLB_ENTRY_BITS */ \
total: 0 errors, 3 warnings, 452 lines checked
Patch 2/13 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
3/13 Checking commit 636758a24d06 (tcg/i386: enable dynamic TLB sizing) 4/13 Checking commit cc0dc49d9a08 (tcg/aarch64: enable dynamic TLB sizing) 5/13 Checking commit 91dd33b60211 (tcg/ppc: enable dynamic TLB sizing)
ERROR: space prohibited after that open parenthesis '('
#31: FILE: tcg/ppc/tcg-target.inc.c:330:
+#define LWZUX XO31( 55)
ERROR: space prohibited after that open parenthesis '(' #39: FILE: tcg/ppc/tcg-target.inc.c:342:
+#define LDUX XO31( 53)
total: 2 errors, 0 warnings, 144 lines checked
Patch 5/13 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
6/13 Checking commit 02c651064433 (tcg/sparc: enable dynamic TLB sizing) 7/13 Checking commit 1cd52ed29421 (tcg/s390: enable dynamic TLB sizing) 8/13 Checking commit 2b4d1fa8bd14 (tcg/riscv: enable dynamic TLB sizing) 9/13 Checking commit 72aa447a4981 (tcg/arm: enable dynamic TLB sizing)
ERROR: code indent should never use tabs
#174: FILE: tcg/arm/tcg-target.inc.c:1297:
+^Iif (use_armv6_instructions && TARGET_LONG_BITS == 64) {$
ERROR: code indent should never use tabs
#181: FILE: tcg/arm/tcg-target.inc.c:1304:
+^I^I TCG_REG_R2, TCG_REG_R2, TCG_REG_TMP, 0);$
ERROR: code indent should never use tabs
#186: FILE: tcg/arm/tcg-target.inc.c:1309:
+^I}$
total: 3 errors, 0 warnings, 177 lines checked
Patch 9/13 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
10/13 Checking commit c2b46736e852 (tcg/mips: Fix tcg_out_qemu_ld_slow_path) 11/13 Checking commit b53d9afec346 (tcg/mips: enable dynamic TLB sizing) 12/13 Checking commit 0efd0464f0c7 (tcg/tci: enable dynamic TLB sizing) 13/13 Checking commit a08f6bec93d1 (cputlb: Remove static tlb sizing) === OUTPUT END ===
Test command exited with code: 1
The full log is available at
http://patchew.org/logs/[email protected]/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to [email protected]
Patchew URL: https://patchew.org/QEMU/[email protected]/
Patchew URL: https://patchew.org/QEMU/[email protected]/
Hi,
This series failed the docker-mingw@fedora build test. Please find the testing commands and their output below. If you have Docker installed, you can probably reproduce it locally.
=== TEST SCRIPT BEGIN ===
#!/bin/bash
time make docker-test-mingw@fedora SHOW_ENV=1 J=14 === TEST SCRIPT END ===
Configure options:
--enable-werror --target-list=x86_64-softmmu,aarch64-softmmu --prefix=/tmp/qemu-test/install --python=/usr/bin/python3 --cross-prefix=x86_64-w64-mingw32- --enable-trace-backends=simple --enable-gnutls --enable-nettle --enable-curl --enable-vnc --enable-bzip2 --enable-guest-agent --with-sdlabi=2.0
ERROR: "x86_64-w64-mingw32-gcc" either does not exist or does not work
# QEMU configure log Fri Feb 1 22:16:20 UTC 2019
# Configured with: '/tmp/qemu-test/src/configure' '--enable-werror' '--target-list=x86_64-softmmu,aarch64-softmmu' '--prefix=/tmp/qemu-test/install' '--python=/usr/bin/python3' '--cross-prefix=x86_64-w64-mingw32-' '--enable-trace-backends=simple' '--enable-gnutls' '--enable-nettle' '--enable-curl' '--enable-vnc' '--enable-bzip2' '--enable-guest-agent' '--with-sdlabi=2.0'
---
funcs: do_compiler do_cc compile_object check_define main
lines: 92 122 619 636 0
x86_64-w64-mingw32-gcc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -std=gnu99 -c -o config-temp/qemu-conf.o config-temp/qemu-conf.c
ccache: error: Failed to create temporary file for /var/tmp/ccache/tmp/qemu-conf.stdout: Permission denied
funcs: do_compiler do_cc compile_object check_define main
lines: 92 122 619 638 0
x86_64-w64-mingw32-gcc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -std=gnu99 -c -o config-temp/qemu-conf.o config-temp/qemu-conf.c
ccache: error: Failed to create temporary file for /var/tmp/ccache/tmp/qemu-conf.stdout: Permission denied
funcs: do_compiler do_cc compile_object check_define main
lines: 92 122 619 640 0
x86_64-w64-mingw32-gcc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -std=gnu99 -c -o config-temp/qemu-conf.o config-temp/qemu-conf.c
ccache: error: Failed to create temporary file for /var/tmp/ccache/tmp/qemu-conf.stdout: Permission denied
funcs: do_compiler do_cc compile_object check_define main
lines: 92 122 619 642 0
x86_64-w64-mingw32-gcc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -std=gnu99 -c -o config-temp/qemu-conf.o config-temp/qemu-conf.c
ccache: error: Failed to create temporary file for /var/tmp/ccache/tmp/qemu-conf.stdout: Permission denied
funcs: do_compiler do_cc compile_object check_define main
lines: 92 122 619 644 0
x86_64-w64-mingw32-gcc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -std=gnu99 -c -o config-temp/qemu-conf.o config-temp/qemu-conf.c
ccache: error: Failed to create temporary file for /var/tmp/ccache/tmp/qemu-conf.stdout: Permission denied
funcs: do_compiler do_cc compile_object check_define main
lines: 92 122 619 646 0
x86_64-w64-mingw32-gcc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -std=gnu99 -c -o config-temp/qemu-conf.o config-temp/qemu-conf.c
ccache: error: Failed to create temporary file for /var/tmp/ccache/tmp/qemu-conf.stdout: Permission denied
funcs: do_compiler do_cc compile_object check_define main
lines: 92 122 619 648 0
x86_64-w64-mingw32-gcc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -std=gnu99 -c -o config-temp/qemu-conf.o config-temp/qemu-conf.c
ccache: error: Failed to create temporary file for /var/tmp/ccache/tmp/qemu-conf.stdout: Permission denied
funcs: do_compiler do_cc compile_object check_define main
lines: 92 122 619 650 0
x86_64-w64-mingw32-gcc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -std=gnu99 -c -o config-temp/qemu-conf.o config-temp/qemu-conf.c
ccache: error: Failed to create temporary file for /var/tmp/ccache/tmp/qemu-conf.stdout: Permission denied
funcs: do_compiler do_cc compile_object check_define main
lines: 92 122 619 652 0
x86_64-w64-mingw32-gcc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -std=gnu99 -c -o config-temp/qemu-conf.o config-temp/qemu-conf.c
ccache: error: Failed to create temporary file for /var/tmp/ccache/tmp/qemu-conf.stdout: Permission denied
funcs: do_compiler do_cc compile_object check_define main
lines: 92 122 619 654 0
x86_64-w64-mingw32-gcc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -std=gnu99 -c -o config-temp/qemu-conf.o config-temp/qemu-conf.c
ccache: error: Failed to create temporary file for /var/tmp/ccache/tmp/qemu-conf.stdout: Permission denied
funcs: do_compiler do_cc compile_object check_define main
lines: 92 122 619 688 0
x86_64-w64-mingw32-gcc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -std=gnu99 -c -o config-temp/qemu-conf.o config-temp/qemu-conf.c
ccache: error: Failed to create temporary file for /var/tmp/ccache/tmp/qemu-conf.stdout: Permission denied
funcs: do_compiler do_cc compile_object check_define main
lines: 92 122 619 690 0
x86_64-w64-mingw32-gcc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -std=gnu99 -c -o config-temp/qemu-conf.o config-temp/qemu-conf.c
ccache: error: Failed to create temporary file for /var/tmp/ccache/tmp/qemu-conf.stdout: Permission denied
funcs: do_compiler do_cc compile_object check_define main
lines: 92 122 619 696 0
x86_64-w64-mingw32-gcc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -std=gnu99 -c -o config-temp/qemu-conf.o config-temp/qemu-conf.c
ccache: error: Failed to create temporary file for /var/tmp/ccache/tmp/qemu-conf.stdout: Permission denied
funcs: do_compiler do_cc compile_object check_define main
lines: 92 122 619 702 0
x86_64-w64-mingw32-gcc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -std=gnu99 -c -o config-temp/qemu-conf.o config-temp/qemu-conf.c
ccache: error: Failed to create temporary file for /var/tmp/ccache/tmp/qemu-conf.stdout: Permission denied
funcs: do_compiler do_cc compile_object check_define main
lines: 92 122 619 708 0
x86_64-w64-mingw32-gcc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -std=gnu99 -c -o config-temp/qemu-conf.o config-temp/qemu-conf.c
ccache: error: Failed to create temporary file for /var/tmp/ccache/tmp/qemu-conf.stdout: Permission denied
funcs: do_compiler do_cc compile_object check_define main
lines: 92 122 619 710 0
x86_64-w64-mingw32-gcc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -std=gnu99 -c -o config-temp/qemu-conf.o config-temp/qemu-conf.c
ccache: error: Failed to create temporary file for /var/tmp/ccache/tmp/qemu-conf.stdout: Permission denied
funcs: do_compiler do_cc compile_object check_define main
lines: 92 122 619 716 0
x86_64-w64-mingw32-gcc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -std=gnu99 -c -o config-temp/qemu-conf.o config-temp/qemu-conf.c
ccache: error: Failed to create temporary file for /var/tmp/ccache/tmp/qemu-conf.stdout: Permission denied
funcs: do_compiler do_cc compile_object check_define main
lines: 92 122 619 722 0
x86_64-w64-mingw32-gcc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -std=gnu99 -c -o config-temp/qemu-conf.o config-temp/qemu-conf.c
ccache: error: Failed to create temporary file for /var/tmp/ccache/tmp/qemu-conf.stdout: Permission denied
funcs: do_compiler do_cc compile_object check_define main
lines: 92 122 619 724 0
x86_64-w64-mingw32-gcc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -std=gnu99 -c -o config-temp/qemu-conf.o config-temp/qemu-conf.c
ccache: error: Failed to create temporary file for /var/tmp/ccache/tmp/qemu-conf.stdout: Permission denied
funcs: do_compiler do_cc compile_object main
lines: 92 122 1820 0
x86_64-w64-mingw32-gcc -m64 -mcx16 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -std=gnu99 -c -o config-temp/qemu-conf.o config-temp/qemu-conf.c
ccache: error: Failed to create temporary file for /var/tmp/ccache/tmp/qemu-conf.stdout: Permission denied
Failed to run 'configure'
Traceback (most recent call last):
File "./tests/docker/docker.py", line 563, in <module>
The full log is available at
http://patchew.org/logs/[email protected]/testing.docker-mingw@fedora/?type=message.
---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to [email protected]