From d0a70720a321e11b0b906be5a47e8937eee50429 Mon Sep 17 00:00:00 2001 From: Pranith Kumar Date: Sat, 3 Mar 2018 22:14:22 -0500 Subject: [PATCH] Revert "exec.c: Fix breakpoint invalidation race" Now that we have proper locking after MTTCG patches have landed, we can revert the commit. This reverts commit a9353fe897ca2687e5b3385ed39e3db3927a90e0. Backports commit 406bc339b0505fcfc2ffcbca1f05a3756e338a65 from qemu --- qemu/exec.c | 14 ++++++++++++++ qemu/include/exec/exec-all.h | 3 +++ 2 files changed, 17 insertions(+) diff --git a/qemu/exec.c b/qemu/exec.c index f340b667..6b56eb6a 100644 --- a/qemu/exec.c +++ b/qemu/exec.c @@ -603,6 +603,7 @@ void cpu_exec_init(CPUState *cpu, void *opaque) #endif } +#if defined(CONFIG_USER_ONLY) static void breakpoint_invalidate(CPUState *cpu, target_ulong pc) { /* Flush the whole TB as this will not have race conditions @@ -612,6 +613,19 @@ static void breakpoint_invalidate(CPUState *cpu, target_ulong pc) */ tb_flush(cpu); } +#else +static void breakpoint_invalidate(CPUState *cpu, target_ulong pc) +{ + MemTxAttrs attrs; + hwaddr phys = cpu_get_phys_page_attrs_debug(cpu, pc, &attrs); + int asidx = cpu_asidx_from_attrs(cpu, attrs); + if (phys != -1) { + /* Locks grabbed by tb_invalidate_phys_addr */ + tb_invalidate_phys_addr(cpu->cpu_ases[asidx].as, + phys | (pc & ~TARGET_PAGE_MASK)); + } +} +#endif #if defined(CONFIG_USER_ONLY) void cpu_watchpoint_remove_all(CPUState *cpu, int mask) diff --git a/qemu/include/exec/exec-all.h b/qemu/include/exec/exec-all.h index d50912a1..cd556395 100644 --- a/qemu/include/exec/exec-all.h +++ b/qemu/include/exec/exec-all.h @@ -192,6 +192,9 @@ static inline void tlb_flush_page_by_mmuidx(CPUState *cpu, static inline void tlb_flush_by_mmuidx(CPUState *cpu, uint16_t idxmap) { } +static inline void tb_invalidate_phys_addr(AddressSpace *as, hwaddr addr) +{ +} #endif #define CODE_GEN_ALIGN 16 /* must be >= of the size of a icache line */