qemu-patch-raspberry4/include
Emilio G. Cota be2cdc5e35 tcg: track TBs with per-region BST's
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: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Emilio G. Cota <cota@braap.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2018-06-15 07:42:55 -10:00
..
block block: Factor out qobject_input_visitor_new_flat_confused() 2018-06-15 14:49:44 +02:00
chardev chardev: introduce chr_machine_done hook 2018-03-12 16:12:46 +01:00
crypto Include less of the generated modular QAPI headers 2018-03-02 13:45:50 -06:00
disas RISC-V Disassembler 2018-03-07 08:30:28 +13:00
exec tcg: track TBs with per-region BST's 2018-06-15 07:42:55 -10:00
fpu fpu/softfloat: Specialize on snan_bit_is_one 2018-05-17 15:27:15 -07:00
hw Block layer patches: 2018-06-15 16:30:27 +01:00
io qio: non-default context for TLS handshake 2018-03-06 10:19:07 +00:00
libdecnumber Clean up ill-advised or unusual header guards 2016-07-12 16:20:46 +02:00
migration acpi, vhost, misc: fixes, features 2018-06-04 10:15:16 +01:00
monitor monitor: new parameter "x-oob" 2018-03-27 10:17:45 -05:00
net net: Remove the deprecated "vlan" parameter 2018-05-14 15:47:14 +08:00
qapi block: Add block-specific QDict header 2018-06-15 14:49:44 +02:00
qemu qht: return existing entry when qht_insert fails 2018-06-15 07:42:55 -10:00
qom exec.c: Handle IOMMUs in address_space_translate_for_iotlb() 2018-06-15 15:23:34 +01:00
scsi iscsi: Implement copy offloading 2018-06-01 14:41:48 +01:00
standard-headers Update Linux headers to 4.17-rc6 2018-06-01 15:14:31 +02:00
sysemu block: Remove deprecated -drive option serial 2018-06-15 14:49:44 +02:00
ui ui: darwin: gtk: Add missing input keymap 2018-06-14 09:52:23 +02:00
elf.h linux-user: ARM-FDPIC: Identify ARM FDPIC binaries 2018-05-03 18:25:29 +02:00
glib-compat.h glib-compat: move G_SOURCE_CONTINUE/REMOVE there 2017-10-10 16:33:55 +02:00
qemu-common.h qemu-options: Bail out on unsupported options instead of silently ignoring them 2018-05-09 00:13:39 +02:00
qemu-io.h qemu-io: Let command functions return error code 2018-06-11 16:18:45 +02:00
trace-tcg.h trace: get rid of generated-events.h/generated-events.c 2016-10-12 09:54:52 +02:00