Re: [PATCH v3 5/6] KVM: X86: Add NMI support to PV IPIs

From: Wanpeng Li
Date: Sun Jul 22 2018 - 20:52:23 EST


On Fri, 20 Jul 2018 at 21:27, Radim Krcmar <rkrcmar@xxxxxxxxxx> wrote:
>
> 2018-07-20 10:04+0200, Paolo Bonzini:
> > On 20/07/2018 05:53, Wanpeng Li wrote:
> > >>> - ret = kvm_hypercall3(KVM_HC_SEND_IPI, ipi_bitmap_low, ipi_bitmap_high, vector);
> > >>> + switch (vector) {
> > >>> + default:
> > >>> + icr = APIC_DM_FIXED | vector;
> > >>> + break;
> > >>> + case NMI_VECTOR:
> > >>> + icr = APIC_DM_NMI;
> > >> I think it would be better to say that KVM interprets NMI_VECTOR and
> > >> sends the interrupt as APIC_DM_NMI.
> >
> > It's not KVM, this is arch/x86/kernel/kvm.c so the guest side.
>
> Yes, I was preparing to drop the delivery mode bits as they are not
> needed for NMI_VECTOR: real APIC can't send nor receive vectors 0-15, so
> we could just say that NMI_VECTOR is sendable through this interface and
> is delivered as APIC_DM_NMI.
>
> I didn't realize that this allows the other delivery modes. They are
> not useful [1], but we don't really have a better use for the three
> bits. The only other option so far is extending the cluster index to
> increase addressability ... I'm starting to reconsider as addressing
> another few millions VCPUs would probably be even more useless.
>
> Wanpeng, sorry for the confusion, feel free to use any version.
> Document the hypercall layout, though,

No problem, you and Paolo always help me a lot, thanks for that! :)

Regards,
Wanpeng Li

>
> thanks.
>
> ---
> 1: I think that OSes will use unicast INIT+SIPI as it's easier to call
> it after preparing structures for the new CPU; SMI is pointless;
> LowestPriority shouldn't be supported; and Reserved (APIC_DM_REMRD)
> is reused for KVM unhalt, where unicast is most likely.