Balaji Rao wrote: > On Wednesday 30 January 2008 04:13:58 pm Avi Kivity wrote: > >>> @@ -790,6 +795,18 @@ static int apic_mmio_range(struct kvm_io_device >>> *this, gpa_t addr) return ret; >>> } >>> >>> +static int nmi_notify(struct notifier_block *self,unsigned long val, >>> void *data) { + >>> + struct kvm *kvm; >>> + kvm = list_entry(vm_list.next, struct kvm, vm_list); >>> + kvm_x86_ops->inject_nmi(kvm->vcpus[0]); >>> + return NOTIFY_STOP; >>> +} >>> >> You're not guaranteed to be in vcpu context here, that's what's causing >> the vmwrite errors. >> >> > I intended to do this here. Looks like its not the right way to check for > presence in vcpu context. How do i do it ? please explain. > > +static void vmx_inject_nmi(struct kvm_vcpu *vcpu) { > + > + struct vcpu_vmx * vmx = to_vmx(vcpu); > + if (vmx->launched) > + vmcs_write32(VM_ENTRY_INTR_INFO_FIELD, > + 2 | INTR_TYPE_NMI | INTR_INFO_VALID_MASK); > +} > >
No, this is the wrong place. If you have a vcpu, you'd better be in vcpu context. The way to do it is to set a bit in vcpu->requests and force an IPI to vcpu->cpu. You can look at kvm_flush_remote_tlbs() for an example (another example is in the lapic IPI code, actually a better one since it also wakes the cpu up if it is in hlt state). -- error compiling committee.c: too many arguments to function ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel