On Wed, 22 Apr 2020 at 16:38, Paolo Bonzini <pbonzini@xxxxxxxxxx> wrote: > > On 22/04/20 02:48, Wanpeng Li wrote: > > On Tue, 21 Apr 2020 at 19:37, Paolo Bonzini <pbonzini@xxxxxxxxxx> wrote: > >> On 21/04/20 13:20, Wanpeng Li wrote: > >>> + case MSR_IA32_TSCDEADLINE: > >>> + if (!kvm_x86_ops.event_needs_reinjection(vcpu)) { > >>> + data = kvm_read_edx_eax(vcpu); > >>> + if (!handle_fastpath_set_tscdeadline(vcpu, data)) > >>> + ret = EXIT_FASTPATH_CONT_RUN; > >>> + } > >>> break; > >> Can you explain the event_needs_reinjection case? Also, does this break > > This is used to catch the case vmexit occurred while another event was > > being delivered to guest software, I move the > > vmx_exit_handlers_fastpath() call after vmx_complete_interrupts() > > which will decode such event and make kvm_event_needs_reinjection > > return true. > > This doesn't need a callback, kvm_event_needs_reinjection should be enough. > > You should also check other conditions such as > > vcpu->mode == EXITING_GUEST_MODE || kvm_request_pending(vcpu) > || need_resched() || signal_pending(current) > > before doing CONT_RUN. Agreed. > > >> AMD which does not implement the callback? > > Now I add the tscdeadline msr emulation and vmx-preemption timer > > fastpath pair for Intel platform. > > But this would cause a crash if you run on AMD. Yes. :) Wanpeng