Re: [PATCH] KVM: x86: don't notify userspace IOAPIC on edge-triggered interrupt EOI

From: Vitaly Kuznetsov
Date: Tue Feb 18 2020 - 04:51:16 EST


linmiaohe <linmiaohe@xxxxxxxxxx> writes:

> Vitaly Kuznetsov <vkuznets@xxxxxxxxxx> writes:
>>linmiaohe <linmiaohe@xxxxxxxxxx> writes:
>>
>>> @@ -417,7 +417,7 @@ void kvm_scan_ioapic_routes(struct kvm_vcpu *vcpu,
>>>
>>> kvm_set_msi_irq(vcpu->kvm, entry, &irq);
>>>
>>> - if (irq.level &&
>>> + if (irq.trig_mode &&
>>> kvm_apic_match_dest(vcpu, NULL, APIC_DEST_NOSHORT,
>>> irq.dest_id, irq.dest_mode))
>>> __set_bit(irq.vector, ioapic_handled_vectors);
>>
>>Assuming Radim's comment (13db77347db1) is correct, the change in
>>3159d36ad799 looks wrong and your patch restores the status quo. Actually, kvm_set_msi_irq() always sets irq->level = 1 so checking it is pointless.
>>
>>Reviewed-by: Vitaly Kuznetsov <vkuznets@xxxxxxxxxx>
>
> Thanks for review.
>
>>
>> (but it is actually possible that there's a buggy userspace out there which expects EOI notifications; we won't find out unless we try to fix the bug).
>>
>
> Yeh, there may be a buggy userspace hidden from this unexpected EOI notifications. It may not be worth enough to fix it as we may spend many time
> to catch the bug.
> Perhaps we should only remove the pointless checking of irq->level for cleanup. :)

I'm feeling brave so in case nobody expresses any particular concerns
let's just fix it :-)

--
Vitaly