To make my Xen drivers work more like they are talking to ‘real’
hardware, I have the bus driver enumerate the children with a resource
requirement of the same interrupt as the bus driver, so each device
connects to the same interrupt. On my test system I have the bus driver
and 3 device drivers - 2 x xenvbd (block device driver) and 1 x xennet
(network driver). They load in that order so for every interrupt that
occurs for the bus driver, the ISR for each child device is also called.
Each device always tells windows that the interrupt was not for itself
to ensure that the next device is always called.
So for example, if an interrupt occurs which is really a xen event for
the second xenvbd device, the ISR call list goes like:
- bus driver isr is called and it works out which child device(s) the
event is for, and sets a bit in a shared memory area for that device. - xenvbd #1 isr checks the shared memory area, notices that the
interrupt is not for it, and returns immediately - xenvbd #2 isr checks the shared memory area, notices that the
interrupt is for it, and does its processing - xennet isr checks the shared memory area, notices that the interrupt
is not for it, and returns immediately
Aside from the obvious performance hit of having additional overhead per
isr, it works really well, except (I’ve just found out) when the hal
type is set to ‘Standard PC’ instead of ‘ACPI xxx’. What happens then is
that the bus driver, xenvbd #1, and xenvbd #2 ISR’s are always called,
but xennet (NDIS 5.1 driver) stops getting for every interrupt after the
first 500 or so interrupts. Instead it only gets called every 3-20(-ish)
interrupts. My test environment is Windows 2003 R2 SP2
It’s almost like NDIS is assuming that I am getting spurious interrupts
and trying to save me some time or something.
Under the ACPI HAL, the PCI device gets an IRQ of 28, but under Standard
PC, I am obviously limited to IRQ’s <16 so I get IRQ 5. Not sure if
that’s important, except that maybe the PIC behaves differently than an
APIC would, or maybe it’s an artefact of virtualisation?
Can anyone offer any suggestions? Or any way to approach this
differently? Is there a way to create a virtual interrupt driver (eg
something that exposes IRQ resources) under Windows so that the child
devices can attach to my virtual interrupts?
Merry Christmas all!
Thanks
James