On Sat, Jul 25, 2009 at 10:46:39PM +0200, Jiaqing Du wrote: > Hi list, > > I'm trying to extend OProfile to support guest profiling. One step of > my work is to push an NMI to the guest(s) when a performance counter > overflows. Please correct me if the following is not correct: > > counter overflow --> NMI to host --> VM exit --> "int $2" to handle > NMI on host --> ... --> VM entry --> NMI to guest > Correct except the last step (--> NMI to guest). Host nmi is not propagated to guests. > On the path between VM-exit and VM-entry, I want to push an NMI to the > guest. I tried to put the following code on the path, but never > succeeded. Various wired things happened, such as KVM hangs, guest > kernel oops, and host hangs. I tried both code with Linux 2.6.30 and > version 88. > > if (vmx_nmi_allowed()) { vmx_inject_nmi(); } > > Any suggestions? Where is the right place to push an NMI and what are > the necessary checks? Call kvm_inject_nmi(vcpu). And don't forget to vcpu_load(vcpu) before doing it. See kvm_vcpu_ioctl_nmi(). -- Gleb. -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html