WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH 0/6] MSI-INTx interrupt translation for HVM

To: Shohei Fujiwara <fujiwara-sxa@xxxxxxxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH 0/6] MSI-INTx interrupt translation for HVM
From: Qing He <qing.he@xxxxxxxxx>
Date: Fri, 9 Jan 2009 14:57:16 +0800
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Thu, 08 Jan 2009 22:57:52 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <20090109131737.379F.CB716985@xxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <20090108194312.C770.CB716985@xxxxxxxxxxxxxxx> <20090108145200.GA23614@ub-qhe2> <20090109131737.379F.CB716985@xxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.17+20080114 (2008-01-14)
On Fri, 2009-01-09 at 12:26 +0800, Shohei Fujiwara wrote:
> There is the assumption that Guest OS handles all causes which happen
> before Guest OS receives the interrupt. But is the assumption right for
> all OS?
> 
> In the case of level-triggerd interrupt, I/O device asserts interrupt
> line, when the cause of interrupt happens. OS handles the cause,
> I/O device de-asserts interrupt, and OS sends EOI to APICs.
> 
> When I/O APIC receives EOI, I/O APIC re-transmits interrupt to Local APIC 
> if some interrupt line is asserted.
> 
> Some OS might rely on this re-transmittion by I/O APIC. 
> 

> 
> But other OS might have the code like the following:
> 
>       do {
>               ret = action->handler(irq, action->dev_id, regs);
>               if (ret == IRQ_HANDLED) {
>                       status |= action->flags;
>                       retval |= ret;
>                       break;
>                       ^^^^^^
>               }
>               action = action->next;
>       } while (action);
> 
Hmm, I think now I understand what you mean. If the guest irq is shared by
a normal IRQ and a MSI-INTx translated IRQ, two sources may assert the
pin while they both get pending. When this irq is injected, if the guest
only handles one irq source each time, and issues EOI right after it
clears the normal IRQ, the MSI is lost. Is it what you mean?

There is logic to avoid this from happening, see
hvm_irq->gsi_assert_count[gsi]. Basically, it's used to count how many
sources have asserted a shared pin. And at the time of  EOI, after the
decrement of the counter, if it's still not 0, the LAPIC is re-asserted.
This may result in some spurious interrupts to guest, but that's better
than losing interrupts.

The sharing of guest irq is generally not a good idea, in fact, this is
not even well supported in current Xen code. You may have seen something
like "girq[ggsi].mirq = mirq". That way, we are already stuck.
Currently, if the number of assigned devices is <= 8, there should be no
sharing, otherwise, very weird things may happen...

Uncommon devices of OS does have the possibility to fail MSI-INTx, for
example, if the device doesn't behave the same way using INTx and MSI,
or the guest OS doesn't always clear guest source before issuing EOI.
That's why I add the per-device disable function: if a device or OS
doesn't work properly, just turn it off. Fortunately, this is extremely
rare.

Btw, AFAIK, Windows handles all irq sources in one ISR, similar to
Linux.

Thanks,
Qing
> 
> This code will work on real machine, because I/O APIC re-transmits
> interrupt, if the cause to be handled remains.  If some OS has the
> code like the above, the assumption isn't right.
> 
> Actually, my concern is whether the assumption is right for Windows,
> or not. Do you know about this, or does your patch works well with
> Windows guest?
> 
> Thanks,
> --
> Shohei Fujiwara
> 
> > Generally, it's easy to "translate" an edged interrupt to a level one,
> > but not the other way.
> > 
> > Thanks,
> > Qing
> > > 
> > > What do you think?
> > > 
> > > Thanks,
> > > --
> > > Shohei Fujiwara
> > > 
> > 
> > _______________________________________________
> > Xen-devel mailing list
> > Xen-devel@xxxxxxxxxxxxxxxxxxx
> > http://lists.xensource.com/xen-devel

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>