On 11/15/18 7:48 PM, Emilio G. Cota wrote: > - Segfault in code_gen_buffer. This one I don't have a fix for, > but it's *much* easier to reproduce when -tb-size is very small, > e.g. "-tb-size 5 -smp 2" (BTW it crashes with x86_64 guests too.) > So at first I thought the code cache flushing was the problem, > but I don't see how that could be, at least from a TCGContext > viewpoint -- I agree that clearing the hash table in > tcg_region_assign is a good place to do so.
Ho hum. diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 639f0b2728..115ea186e5 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -1831,10 +1831,6 @@ TranslationBlock *tb_gen_code(CPUState *cpu, existing_tb = tb_link_page(tb, phys_pc, phys_page2); /* if the TB already exists, discard what we just translated */ if (unlikely(existing_tb != tb)) { - uintptr_t orig_aligned = (uintptr_t)gen_code_buf; - - orig_aligned -= ROUND_UP(sizeof(*tb), qemu_icache_linesize); - atomic_set(&tcg_ctx->code_gen_ptr, (void *)orig_aligned); return existing_tb; } tcg_tb_insert(tb); We can't easily undo the hash table insert, and for a relatively rare occurrence it's not worth the effort. r~