Re: [PATCH] KVM: x86: Convert INIT and SIPI signals into synchronously handled events

Gleb Natapov
2013-03-12T12:53:58Z

On Tue, Mar 12, 2013 at 01:52:00PM +0100, Jan Kiszka wrote:
> On 2013-03-12 13:49, Gleb Natapov wrote:
> > On Tue, Mar 12, 2013 at 01:46:53PM +0100, Jan Kiszka wrote:
> >> On 2013-03-12 13:29, Paolo Bonzini wrote:
> >>> Il 12/03/2013 13:06, Paolo Bonzini 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.
> >>
> > But when you will add nested support it will not be that simple, so as
> > part of migration with nested guests we will have to transfer
> > pending_events too instead of processing then on (set|get)_mpstate.
>
> Right, but that can then easily become part of the to-be-defined nested
> vcpu state (which is likely more than vmcs12).
>
Yes, I am not saying we have to implement it right away.

--
Gleb.