[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 07/11] translate-all: exit cpu_restore_state early if
From: |
Alex Bennée |
Subject: |
[Qemu-devel] [PULL 07/11] translate-all: exit cpu_restore_state early if translating |
Date: |
Thu, 9 Mar 2017 11:17:10 +0000 |
The translation code uses cpu_ld*_code which can trigger a tlb_fill
which if it fails will erroneously attempts a fault resolution. This
never works during translation as the TB being generated hasn't been
added yet. The target should have checked retaddr before calling
cpu_restore_state but for those that have yet to be fixed we do it
here to avoid a recursive tb_lock() under MTTCG's new locking regime.
Signed-off-by: Alex Bennée <address@hidden>
Reviewed-by: Richard Henderson <address@hidden>
---
translate-all.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/translate-all.c b/translate-all.c
index d42d003e67..34480aebba 100644
--- a/translate-all.c
+++ b/translate-all.c
@@ -333,6 +333,19 @@ bool cpu_restore_state(CPUState *cpu, uintptr_t retaddr)
TranslationBlock *tb;
bool r = false;
+ /* A retaddr of zero is invalid so we really shouldn't have ended
+ * up here. The target code has likely forgotten to check retaddr
+ * != 0 before attempting to restore state. We return early to
+ * avoid blowing up on a recursive tb_lock(). The target must have
+ * previously survived a failed cpu_restore_state because
+ * tb_find_pc(0) would have failed anyway. It still should be
+ * fixed though.
+ */
+
+ if (!retaddr) {
+ return r;
+ }
+
tb_lock();
tb = tb_find_pc(retaddr);
if (tb) {
--
2.11.0
- [Qemu-devel] [PULL 00/11] MTTCG Fix-ups for 2.9, Alex Bennée, 2017/03/09
- [Qemu-devel] [PULL 02/11] target/i386/cpu.h: declare TCG_GUEST_DEFAULT_MO, Alex Bennée, 2017/03/09
- [Qemu-devel] [PULL 01/11] vl/cpus: be smarter with icount and MTTCG, Alex Bennée, 2017/03/09
- [Qemu-devel] [PULL 03/11] cpus.c: add additional error_report when !TARGET_SUPPORT_MTTCG, Alex Bennée, 2017/03/09
- [Qemu-devel] [PULL 04/11] sparc/sparc64: grab BQL before calling cpu_check_irqs, Alex Bennée, 2017/03/09
- [Qemu-devel] [PULL 07/11] translate-all: exit cpu_restore_state early if translating,
Alex Bennée <=
- [Qemu-devel] [PULL 05/11] s390x/misc_helper.c: wrap IO instructions in BQL, Alex Bennée, 2017/03/09
- [Qemu-devel] [PULL 06/11] target/xtensa: hold BQL for interrupt processing, Alex Bennée, 2017/03/09
- [Qemu-devel] [PULL 10/11] target/arm/helper: make it clear the EC field is also in hex, Alex Bennée, 2017/03/09
- [Qemu-devel] [PULL 09/11] target-i386: defer VMEXIT to do_interrupt, Alex Bennée, 2017/03/09
- [Qemu-devel] [PULL 08/11] target/mips: hold BQL for timer interrupts, Alex Bennée, 2017/03/09
- [Qemu-devel] [PULL 11/11] hw/intc/arm_gic: modernise the DPRINTF, Alex Bennée, 2017/03/09
- Re: [Qemu-devel] [PULL 00/11] MTTCG Fix-ups for 2.9, Peter Maydell, 2017/03/13