Re: Question about KVM API

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Mar 25, 2019 at 10:35:28AM +0100, David Hildenbrand wrote:
> On 21.03.19 23:52, Steve Rutherford wrote:
> > 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.
> 
> There is a very hacky way to stop/kick a VCPU on every branch using the
> BTS buffer and EPT, however it requires guest interaction. Most probably
> not what you are looking for.

Out of curiosity, why not do EFLAGS.TF=1 && MSR_IA32_DEBUGCTLMSR.BTF=1
(and VM-Exit on #DBs) to stop on branches?



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux