On 8/11/21 6:45 PM, Richard Henderson wrote:
On 8/11/21 5:39 PM, David Gibson wrote:
I mean, nothing is stopping us from calculating cycles using time, but in the
end we would do the same thing we're already doing today.
Oh.. ok. I had assumed that icount worked by instrumenting the
generate TCG code to actually count instructions, rather than working
off the time.
David, you're right, icount instruments the generated tcg code.
You also have to add -icount to the command-line.
Oh, and btw, icount disables multi-threaded tcg, so you're going to be running that guest
in round-robin mode.
Icount affects so many aspects of qemu that I really do not think it is the best option
for a PMU.
If you want to count instructions retired, then just do that. Stuff values into
tcg_gen_insn_start so they're available for exception unwind, and otherwise decrement the
counter at the end of a TB.
If you really must interrupt exactly at 0 (and not simply at some point past underflow),
then we can adjust the tb lookup logic to let you reduce tb->cflags.CF_COUNT_MASK in
cpu_get_tb_cpu_state.
r~