Skip to content

Commit

Permalink
accel/tcg: fix plugin instrumentation missing for some instructions
Browse files Browse the repository at this point in the history
This commit corrects CF_MEMI_ONLY flag. It was initially introduced
(cfd405e) to avoid double instrumentation on instructions which are
recompiled when using icount, because associated to an MMIO access.

However, we observed that some instructions were not instrumented, so we
should set this flag only when recompiling a record/replay branch.

Signed-off-by: Pierrick Bouvier <[email protected]>
  • Loading branch information
pbo-linaro committed Dec 23, 2024
1 parent ae5fac9 commit 2929d46
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions accel/tcg/translate-all.c
Original file line number Diff line number Diff line change
Expand Up @@ -625,15 +625,18 @@ void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr)
cc->tcg_ops->io_recompile_replay_branch(cpu, tb)) {
cpu->neg.icount_decr.u16.low++;
n = 2;
/*
* Limit instrumentation to memory operations only (which execute after
* completion), so we don't double instrument the instruction.
*/
n |= CF_MEMI_ONLY;
}

/*
* Exit the loop and potentially generate a new TB executing the
* just the I/O insns. We also limit instrumentation to memory
* operations only (which execute after completion) so we don't
* double instrument the instruction.
* Exit the loop and potentially generate a new TB executing just the
* I/O insns.
*/
cpu->cflags_next_tb = curr_cflags(cpu) | CF_MEMI_ONLY | n;
cpu->cflags_next_tb = curr_cflags(cpu) | n;

if (qemu_loglevel_mask(CPU_LOG_EXEC)) {
vaddr pc = cpu->cc->get_pc(cpu);
Expand Down

0 comments on commit 2929d46

Please sign in to comment.