You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Our implementation of MSI-X was taken from the equivalent
Cloud Hypervisor one. Cloud Hypervisor supports non-KVM hypervisors,
hence they introduced a few abstractions to cater for that. More
specifically, they are using a trait (`InterruptSourceGroup`) to
describe the underlying hypervisor-specific mechanism used to drive
MSI-X interrupts from the device to the guest.
Moreover, they use a couple of types to distinguish between MSI, MSI-X
and legacy IRQ interrupts and how these can be configured. This is
especially useful for MSI/MSI-X interrupts where the interrupt
configuration is provided by the guest over PCI bus MMIO accesses.
Finally, in order to allow for transparent error handling, `Result`
types returned by related trait methods was returning `std::io::Error`
types as the error type, which is not very intuitive.
We don't need all of that. We clearly distinguish between legacy
interrupts and MSI-X (we don't use at all MSI), so we can simply plug in
all the definitions directly where we need them without any dynamic
dispatch indirection.
Moreover, various MSI-X components were stored all over the place
creating a lot of unnecessary duplication.
This commit refactors our implementation to get rid of the unnecessary
bit of dynamic dispatch. We still keep the `VirtioInterrupt` trait which
we use to abstract the actual interrupt type (IRQ or MSI-X) from VirtIO
devices. Moreover, it removes the duplication of MSI-X related types
across various types. We only duplicate the MSI-X configuration type
(which is behind an Arc) in a few places to avoid needing to
unnecessarily take a lock(). Moreover, we introduce a single interrupt
related error type and get rid of the `std::io::Error` usage.
Finally, it introduces a couple of metrics for interrupts that are
useful information by themselves, but also help us maintain some unit
testing assertions for which we were relying on a mock type that
implemented `InterruptSourceGroup`.
Signed-off-by: Babis Chalios <[email protected]>
0 commit comments