Re: [PATCH v4 3/9] KVM: Clear assigned guest IRQ on release

Jan Kiszka
2010-11-09T11:20:26Z

Am 09.11.2010 11:58, Avi Kivity wrote:
> On 11/08/2010 01:21 PM, Jan Kiszka wrote:
>> When we deassign a guest IRQ, clear the potentially asserted guest line.
>> There might be no chance for the guest to do this, specifically if we
>> switch from INTx to MSI mode.
>>
>> Signed-off-by: Jan Kiszka<jan.kiszka@siemens.com>
>> ---
>> virt/kvm/assigned-dev.c | 3 +++
>> 1 files changed, 3 insertions(+), 0 deletions(-)
>>
>> diff --git a/virt/kvm/assigned-dev.c b/virt/kvm/assigned-dev.c
>> index 7c98928..ecc4419 100644
>> --- a/virt/kvm/assigned-dev.c
>> +++ b/virt/kvm/assigned-dev.c
>> @@ -141,6 +141,9 @@ static void deassign_guest_irq(struct kvm *kvm,
>> kvm_unregister_irq_ack_notifier(kvm,&assigned_dev->ack_notifier);
>> assigned_dev->ack_notifier.gsi = -1;
>>
>> + kvm_set_irq(assigned_dev->kvm, assigned_dev->irq_source_id,
>> + assigned_dev->guest_irq, 0);
>> +
>> if (assigned_dev->irq_source_id != -1)
>> kvm_free_irq_source_id(kvm, assigned_dev->irq_source_id);
>> assigned_dev->irq_source_id = -1;
>
> I guess this can't hurt. Did you see it happen in practice?

Yes, with prefer_msi=off and an e1000e-driven NIC: The legacy IRQ stayed
asserted when the guest actually enabled MSI.

Jan

--
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux