Not that I know of. This is surprisingly hard to implement correctly in KVM. On Intel x86 it could be done with MTF (monitor trap fault), but you would need to VMEXIT at each instruction boundary, and getting the behavior right for other traps/faults is pretty hard when running around with MTF enabled on every instruction. It could be done somewhat inaccurately using perf counters (setup interrupt on overflow for the per-thread instruction count, and set the base value for that counter really high), but I'm not even sure what the current state of KVM's Perf support is, or if this trick would work well in practice since this isn't really what perf counters were built for. On Wed, Mar 20, 2019 at 9:33 PM liushuyu <liushuyu@xxxxxxx> wrote: > > Hi there, > > I am new to KVM API and I have a question: Is there a way to stop/kick vCPU > after it executes a specific number of instructions? I have searched online, > read the documentation in the Linux kernel source code, searched through the > archives of this mailing list and I couldn't find the answer. > > Thanks very much for your attention. > > Thanks, > Zixing Liu > >