On Wed, Dec 05, 2012 at 09:11:40PM -0200, Marcelo Tosatti wrote: > > >> +static int handle_apic_write(struct kvm_vcpu *vcpu) > > >> +{ > > >> + unsigned long exit_qualification = vmcs_readl(EXIT_QUALIFICATION); > > >> + u32 offset = exit_qualification & 0xfff; > > >> + > > >> + /* APIC-write VM exit is trap-like and thus no need to adjust IP */ > > >> + return kvm_apic_write_nodecode(vcpu, offset) == 0; > > >> +} > > > > > > Point of return value == 0? > > if kvm_apic_write_nodecode() handle successfully, it will return zero. Then it will return 1 for this vmexit handle. > > What's wrong? > > If kvm_apic_write_nodecode fails (return 0 for the vmexit handle), > there is an exit to userspace. Why is that necessary? kvm_apic_write_nodecode() returns apic_reg_write() value. apic_reg_write() returns 1 when #GP should be injected if used from MSR, if used from mmio apic_reg_write() is ignored since errors cannot be reported to a cpu. Since kvm_apic_write_nodecode() is used for mmio only make it void and ignore apic_reg_write() return value. -- 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