[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 00/19] Mirror map JIT memory for TCG
From: |
Richard Henderson |
Subject: |
[PATCH v2 00/19] Mirror map JIT memory for TCG |
Date: |
Thu, 29 Oct 2020 17:49:02 -0700 |
This is my take on Joelle's patch set:
https://lists.nongnu.org/archive/html/qemu-devel/2020-10/msg07837.html
First, lots more patches. For the most part, I convert one interface
at a time, instead of trying to do it all at once. Then, convert the
tcg backends one at a time, allowing for a backend to say that it has
not been updated and not to use the split. This takes care of TCI,
for one, which would never be converted, as it makes no sense. But I
don't expect to ever try to convert mips either -- the memory mapping
constraints there are ugly.
There are many more places that "const" could logically be pushed.
I stopped at several major interfaces and left TODO comments.
I have only converted tcg/i386 and tcg/aarch64 so far. That should
certainly be sufficient for immediate darwin/iOS testing.
Second, I've taken the start with rw and offset to rx approach, which
is the opposite of Joelle's patch set. It's a close call, but this
direction may be slightly cleaner.
Third, there are almost no ifdefs. The only ones are related to host
specific support. That means that this is always available, modulo
the actual tcg backend support. When the feature is disabled, we will
be adding and subtracting a 0 stored in a global variable.
Fourth, I have renamed the command-line parameter to "split-rwx".
I don't think this is perfect, and I'm not even sure if it's better
than "mirror-jit". What this has done, though, is left the code
with inconsistant language -- "mirror" in some places, "split" in
others. I'll clean that up once we know decide on naming.
Fifth, I have auto-enabled the feature for CONFIG_DEBUG_TCG, so that
it will fall-back to disabled without error. But if you try to enable
it from the command-line without complete host support a fatal error
will be generated. But this will make sure that the feature is
regularly tested.
r~
Richard Henderson (19):
tcg: Enhance flush_icache_range with separate data pointer
tcg: Move tcg prologue pointer out of TCGContext
tcg: Move tcg epilogue pointer out of TCGContext
tcg: Introduce tcg_mirror_rw_to_rx/tcg_mirror_rx_to_rw
tcg: Adjust tcg_out_call for const
tcg: Adjust tcg_out_label for const
tcg: Adjust tcg_register_jit for const
tcg: Adjust tb_target_set_jmp_target for split rwx
tcg: Make DisasContextBase.tb const
tcg: Make tb arg to synchronize_from_tb const
tcg: Use Error with alloc_code_gen_buffer
tcg: Add --accel tcg,split-rwx property
accel/tcg: Support split-rwx for linux with memfd
RFC: accel/tcg: Support split-rwx for darwin/iOS with vm_remap
tcg: Return the rx mirror of TranslationBlock from exit_tb
tcg/i386: Support split-rwx code generation
tcg/aarch64: Use B not BL for tcg_out_goto_long
tcg/aarch64: Implement flush_idcache_range manually
tcg/aarch64: Support split-rwx code generation
accel/tcg/tcg-runtime.h | 2 +-
include/disas/disas.h | 2 +-
include/exec/exec-all.h | 2 +-
include/exec/gen-icount.h | 4 +-
include/exec/log.h | 2 +-
include/exec/translator.h | 2 +-
include/hw/core/cpu.h | 3 +-
include/sysemu/tcg.h | 2 +-
include/tcg/tcg-op.h | 2 +-
include/tcg/tcg.h | 37 +++--
tcg/aarch64/tcg-target.h | 9 +-
tcg/arm/tcg-target.h | 11 +-
tcg/i386/tcg-target.h | 10 +-
tcg/mips/tcg-target.h | 11 +-
tcg/ppc/tcg-target.h | 5 +-
tcg/riscv/tcg-target.h | 11 +-
tcg/s390/tcg-target.h | 12 +-
tcg/sparc/tcg-target.h | 11 +-
tcg/tci/tcg-target.h | 12 +-
accel/tcg/cpu-exec.c | 41 +++---
accel/tcg/tcg-all.c | 26 +++-
accel/tcg/tcg-runtime.c | 4 +-
accel/tcg/translate-all.c | 255 ++++++++++++++++++++++++++++-------
accel/tcg/translator.c | 4 +-
bsd-user/main.c | 2 +-
disas.c | 4 +-
linux-user/main.c | 2 +-
softmmu/physmem.c | 9 +-
target/arm/cpu.c | 3 +-
target/arm/translate-a64.c | 2 +-
target/avr/cpu.c | 3 +-
target/hppa/cpu.c | 3 +-
target/i386/cpu.c | 3 +-
target/microblaze/cpu.c | 3 +-
target/mips/cpu.c | 3 +-
target/riscv/cpu.c | 3 +-
target/rx/cpu.c | 3 +-
target/sh4/cpu.c | 3 +-
target/sparc/cpu.c | 3 +-
target/tricore/cpu.c | 2 +-
tcg/tcg-op.c | 15 ++-
tcg/tcg.c | 85 +++++++++---
tcg/tci.c | 4 +-
accel/tcg/trace-events | 2 +-
tcg/aarch64/tcg-target.c.inc | 130 +++++++++++++-----
tcg/arm/tcg-target.c.inc | 6 +-
tcg/i386/tcg-target.c.inc | 38 +++---
tcg/mips/tcg-target.c.inc | 18 +--
tcg/ppc/tcg-target.c.inc | 45 ++++---
tcg/riscv/tcg-target.c.inc | 12 +-
tcg/s390/tcg-target.c.inc | 8 +-
tcg/sparc/tcg-target.c.inc | 22 +--
tcg/tcg-pool.c.inc | 6 +-
tcg/tci/tcg-target.c.inc | 2 +-
54 files changed, 655 insertions(+), 269 deletions(-)
--
2.25.1
- [PATCH v2 00/19] Mirror map JIT memory for TCG,
Richard Henderson <=
- [PATCH v2 01/19] tcg: Enhance flush_icache_range with separate data pointer, Richard Henderson, 2020/10/29
- [PATCH v2 05/19] tcg: Adjust tcg_out_call for const, Richard Henderson, 2020/10/29
- [PATCH v2 06/19] tcg: Adjust tcg_out_label for const, Richard Henderson, 2020/10/29
- [PATCH v2 03/19] tcg: Move tcg epilogue pointer out of TCGContext, Richard Henderson, 2020/10/29
- [PATCH v2 08/19] tcg: Adjust tb_target_set_jmp_target for split rwx, Richard Henderson, 2020/10/29
- [PATCH v2 09/19] tcg: Make DisasContextBase.tb const, Richard Henderson, 2020/10/29
- [PATCH v2 02/19] tcg: Move tcg prologue pointer out of TCGContext, Richard Henderson, 2020/10/29
- [PATCH v2 04/19] tcg: Introduce tcg_mirror_rw_to_rx/tcg_mirror_rx_to_rw, Richard Henderson, 2020/10/29
- [PATCH v2 10/19] tcg: Make tb arg to synchronize_from_tb const, Richard Henderson, 2020/10/29
- [PATCH v2 11/19] tcg: Use Error with alloc_code_gen_buffer, Richard Henderson, 2020/10/29