qemu-patch-raspberry4/include/exec
Emilio G. Cota 6e3b2bfd6a tcg: allocate TB structs before the corresponding translated code
Allocating an arbitrarily-sized array of tbs results in either
(a) a lot of memory wasted or (b) unnecessary flushes of the code
cache when we run out of TB structs in the array.

An obvious solution would be to just malloc a TB struct when needed,
and keep the TB array as an array of pointers (recall that tb_find_pc()
needs the TB array to run in O(log n)).

Perhaps a better solution, which is implemented in this patch, is to
allocate TB's right before the translated code they describe. This
results in some memory waste due to padding to have code and TBs in
separate cache lines--for instance, I measured 4.7% of padding in the
used portion of code_gen_buffer when booting aarch64 Linux on a
host with 64-byte cache lines. However, it can allow for optimizations
in some host architectures, since TCG backends could safely assume that
the TB and the corresponding translated code are very close to each
other in memory. See this message by rth for a detailed explanation:

  https://lists.gnu.org/archive/html/qemu-devel/2017-03/msg05172.html
  Subject: Re: GSoC 2017 Proposal: TCG performance enhancements
  Message-ID: <1e67644b-4b30-887e-d329-1848e94c9484@twiddle.net>

Suggested-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Pranith Kumar <bobby.prani@gmail.com>
Signed-off-by: Emilio G. Cota <cota@braap.org>
Message-Id: <1496790745-314-3-git-send-email-cota@braap.org>
[rth: Simplify the arithmetic in tcg_tb_alloc]
Signed-off-by: Richard Henderson <rth@twiddle.net>
2017-06-19 11:10:59 -07:00
..
user linux-user: Use correct alignment for long long on i386 guests 2016-08-04 16:34:59 +03:00
address-spaces.h Clean up header guards that don't match their file name 2016-07-12 16:19:16 +02:00
cpu-all.h exec: introduce MemoryRegionCache 2016-12-22 16:00:23 +01:00
cpu-common.h RAMBlocks: qemu_ram_is_shared 2017-03-16 09:00:58 +01:00
cpu-defs.h qemu-common: stop including qemu/host-utils.h from qemu-common.h 2016-05-19 16:42:28 +02:00
cpu_ldst.h cpu_ldst.h: use correct guest address parameter 2016-11-22 23:26:51 +01:00
cpu_ldst_template.h trace: switch to modular code generation for sub-directories 2017-01-31 17:11:18 +00:00
cpu_ldst_useronly_template.h trace: switch to modular code generation for sub-directories 2017-01-31 17:11:18 +00:00
cputlb.h cputlb: atomically update tlb fields used by tlb_reset_dirty 2017-02-24 10:32:46 +00:00
exec-all.h tcg: Introduce goto_ptr opcode and tcg_gen_lookup_and_goto_ptr 2017-06-05 09:25:42 -07:00
gdbstub.h linux-user: Remove redundant gdb_queuesig() 2016-06-07 16:39:07 +03:00
gen-icount.h cpu-exec: unify icount_decr and tcg_exit_req 2017-02-22 14:56:34 +01:00
helper-gen.h Clean up decorations and whitespace around header guards 2016-07-12 16:20:46 +02:00
helper-head.h Clean up header guards that don't match their file name 2016-07-12 16:19:16 +02:00
helper-proto.h Clean up decorations and whitespace around header guards 2016-07-12 16:20:46 +02:00
helper-tcg.h Clean up decorations and whitespace around header guards 2016-07-12 16:20:46 +02:00
hwaddr.h hw: Clean up includes 2016-06-07 18:19:23 +03:00
ioport.h hw: clean up hw/hw.h includes 2016-05-19 16:42:30 +02:00
log.h log: do not unnecessarily include qom/cpu.h 2016-02-03 09:19:10 +00:00
memattrs.h hw/pci: Introduce pci_requester_id() 2015-10-19 10:13:07 +02:00
memory-internal.h memory: unregister AddressSpace MemoryListener within BQL 2015-02-10 10:25:44 -07:00
memory.h trivial: Remove unneeded ifndef in memory.h 2017-06-04 18:42:55 +03:00
poison.h cpu: move endian-dependent load/store functions to cpu-all.h 2016-05-19 16:42:28 +02:00
ram_addr.h ram: Split dirty bitmap by RAMBlock 2017-05-04 10:00:38 +02:00
ramlist.h ramblock: add new hmp command "info ramblock" 2017-05-17 17:31:16 +01:00
semihost.h semihosting: add --semihosting-config arg sub-argument 2015-06-19 14:17:45 +01:00
softmmu-semi.h Clean up decorations and whitespace around header guards 2016-07-12 16:20:46 +02:00
target_page.h migration: Make savevm.c target independent 2017-05-18 19:21:00 +02:00
tb-context.h tcg: allocate TB structs before the corresponding translated code 2017-06-19 11:10:59 -07:00
tb-hash-xx.h Clean up ill-advised or unusual header guards 2016-07-12 16:20:46 +02:00
tb-hash.h tb-hash: improve tb_jmp_cache hash function in user mode 2017-06-05 09:25:42 -07:00