Re: [PATCH v3 3/4] KVM: x86: Add lowest-priority support for vt-d posted-interrupts

From: Radim KrcmÃr
Date: Fri Jan 22 2016 - 09:07:48 EST

2016-01-22 05:12+0000, Wu, Feng:
>> From: Radim KrÄmÃÅ [mailto:rkrcmar@xxxxxxxxxx]
>> 2016-01-20 09:42+0800, Feng Wu:
>>> - if (kvm_intr_is_single_vcpu_fast(kvm, irq, dest_vcpu))
>>> + if (kvm_intr_can_posting_fast(kvm, irq, dest_vcpu))
>>> return true;
>> There is one pitfall: xAPIC flat logical broadcast returns false,
> Do you mean kvm_intr_can_posting_fast() returns false for
> xAPIC flat logical lowest-priority broadcast?

I did.

> After carefully read the code for several times, I still cannot
> find the reason, could you please give more hints?

You are right, there isn't a problem in the code.

> BTW, I noticed there is a "if(irq->dest_id == 0xFF) goto out;" in
> this function, but it is for the physical dest mode. I am not
> sure you mean this.

I didn't check if my assumptions were wrong. I'm sorry.

>> but lowest priority is defined for it (practically isn't a broadcast) and
>> the rest of this function doesn't check for lowest priority, so the
>> interrupt won't be posted.
>> We could modify our _fast functions to cover 0xff in flat logical, but
>> ignoring this case isn't bad either ... it can happen only with 8 VCPU
>> guests.
> Could you please elaborate a bit more why only for the 8 VCPU guests?

xAPIC flat logical doesn't forbid lowest priority broadcasts, but lowest
priority delivery still needs to have all destinations enabled, which
can only happen with 8 VCPUs.