From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PATCH] KVM: x86: Convert INIT and SIPI signals into synchronously handled events Date: Tue, 12 Mar 2013 14:09:24 +0100 Message-ID: <513F2904.2050905@redhat.com> References: <513F1529.3040309@siemens.com> <513F1A63.9070107@redhat.com> <513F1FB1.60101@redhat.com> <513F23BD.7020903@siemens.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Gleb Natapov , Marcelo Tosatti , kvm To: Jan Kiszka Return-path: Received: from mail-qa0-f53.google.com ([209.85.216.53]:40998 "EHLO mail-qa0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754683Ab3CLNJd (ORCPT ); Tue, 12 Mar 2013 09:09:33 -0400 Received: by mail-qa0-f53.google.com with SMTP id z4so1564877qan.5 for ; Tue, 12 Mar 2013 06:09:32 -0700 (PDT) In-Reply-To: <513F23BD.7020903@siemens.com> Sender: kvm-owner@vger.kernel.org List-ID: Il 12/03/2013 13:46, Jan Kiszka ha scritto: >>>> >>> @@ -6178,7 +6177,13 @@ int kvm_arch_vcpu_ioctl_get_mpstate(struct kvm_vcpu *vcpu, >>>> >>> int kvm_arch_vcpu_ioctl_set_mpstate(struct kvm_vcpu *vcpu, >>>> >>> struct kvm_mp_state *mp_state) >>>> >>> { >>>> >>> - vcpu->arch.mp_state = mp_state->mp_state; >>>> >>> + if (mp_state->mp_state == KVM_MP_STATE_SIPI_RECEIVED) { >>>> >>> + if (!kvm_vcpu_has_lapic(vcpu)) >>>> >>> + return -EINVAL; >>>> >>> + vcpu->arch.mp_state = KVM_MP_STATE_INIT_RECEIVED; >>>> >>> + set_bit(KVM_APIC_SIPI, &vcpu->arch.apic->pending_events); >>>> >>> + } else >>>> >>> + vcpu->arch.mp_state = mp_state->mp_state; >>> >> >>> >> Should INIT_RECEIVED also be invalid without an in-kernel LAPIC? >> > >> > And since migration was brought up yesterday, do we need an interface to >> > retrieve and set this? >> > >> > And should KVM_GET/SET_VCPU_EVENTS use the new sipi_vector in the APIC >> > rather than the old one? > I hope not. The idea is that the APIC events are processed before the > migration completes. Translating events on get_mpstate should ensure this. What about persistent state such as "an INIT has been received and caused a vmexit, but is being latched until vmxoff"? Perhaps we could use the top 8 bits of vcpu->arch.sipi_vector for this, they are always shifted out when sipi_vector is used, and should be zero in all cases. It would then be possible to reuse KVM_GET/SET_VCPU_EVENTS. Migration support for nested VMX is still far far away, so perhaps we do not care, but we still need a way to inject INIT from userspace. Paolo