[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 16/60] accel/tcg: Set can_do_io at at start of lookup_tb_ptr help
From: |
Richard Henderson |
Subject: |
[PATCH 16/60] accel/tcg: Set can_do_io at at start of lookup_tb_ptr helper |
Date: |
Fri, 1 Mar 2024 13:05:35 -1000 |
From: Peter Maydell <peter.maydell@linaro.org>
If a page table is in IO memory and lookup_tb_ptr probes
the TLB it can result in a page table walk for the instruction
fetch. If this hits IO memory and io_prepare falsely assumes
it needs to do a TLB recompile.
Avoid that by setting can_do_io at the start of lookup_tb_ptr.
Link:
https://lore.kernel.org/qemu-devel/CAFEAcA_a_AyQ=Epz3_+CheAT8Crsk9mOu894wbNW_FywamkZiw@mail.gmail.com/#t
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Message-Id: <20240219173153.12114-2-Jonathan.Cameron@huawei.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
accel/tcg/cpu-exec.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
index 977576ca14..52239a441f 100644
--- a/accel/tcg/cpu-exec.c
+++ b/accel/tcg/cpu-exec.c
@@ -396,6 +396,14 @@ const void *HELPER(lookup_tb_ptr)(CPUArchState *env)
uint64_t cs_base;
uint32_t flags, cflags;
+ /*
+ * By definition we've just finished a TB, so I/O is OK.
+ * Avoid the possibility of calling cpu_io_recompile() if
+ * a page table walk triggered by tb_lookup() calling
+ * probe_access_internal() happens to touch an MMIO device.
+ * The next TB, if we chain to it, will clear the flag again.
+ */
+ cpu->neg.can_do_io = true;
cpu_get_tb_cpu_state(env, &pc, &cs_base, &flags);
cflags = curr_cflags(cpu);
--
2.34.1
- [PATCH 00/60] linux-user and tcg patch queue, Richard Henderson, 2024/03/01
- [PATCH 01/60] linux-user/elfload: Disable core dump if getrlimit fails, Richard Henderson, 2024/03/01
- [PATCH 02/60] linux-user/elfload: Merge init_note_info and fill_note_info, Richard Henderson, 2024/03/01
- [PATCH 03/60] linux-user/elfload: Tidy fill_note_info and struct elf_note_info, Richard Henderson, 2024/03/01
- [PATCH 04/60] linux-user/elfload: Stack allocate struct mm_struct, Richard Henderson, 2024/03/01
- [PATCH 05/60] linux-user/elfload: Latch errno before cleanup in elf_core_dump, Richard Henderson, 2024/03/01
- [PATCH 08/60] linux-user/elfload: Lock cpu list and mmap during elf_core_dump, Richard Henderson, 2024/03/01
- [PATCH 11/60] linux-user/elfload: Write process memory to core file in larger chunks, Richard Henderson, 2024/03/01
- [PATCH 13/60] linux-user/elfload: Rely on walk_memory_regions for vmas, Richard Henderson, 2024/03/01
- [PATCH 15/60] tcg/aarch64: Apple does not align __int128_t in even registers, Richard Henderson, 2024/03/01
- [PATCH 16/60] accel/tcg: Set can_do_io at at start of lookup_tb_ptr helper,
Richard Henderson <=
- [PATCH 06/60] linux-user/elfload: Open core file after vma_init, Richard Henderson, 2024/03/01
- [PATCH 09/60] linux-user/elfload: Size corefile before opening, Richard Henderson, 2024/03/01
- [PATCH 14/60] linux-user/elfload: Unprotect regions before core dump, Richard Henderson, 2024/03/01
- [PATCH 25/60] linux-user: Remove qemu_host_page_size from elf_core_dump, Richard Henderson, 2024/03/01
- [PATCH 19/60] linux-user: Adjust SVr4 NULL page mapping, Richard Henderson, 2024/03/01
- [PATCH 12/60] linux-user/elfload: Simplify vma_dump_size, Richard Henderson, 2024/03/01
- [PATCH 18/60] accel/tcg: Remove qemu_host_page_size from page_protect/page_unprotect, Richard Henderson, 2024/03/01
- [PATCH 26/60] linux-user: Remove qemu_host_page_{size, mask} from mmap.c, Richard Henderson, 2024/03/01
- [PATCH 28/60] linux-user: Remove HOST_PAGE_ALIGN from mmap.c, Richard Henderson, 2024/03/01
- [PATCH 07/60] linux-user/elfload: Truncate core file on open, Richard Henderson, 2024/03/01