On Jan 29 22:23, Aaron Lindsay wrote: > I appear to be seeing that if I register a callback for an instruction > via `qemu_plugin_register_vcpu_insn_exec_cb` I receive a callback even > if the instruction faults.
I was wrong about what I was seeing - I made some false assumptions based on incomplete information. After adding some additional instrumentation, I do not believe what I am seeing is explained by translation faults, and think it might even be a bug. For the below output, I've got a plugin which registers a callback via `qemu_plugin_register_vcpu_insn_exec_cb` for each instruction executed. I've enabled `-d in_asm` and added prints in my instruction execution callback when it sees the opcode for the `ldr` instruction in question. I'm running a local source build of the v5.2.0 release. Note in the output below the instruction at 0xffffdd2f1d4102c0 is getting re-translated for some reason, and that two callbacks are made to my function registered with qemu_plugin_register_vcpu_insn_exec_cb (the "*** saw encoding"... output) for what should be one instruction execution. Do you have any tips for debugging this further or ideas for ensuring the callback is called only once for this instruction? ---------------- IN: 0xffffdd2f1d410250: aa1e03e9 mov x9, x30 0xffffdd2f1d410254: d503201f nop 0xffffdd2f1d410258: a9bc7bfd stp x29, x30, [sp, #-0x40]! 0xffffdd2f1d41025c: 910003fd mov x29, sp 0xffffdd2f1d410260: a90153f3 stp x19, x20, [sp, #0x10] 0xffffdd2f1d410264: b000f2d3 adrp x19, #0xffffdd2f1f269000 0xffffdd2f1d410268: 911c4273 add x19, x19, #0x710 0xffffdd2f1d41026c: a9025bf5 stp x21, x22, [sp, #0x20] 0xffffdd2f1d410270: f000cad6 adrp x22, #0xffffdd2f1ed6b000 0xffffdd2f1d410274: aa0003f5 mov x21, x0 0xffffdd2f1d410278: f9409674 ldr x20, [x19, #0x128] 0xffffdd2f1d41027c: 913d42d6 add x22, x22, #0xf50 0xffffdd2f1d410280: f9001bf7 str x23, [sp, #0x30] 0xffffdd2f1d410284: 91003297 add x23, x20, #0xc 0xffffdd2f1d410288: 91004294 add x20, x20, #0x10 0xffffdd2f1d41028c: 1400000d b #0xffffdd2f1d4102c0 ---------------- IN: 0xffffdd2f1d4102c0: b94002e2 ldr w2, [x23] 0xffffdd2f1d4102c4: 12002441 and w1, w2, #0x3ff 0xffffdd2f1d4102c8: 710fec3f cmp w1, #0x3fb 0xffffdd2f1d4102cc: 54fffe29 b.ls #0xffffdd2f1d410290 *** saw encoding 0xb94002e2 (@ 504107673 instructions) ---------------- IN: 0xffffdd2f1d4102c0: b94002e2 ldr w2, [x23] *** saw encoding 0xb94002e2 (@ 504107674 instructions) ---------------- IN: 0xffffdd2f1d4102c4: 12002441 and w1, w2, #0x3ff 0xffffdd2f1d4102c8: 710fec3f cmp w1, #0x3fb 0xffffdd2f1d4102cc: 54fffe29 b.ls #0xffffdd2f1d410290 Thanks! -Aaron